Skip to content

Commit

Permalink
test: bump docker API to 1.45 [backport: release/v0.52] (#6922)
Browse files Browse the repository at this point in the history
Co-authored-by: DmitriyLewen <91113035+DmitriyLewen@users.noreply.github.com>
Co-authored-by: DmitriyLewen <dmitriy.lewen@smartforce.io>
  • Loading branch information
3 people committed Jun 13, 2024
1 parent 3f5874c commit 191d31e
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 83 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/aquasecurity/go-version v0.0.0-20210121072130-637058cfe492
github.com/aquasecurity/loading v0.0.5
github.com/aquasecurity/table v1.8.0
github.com/aquasecurity/testdocker v0.0.0-20240419073403-90bd43849334
github.com/aquasecurity/testdocker v0.0.0-20240613070307-2c3868d658ac
github.com/aquasecurity/tml v0.6.1
github.com/aquasecurity/trivy-aws v0.9.0
github.com/aquasecurity/trivy-checks v0.11.0
Expand Down
125 changes: 50 additions & 75 deletions go.sum

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion integration/docker_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,14 @@ func TestDockerEngine(t *testing.T) {
osArgs = append(osArgs, tt.input)

// Run Trivy
runTest(t, osArgs, tt.golden, "", types.FormatJSON, runOptions{wantErr: tt.wantErr})
runTest(t, osArgs, tt.golden, "", types.FormatJSON, runOptions{
wantErr: tt.wantErr,
// Container field was removed in Docker Engine v26.0
// cf. https://github.com/docker/cli/blob/v26.1.3/docs/deprecated.md#container-and-containerconfig-fields-in-image-inspect
override: overrideFuncs(overrideUID, func(t *testing.T, want, _ *types.Report) {
want.Metadata.ImageConfig.Container = ""
}),
})
})
}
}
3 changes: 1 addition & 2 deletions pkg/fanal/image/daemon/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var imagePaths = map[string]string{

// for Docker
var opt = engine.Option{
APIVersion: "1.38",
APIVersion: "1.45",
ImagePaths: imagePaths,
}

Expand Down Expand Up @@ -167,7 +167,6 @@ func Test_image_ConfigFile(t *testing.T) {
imageName: "alpine:3.11",
want: &v1.ConfigFile{
Architecture: "amd64",
Container: "fb71ddde5f6411a82eb056a9190f0cc1c80d7f77a8509ee90a2054428edb0024",
OS: "linux",
Created: v1.Time{Time: time.Date(2020, 3, 23, 21, 19, 34, 196162891, time.UTC)},
DockerVersion: "18.09.7",
Expand Down
2 changes: 1 addition & 1 deletion pkg/fanal/image/daemon/podman_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func setupPodmanSock(t *testing.T) *httptest.Server {
sockPath := filepath.Join(dir, "podman.sock")

opt := engine.Option{
APIVersion: "1.40",
APIVersion: "1.45",
ImagePaths: map[string]string{
"index.docker.io/library/alpine:3.11": "../../test/testdata/alpine-311.tar.gz",
},
Expand Down
4 changes: 1 addition & 3 deletions pkg/fanal/image/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func setupEngineAndRegistry() (*httptest.Server, *httptest.Server) {
"a187dde48cd2": "../test/testdata/alpine-311.tar.gz",
}
opt := engine.Option{
APIVersion: "1.38",
APIVersion: "1.45",
ImagePaths: imagePaths,
}
te := engine.NewDockerEngine(opt)
Expand Down Expand Up @@ -74,7 +74,6 @@ func TestNewDockerImage(t *testing.T) {
wantRepoTags: []string{"alpine:3.11"},
wantConfigFile: &v1.ConfigFile{
Architecture: "amd64",
Container: "fb71ddde5f6411a82eb056a9190f0cc1c80d7f77a8509ee90a2054428edb0024",
OS: "linux",
Created: v1.Time{Time: time.Date(2020, 3, 23, 21, 19, 34, 196162891, time.UTC)},
DockerVersion: "18.09.7",
Expand Down Expand Up @@ -118,7 +117,6 @@ func TestNewDockerImage(t *testing.T) {
wantRepoTags: []string{"alpine:3.11"},
wantConfigFile: &v1.ConfigFile{
Architecture: "amd64",
Container: "fb71ddde5f6411a82eb056a9190f0cc1c80d7f77a8509ee90a2054428edb0024",
OS: "linux",
Created: v1.Time{Time: time.Date(2020, 3, 23, 21, 19, 34, 196162891, time.UTC)},
DockerVersion: "18.09.7",
Expand Down

0 comments on commit 191d31e

Please sign in to comment.