summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2022-07-06 14:38:48 -0600
committerEd Santiago <santiago@redhat.com>2022-07-07 14:03:42 -0600
commit1161e8bd548d23ea9b8cf5ba12d89ded3f86a425 (patch)
treeb16c7f871cbfb7695589706adf55277b2c3d8888 /test/e2e
parent700f1faf6e5449e13970fc17311b09e4ca9ac2c3 (diff)
downloadpodman-1161e8bd548d23ea9b8cf5ba12d89ded3f86a425.tar.gz
podman-1161e8bd548d23ea9b8cf5ba12d89ded3f86a425.tar.bz2
podman-1161e8bd548d23ea9b8cf5ba12d89ded3f86a425.zip
manifest_test: safer registry setup and teardown
manifest_test:authenticated_push() is the final test left to fix before merging #14397. The reason it's failing _seems_ to be that podman is running with a mix of netavark and CNI, and that _seems_ to be because this test invokes hack/podman-registry which invokes plain podman without whatever options used in e2e. Starting a registry directly from the test is insane: there is no reusable code for doing that (see login_logout_test.go and push_test.go. Yeesh.) Solution: set $PODMAN, by inspecting the podmanTest object which includes both a path and a list of options. podman-registry will invoke that. (It will also override --root and --runroot. This is the desired behavior). Also: add cleanup. If auth-push test fails, stop the registry. Also: add a sanity check to podman-registry script, have it wait for the registry port to activate. Die if it doesn't. That could've saved us a nice bit of debugging time. Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/libpod_suite_test.go5
-rw-r--r--test/e2e/manifest_test.go20
2 files changed, 23 insertions, 2 deletions
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index a633bd3d7..ecb7a2278 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -76,3 +76,8 @@ func (p *PodmanTestIntegration) StopRemoteService() {}
// We don't support running API service when local
func (p *PodmanTestIntegration) StartRemoteService() {
}
+
+// Just a stub for compiling with `!remote`.
+func getRemoteOptions(p *PodmanTestIntegration, args []string) []string {
+ return nil
+}
diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go
index 2f8b47e25..280276973 100644
--- a/test/e2e/manifest_test.go
+++ b/test/e2e/manifest_test.go
@@ -17,6 +17,7 @@ var _ = Describe("Podman manifest", func() {
tempdir string
err error
podmanTest *PodmanTestIntegration
+ registry *podmanRegistry.Registry
)
const (
@@ -39,10 +40,16 @@ var _ = Describe("Podman manifest", func() {
})
AfterEach(func() {
+ // if auth test fails, it will leave a registry running
+ if registry != nil {
+ _ = registry.Stop()
+ }
+ // Also from auth test; don't propagate it to other tests
+ os.Unsetenv("PODMAN")
+
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
processTestResult(f)
-
})
It("create w/o image", func() {
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
@@ -297,7 +304,15 @@ var _ = Describe("Podman manifest", func() {
registryOptions := &podmanRegistry.Options{
Image: "docker-archive:" + imageTarPath(REGISTRY_IMAGE),
}
- registry, err := podmanRegistry.StartWithOptions(registryOptions)
+
+ // registry script invokes $PODMAN; make sure we define that
+ // so it can use our same networking options.
+ opts := strings.Join(podmanTest.MakeOptions(nil, false, false), " ")
+ if IsRemote() {
+ opts = strings.Join(getRemoteOptions(podmanTest, nil), " ")
+ }
+ os.Setenv("PODMAN", podmanTest.PodmanBinary+" "+opts)
+ registry, err = podmanRegistry.StartWithOptions(registryOptions)
Expect(err).To(BeNil())
session := podmanTest.Podman([]string{"manifest", "create", "foo"})
@@ -330,6 +345,7 @@ var _ = Describe("Podman manifest", func() {
err = registry.Stop()
Expect(err).To(BeNil())
+ registry = nil
})
It("push with error", func() {