Skip to content

Commit

Permalink
chore: exclude buggy code test
Browse files Browse the repository at this point in the history
  • Loading branch information
j-luong committed Aug 2, 2024
1 parent ecba03a commit fcb0e2f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
if: ${{ matrix.os == 'ubuntu' }}
run: mvn -B invoker:install invoker:run
env:
POM_EXCLUDE_CODE_TEST: "test-code-test/pom.xml"
SNYK_TEST_TOKEN: ${{secrets.SNYK_TEST_TOKEN}}
SNYK_CLI_EXECUTABLE: /usr/local/bin/snyk
SNYK_DOWNLOAD_DESTINATION: "downloads/snyk"
Expand All @@ -65,6 +66,7 @@ jobs:
if: ${{ matrix.os == 'macos' }}
run: mvn -B invoker:install invoker:run
env:
POM_EXCLUDE_CODE_TEST: "test-code-test/pom.xml"
SNYK_TEST_TOKEN: ${{secrets.SNYK_TEST_TOKEN}}
SNYK_CLI_EXECUTABLE: /opt/homebrew/bin/snyk
SNYK_DOWNLOAD_DESTINATION: "downloads/snyk"
Expand All @@ -73,6 +75,7 @@ jobs:
if: ${{ matrix.os == 'windows' }}
run: mvn -B invoker:install invoker:run
env:
POM_EXCLUDE_CODE_TEST: "test-code-test/pom.xml"
POM_EXCLUDE_PATTERN: "test-container-test/pom.xml"
SNYK_TEST_TOKEN: ${{secrets.SNYK_TEST_TOKEN}}
SNYK_CLI_EXECUTABLE: "C:\\npm\\prefix\\snyk.cmd"
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@
</pomIncludes>
<pomExcludes>
<pomExclude>${env.POM_EXCLUDE_PATTERN}</pomExclude>
<pomExclude>${env.POM_EXCLUDE_CODE_TEST}</pomExclude>
</pomExcludes>
<preBuildHookScript>setup</preBuildHookScript>
<postBuildHookScript>verify</postBuildHookScript>
Expand Down
10 changes: 5 additions & 5 deletions src/it/test-code-test/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import org.codehaus.plexus.util.FileUtils;

// TODO: debug issue with this test

//String log = FileUtils.fileRead(new File(basedir, "build.log"))
//
//if (!log.contains("SQL Injection")) {
// throw new Exception("no sql injection issue found")
//}
String log = FileUtils.fileRead(new File(basedir, "build.log"))

if (!log.contains("SQL Injection")) {
throw new Exception("no sql injection issue found")
}

return true;
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void throwsWhenShaDoesntMatch() throws Exception {
File cliFile = new File(cliPath.toString());

FileDownloader mockDownloader = (URL url, File target) -> {
if (url.toString().equals("https://static.snyk.io/cli/stable/snyk-macos.sha256")) {
if (url.toString().equals("https://static.snyk.io/cli/stable/snyk-macos.sha256?utm_source=MAVEN_PLUGIN")) {
Files.write(target.toPath(), incorrectShasum);
} else {
Files.write(target.toPath(), helloWorldBytes);
Expand All @@ -39,7 +39,7 @@ public void throwsWhenShaDoesntMatch() throws Exception {
mockDownloader
));

assertEquals(e.getMessage(), "computed sha256 checksum for CLI download does not expected");
assertEquals("computed sha256 checksum for CLI download does not expected", e.getMessage());
}

@Test
Expand Down

0 comments on commit fcb0e2f

Please sign in to comment.