diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2020-05-19 13:42:46 +0200 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2020-05-20 15:12:35 +0200 |
commit | dfe0579a2f2206d30ea6040c23c4343706b782dc (patch) | |
tree | 8e8f29cb90baa10ea4930f83a9dd22e931bc6c30 /hack/podman-registry-go/registry_test.go | |
parent | 973d6244189133b14c8cb77c6b377fb2b2a1501f (diff) | |
download | podman-dfe0579a2f2206d30ea6040c23c4343706b782dc.tar.gz podman-dfe0579a2f2206d30ea6040c23c4343706b782dc.tar.bz2 podman-dfe0579a2f2206d30ea6040c23c4343706b782dc.zip |
add go-bindings for `hack/podman-registry`
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'hack/podman-registry-go/registry_test.go')
-rw-r--r-- | hack/podman-registry-go/registry_test.go | 40 |
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()) +} |