-
Notifications
You must be signed in to change notification settings - Fork 712
Revamp registry test #3076
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
Revamp registry test #3076
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -432,12 +432,13 @@ func TestComposePushAndPullWithCosignVerify(t *testing.T) { | |
| keyPair := newCosignKeyPair(t, "cosign-key-pair") | ||
| defer keyPair.cleanup() | ||
|
|
||
| reg := testregistry.NewPlainHTTP(base, 5000) | ||
| defer reg.Cleanup() | ||
| reg := testregistry.NewWithNoAuth(base, 0, false) | ||
| defer reg.Cleanup(nil) | ||
|
|
||
| localhostIP := "127.0.0.1" | ||
| t.Logf("localhost IP=%q", localhostIP) | ||
| testImageRefPrefix := fmt.Sprintf("%s:%d/", | ||
| localhostIP, reg.ListenPort) | ||
| localhostIP, reg.Port) | ||
|
Member
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. Why renamed?
Contributor
Author
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. "ListenIP" makes sense (0.0.0.0) - as in "the address the registry process is binding to" - and also does "IP" (the exposed ip you can access it with). It seems better to me that way. Either way, this is minor. I can reverse it if you dont like it. Thanks @AkihiroSuda |
||
| t.Logf("testImageRefPrefix=%q", testImageRefPrefix) | ||
|
|
||
| var ( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,10 @@ func TestImageConvertNydus(t *testing.T) { | |
| } | ||
| testutil.RequireExecutable(t, "nydus-image") | ||
| testutil.DockerIncompatible(t) | ||
|
|
||
| base := testutil.NewBase(t) | ||
| t.Parallel() | ||
|
|
||
| convertedImage := testutil.Identifier(t) + ":nydus" | ||
| base.Cmd("rmi", convertedImage).Run() | ||
| base.Cmd("pull", testutil.CommonImage).AssertOK() | ||
|
|
@@ -48,18 +51,20 @@ func TestImageConvertNydus(t *testing.T) { | |
| t.Skip("Nydusify check is not supported rootless mode.") | ||
| } | ||
|
|
||
| // skip if nydusify is not installed | ||
| // skip if nydusify and nydusd are not installed | ||
| testutil.RequireExecutable(t, "nydusify") | ||
| testutil.RequireExecutable(t, "nydusd") | ||
|
Contributor
Author
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. Adding missing requirement |
||
|
|
||
| // setup local docker registry | ||
| registryPort := 15000 | ||
| registry := testregistry.NewPlainHTTP(base, registryPort) | ||
| defer registry.Cleanup() | ||
| registry := testregistry.NewWithNoAuth(base, 0, false) | ||
| remoteImage := fmt.Sprintf("%s:%d/nydusd-image:test", "localhost", registry.Port) | ||
| t.Cleanup(func() { | ||
|
Contributor
Author
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. Cleanup is better to use than defer |
||
| base.Cmd("rmi", remoteImage).Run() | ||
| registry.Cleanup(nil) | ||
| }) | ||
|
|
||
| remoteImage := fmt.Sprintf("%s:%d/nydusd-image:test", registry.IP.String(), registryPort) | ||
| base.Cmd("tag", convertedImage, remoteImage).AssertOK() | ||
| defer base.Cmd("rmi", remoteImage).Run() | ||
| base.Cmd("push", "--insecure-registry", remoteImage).AssertOK() | ||
| base.Cmd("push", remoteImage).AssertOK() | ||
| nydusifyCmd := testutil.Cmd{ | ||
| Cmd: icmd.Command( | ||
| "nydusify", | ||
|
|
@@ -73,5 +78,8 @@ func TestImageConvertNydus(t *testing.T) { | |
| ), | ||
| Base: base, | ||
| } | ||
|
|
||
| // nydus is creating temporary files - make sure we are in a proper location for that | ||
| nydusifyCmd.Cmd.Dir = base.T.TempDir() | ||
| nydusifyCmd.AssertOK() | ||
| } | ||
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.
Why renamed?
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.
Methods have been simplified / renamed:
Let me know if you don't like it and I can revert this one if you wish.