summaryrefslogtreecommitdiff
path: root/hack/podman-registry-go/registry_test.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-20 18:39:37 +0200
committerGitHub <noreply@github.com>2020-05-20 18:39:37 +0200
commit09f8f14b4f7d09946d3d5cfc5460ec9923f7da59 (patch)
tree736da2a5f8ca84ab49e07302a4d986d570e1ccc9 /hack/podman-registry-go/registry_test.go
parent70d89bfc6289e7404f5744149d7c7f460f3ba69b (diff)
parentdfe0579a2f2206d30ea6040c23c4343706b782dc (diff)
downloadpodman-09f8f14b4f7d09946d3d5cfc5460ec9923f7da59.tar.gz
podman-09f8f14b4f7d09946d3d5cfc5460ec9923f7da59.tar.bz2
podman-09f8f14b4f7d09946d3d5cfc5460ec9923f7da59.zip
Merge pull request #6273 from vrothberg/registry_helper
Registry helper : go bindings
Diffstat (limited to 'hack/podman-registry-go/registry_test.go')
-rw-r--r--hack/podman-registry-go/registry_test.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/hack/podman-registry-go/registry_test.go b/hack/podman-registry-go/registry_test.go
new file mode 100644
index 000000000..4e4bf5fe2
--- /dev/null
+++ b/hack/podman-registry-go/registry_test.go
@@ -0,0 +1,40 @@
+package registry
+
+import (
+ "testing"
+
+ "github.com/hashicorp/go-multierror"
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+)
+
+func TestStartAndStopMultipleRegistries(t *testing.T) {
+ binary = "../podman-registry"
+
+ registries := []*Registry{}
+
+ // Start registries.
+ var errors *multierror.Error
+ for i := 0; i < 3; i++ {
+ reg, err := Start()
+ if err != nil {
+ errors = multierror.Append(errors, err)
+ continue
+ }
+ assert.True(t, len(reg.Image) > 0)
+ assert.True(t, len(reg.User) > 0)
+ assert.True(t, len(reg.Password) > 0)
+ assert.True(t, len(reg.Port) > 0)
+ registries = append(registries, reg)
+ }
+
+ // Stop registries.
+ for _, reg := range registries {
+ // Make sure we can stop it properly.
+ errors = multierror.Append(errors, reg.Stop())
+ // Stopping an already stopped registry is fine as well.
+ errors = multierror.Append(errors, reg.Stop())
+ }
+
+ require.NoError(t, errors.ErrorOrNil())
+}