Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: bump docker API to 1.45 [backport: release/v0.52] #6922

Merged
merged 2 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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