Skip to content

Commit 91bf4ca

Browse files
#136 add comments to integration test
1 parent 52f5ddf commit 91bf4ca

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

test/com/cloudogu/ces/cesbuildlib/TrivyTest.groovy

+2
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ class TrivyTest extends GroovyTestCase {
4646
when(imageMock.inside(matches("-v /test/.trivy/.cache:/root/.cache/"), any())).thenAnswer(new Answer<Integer>() {
4747
@Override
4848
Integer answer(InvocationOnMock invocation) throws Throwable {
49+
// mock "sh trivy" so that it returns the expected status code and check trivy arguments
4950
Integer expectedStatusCode = 0
5051
Closure closure = invocation.getArgument(1)
5152
scriptMock.expectedShRetValueForScript.put(expectedTrivyCommand, expectedStatusCode)
5253
Integer statusCode = closure.call() as Integer
5354
assertEquals(expectedStatusCode, statusCode)
5455
assertEquals(expectedTrivyCommand, scriptMock.getActualShMapArgs().getLast())
5556

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

0 commit comments

Comments
 (0)