Files
podman/hack/podman-registry-go/registry_test.go
Paul Holzinger 8631032556 run modernize -fix ./...
Using golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize

+ some manual cleanup in libpod/lock/shm/shm_lock_test.go as it
  generated an unused variable
+ restored one removed comment

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-09-10 16:17:04 +02:00

45 lines
1.0 KiB
Go

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{}
registryOptions := &Options{
PodmanPath: "../../bin/podman",
}
// Start registries.
var errors *multierror.Error
for range 3 {
reg, err := StartWithOptions(registryOptions)
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())
}