Revert testing back. Works locally, not in CI

Signed-off-by: Tom Runyon <tom@defenseunicorns.com>
pull/11623/head
Tom Runyon 3 years ago
parent ac95be4785
commit ea7891aea5
No known key found for this signature in database
GPG Key ID: D1CF51977E0E790F

@ -36,6 +36,7 @@ func (suite *HTTPRegistryClientTestSuite) SetupSuite() {
} }
func (suite *HTTPRegistryClientTestSuite) TearDownSuite() { func (suite *HTTPRegistryClientTestSuite) TearDownSuite() {
suite.Cancel()
os.RemoveAll(suite.WorkspaceDir) os.RemoveAll(suite.WorkspaceDir)
} }

@ -65,6 +65,9 @@ type TestSuite struct {
CompromisedRegistryHost string CompromisedRegistryHost string
WorkspaceDir string WorkspaceDir string
RegistryClient *Client RegistryClient *Client
Context context.Context
Cancel func()
} }
// setup creates a oci registry for use in testing and sets the internal // setup creates a oci registry for use in testing and sets the internal
@ -132,6 +135,7 @@ func setup(suite *TestSuite, tlsEnabled bool, insecure bool) *registry.Registry
// That function does not handle matching of ip addresses in octal, // That function does not handle matching of ip addresses in octal,
// decimal or hex form. // decimal or hex form.
suite.DockerRegistryHost = fmt.Sprintf("0x7f000001:%d", port) suite.DockerRegistryHost = fmt.Sprintf("0x7f000001:%d", port)
} else { } else {
suite.DockerRegistryHost = fmt.Sprintf("localhost:%d", port) suite.DockerRegistryHost = fmt.Sprintf("localhost:%d", port)
} }
@ -155,7 +159,8 @@ func setup(suite *TestSuite, tlsEnabled bool, insecure bool) *registry.Registry
config.HTTP.TLS.Key = tlsServerKey config.HTTP.TLS.Key = tlsServerKey
config.HTTP.TLS.ClientCAs = []string{tlsCA} config.HTTP.TLS.ClientCAs = []string{tlsCA}
} }
dockerRegistry, err := registry.NewRegistry(context.Background(), config) suite.Context, suite.Cancel = context.WithCancel(context.Background())
dockerRegistry, err := registry.NewRegistry(suite.Context, config)
suite.Nil(err, "no error creating test registry") suite.Nil(err, "no error creating test registry")
suite.CompromisedRegistryHost = initCompromisedRegistryTestServer() suite.CompromisedRegistryHost = initCompromisedRegistryTestServer()

Loading…
Cancel
Save