-
Notifications
You must be signed in to change notification settings - Fork 609
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
Ensure all layers are here when tagging, committing, saving, or converting #3435
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9539f6b
Add fetch and EnsureAllContent methods
apostasie 8ba7ce7
EnsureAllContent on commit
apostasie ef09d19
EnsureAllContent on convert
apostasie 8e10d87
EnsureAllContent on save
apostasie 1e52bf5
EnsureAllContent on tag
apostasie 764a2aa
Fix tests and add regression tests for #3425
apostasie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,8 +20,6 @@ import ( | |
"strings" | ||
"testing" | ||
|
||
"gotest.tools/v3/icmd" | ||
|
||
"github.com/containerd/nerdctl/v2/pkg/testutil" | ||
) | ||
|
||
|
@@ -35,12 +33,11 @@ It will regularly succeed or fail, making random PR fail the Kube check. | |
func TestKubeCommitPush(t *testing.T) { | ||
t.Parallel() | ||
|
||
t.Skip("Test that confirm that #827 is still broken is too flaky") | ||
|
||
base := testutil.NewBaseForKubernetes(t) | ||
tID := testutil.Identifier(t) | ||
|
||
var containerID string | ||
// var registryIP string | ||
|
||
setup := func() { | ||
testutil.KubectlHelper(base, "run", "--image", testutil.CommonImage, tID, "--", "sleep", "Inf"). | ||
|
@@ -55,26 +52,45 @@ func TestKubeCommitPush(t *testing.T) { | |
cmd := testutil.KubectlHelper(base, "get", "pods", tID, "-o", "jsonpath={ .status.containerStatuses[0].containerID }") | ||
cmd.Run() | ||
containerID = strings.TrimPrefix(cmd.Out(), "containerd://") | ||
|
||
// This below is missing configuration to allow for plain http communication | ||
// This is left here for future work to successfully start a registry usable in the cluster | ||
/* | ||
// Start a registry | ||
testutil.KubectlHelper(base, "run", "--port", "5000", "--image", testutil.RegistryImageStable, "testregistry"). | ||
AssertOK() | ||
testutil.KubectlHelper(base, "wait", "pod", "testregistry", "--for=condition=ready", "--timeout=1m"). | ||
AssertOK() | ||
cmd = testutil.KubectlHelper(base, "get", "pods", tID, "-o", "jsonpath={ .status.hostIPs[0].ip }") | ||
cmd.Run() | ||
registryIP = cmd.Out() | ||
cmd = testutil.KubectlHelper(base, "apply", "-f", "-", fmt.Sprintf(`apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: local-registry | ||
namespace: nerdctl-test | ||
data: | ||
localRegistryHosting.v1: | | ||
host: "%s:5000" | ||
help: "https://kind.sigs.k8s.io/docs/user/local-registry/" | ||
`, registryIP)) | ||
*/ | ||
|
||
} | ||
|
||
tearDown := func() { | ||
testutil.KubectlHelper(base, "delete", "pod", "-f", tID).Run() | ||
testutil.KubectlHelper(base, "delete", "pod", "--all").Run() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For some reason that escapes me, kubectl was not cleaning up with the pod name |
||
} | ||
|
||
tearDown() | ||
t.Cleanup(tearDown) | ||
setup() | ||
|
||
t.Run("test commit / push on Kube (https://github.com/containerd/nerdctl/issues/827)", func(t *testing.T) { | ||
t.Log("This test is meant to verify that we can commit / push an image from a pod." + | ||
"Currently, this is broken, hence the test assumes it will fail. Once the problem is fixed, we should just" + | ||
"change the expectation to 'success'.") | ||
|
||
base.Cmd("commit", containerID, "registry.example.com/my-app:v1").AssertOK() | ||
// See note above. | ||
base.Cmd("push", "registry.example.com/my-app:v1").Assert(icmd.Expected{ | ||
ExitCode: 1, | ||
Err: "failed to create a tmp single-platform image", | ||
}) | ||
base.Cmd("commit", containerID, "testcommitsave").AssertOK() | ||
base.Cmd("save", "testcommitsave").AssertOK() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This correctly reproduce issue #827 I believe. |
||
}) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was not able / interested enough to finish setting up a cluster registry.
This here is a start, and can be completed later on, either by me or someone else.