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

Remove Docker incompat from image prune and build tests #3330

Merged
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
1 change: 0 additions & 1 deletion cmd/nerdctl/builder_build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ RUN ["cat", "/hello_from_dir2.txt"]`, testutil.CommonImage, filename)
// https://github.com/docker/buildx/pull/1482
func TestBuildSourceDateEpoch(t *testing.T) {
testutil.RequiresBuild(t)
testutil.DockerIncompatible(t) // Needs buildx v0.10 (https://github.com/docker/buildx/pull/1489)
base := testutil.NewBase(t)
imageName := testutil.Identifier(t)
defer base.Cmd("rmi", imageName).AssertOK()
Expand Down
13 changes: 9 additions & 4 deletions cmd/nerdctl/image_prune_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,17 @@ func TestImagePruneFilterUntil(t *testing.T) {
testutil.RequiresBuild(t)
testutil.RegisterBuildCacheCleanup(t)

// Docker image's created timestamp is set based on base image creation time.
testutil.DockerIncompatible(t)

base := testutil.NewBase(t)
// For deterministically testing the filter, set the image's created timestamp to 2 hours in the past.
base.Env = append(base.Env, fmt.Sprintf("SOURCE_DATE_EPOCH=%d", time.Now().Add(-2*time.Hour).Unix()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a comment line to explain this


imageName := testutil.Identifier(t)
t.Cleanup(func() { base.Cmd("rmi", "--force", imageName) })
teardown := func() {
// Image should have been pruned; but cleanup on failure.
base.Cmd("rmi", "--force", imageName).Run()
}
t.Cleanup(teardown)
teardown()

dockerfile := fmt.Sprintf(`FROM %s
CMD ["echo", "nerdctl-test-image-prune-filter-until"]`, testutil.CommonImage)
Expand Down
Loading