Skip to content

Commit

Permalink
#136 add comments to integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-dammeier committed Nov 27, 2024
1 parent 52f5ddf commit 91bf4ca
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/com/cloudogu/ces/cesbuildlib/TrivyTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ class TrivyTest extends GroovyTestCase {
when(imageMock.inside(matches("-v /test/.trivy/.cache:/root/.cache/"), any())).thenAnswer(new Answer<Integer>() {
@Override
Integer answer(InvocationOnMock invocation) throws Throwable {
// mock "sh trivy" so that it returns the expected status code and check trivy arguments
Integer expectedStatusCode = 0
Closure closure = invocation.getArgument(1)
scriptMock.expectedShRetValueForScript.put(expectedTrivyCommand, expectedStatusCode)
Integer statusCode = closure.call() as Integer
assertEquals(expectedStatusCode, statusCode)
assertEquals(expectedTrivyCommand, scriptMock.getActualShMapArgs().getLast())

// emulate trivy call with local trivy installation and check that it has the same behavior
Files.createDirectories(trivyDir)
Process process = trivyExec.exec(Trivy.DEFAULT_TRIVY_VERSION, trivyArguments, workDir)
if(process.waitFor(2, TimeUnit.MINUTES)) {
Expand Down

0 comments on commit 91bf4ca

Please sign in to comment.