Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 99ce224

Browse files
authored
Merge pull request #112 from glours/use_container_test
Use snyk container test command instead of snyk test --docker one to …
2 parents b8ee514 + d23c104 commit 99ce224

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

e2e/scan_test.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ import (
3737

3838
const (
3939
ImageWithVulnerabilities = "alpine:3.10.0"
40-
ImageWithoutVulnerabilities = "dockerscanci/scratch:1.0" // FROM scratch
40+
ImageWithoutVulnerabilities = "hello-world"
41+
InvalidImage = "dockerscanci/scratch:1.0" // FROM scratch
4142
ImageBaseImageVulnerabilities = "dockerscanci/base-image-vulns:1.0" // FROM alpine:3.10.0
4243
)
4344

@@ -124,6 +125,12 @@ func TestScanWithSnyk(t *testing.T) {
124125
exitCode: 0,
125126
contains: "no vulnerable paths found",
126127
},
128+
{
129+
name: "invalid-docker-archive",
130+
image: InvalidImage,
131+
exitCode: 2,
132+
contains: "Invalid Docker archive",
133+
},
127134
{
128135
name: "image-with-vulnerabilities",
129136
image: ImageWithVulnerabilities,
@@ -134,7 +141,7 @@ func TestScanWithSnyk(t *testing.T) {
134141
name: "invalid-image-name",
135142
image: "scratch",
136143
exitCode: 2,
137-
contains: "image was not found locally and pulling failed",
144+
contains: "manifest unknown",
138145
},
139146
}
140147
for _, testCase := range testCases {
@@ -170,6 +177,12 @@ func TestScanJsonOutput(t *testing.T) {
170177
exitCode: 0,
171178
isEmpty: true,
172179
},
180+
{
181+
name: "invalid-docker-archive",
182+
image: InvalidImage,
183+
exitCode: 2,
184+
isEmpty: true,
185+
},
173186
{
174187
name: "image-with-vulnerabilities",
175188
image: ImageWithVulnerabilities,

internal/provider/snyk.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type snykProvider struct {
4545
// NewSnykProvider returns a Snyk implementation of scan provider
4646
func NewSnykProvider(ops ...SnykProviderOps) (Provider, error) {
4747
provider := snykProvider{
48-
flags: []string{"test", "--docker"},
48+
flags: []string{"container", "test"},
4949
}
5050
for _, op := range ops {
5151
if err := op(&provider); err != nil {

0 commit comments

Comments
 (0)