@@ -33,14 +33,15 @@ import (
33
33
)
34
34
35
35
func TestDisplayScanMessageAfterBuild (t * testing.T ) {
36
+
36
37
c := NewParallelE2eCLI (t , binDir )
37
38
setupScanPlugin (t , c )
38
39
39
40
res := c .RunDockerCmd ("info" )
40
41
res .Assert (t , icmd.Expected {Out : "scan: Docker Scan" })
41
42
42
43
t .Run ("display when docker build" , func (t * testing.T ) {
43
- res := c .RunDockerCmd ("build" , "-t" , "test-image-scan-msg" , "./fixtures/build-test/nginx-build" )
44
+ res := c .RunDockerCmd ("build" , "-t" , "test-image-scan-msg" , "./fixtures/simple- build-test/nginx-build" )
44
45
res .Assert (t , icmd.Expected {Out : "Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them" })
45
46
})
46
47
@@ -52,21 +53,21 @@ func TestDisplayScanMessageAfterBuild(t *testing.T) {
52
53
})
53
54
54
55
t .Run ("display on compose build" , func (t * testing.T ) {
55
- res := c .RunDockerCmd ("compose" , "-f" , "./fixtures/build-test/compose.yml" , "build" )
56
+ res := c .RunDockerCmd ("compose" , "-f" , "./fixtures/simple- build-test/compose.yml" , "-p" , "scan-msg-test " , "build" )
56
57
res .Assert (t , icmd.Expected {Out : "Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them" })
57
58
})
58
59
59
- _ = c .RunDockerOrExitError ("rmi" , "build -test_nginx" )
60
+ _ = c .RunDockerOrExitError ("rmi" , "scan-msg -test_nginx" )
60
61
61
62
t .Run ("display on compose up if image is built" , func (t * testing.T ) {
62
- res := c .RunDockerCmd ("compose" , "-f" , "./fixtures/build-test/compose.yml" , "up" , "-d" )
63
- defer c .RunDockerCmd ("compose" , "-f" , "./fixtures/build-test/compose.yml" , "down" )
63
+ res := c .RunDockerCmd ("compose" , "-f" , "./fixtures/simple- build-test/compose.yml" , "-p" , "scan-msg-test " , "up" , "-d" )
64
+ defer c .RunDockerCmd ("compose" , "-f" , "./fixtures/simple- build-test/compose.yml" , "-p" , "scan-msg-test " , "down" )
64
65
res .Assert (t , icmd.Expected {Out : "Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them" })
65
66
})
66
67
67
68
t .Run ("do not display on compose up if no image built" , func (t * testing.T ) { // re-run the same Compose aproject
68
- res := c .RunDockerCmd ("compose" , "-f" , "./fixtures/build-test/compose.yml" , "up" , "-d" )
69
- defer c .RunDockerCmd ("compose" , "-f" , "./fixtures/build-test/compose.yml" , "down" )
69
+ res := c .RunDockerCmd ("compose" , "-f" , "./fixtures/simple- build-test/compose.yml" , "-p" , "scan-msg-test " , "up" , "-d" )
70
+ defer c .RunDockerCmd ("compose" , "-f" , "./fixtures/simple- build-test/compose.yml" , "-p" , "scan-msg-test " , "down" )
70
71
assert .Assert (t , ! strings .Contains (res .Combined (), "docker scan" ), res .Combined ())
71
72
})
72
73
@@ -76,7 +77,7 @@ func TestDisplayScanMessageAfterBuild(t *testing.T) {
76
77
err := ioutil .WriteFile (scanConfigFile , []byte (`{"optin":true}` ), 0644 )
77
78
assert .NilError (t , err )
78
79
79
- res := c .RunDockerCmd ("build" , "-t" , "test-image-scan-msg" , "./fixtures/build-test/nginx-build" )
80
+ res := c .RunDockerCmd ("build" , "-t" , "test-image-scan-msg" , "./fixtures/simple- build-test/nginx-build" )
80
81
assert .Assert (t , ! strings .Contains (res .Combined (), "docker scan" ), res .Combined ())
81
82
})
82
83
}
0 commit comments