From ea7891aea5b7db4e8a13d9306ac7d22edb4f77ae Mon Sep 17 00:00:00 2001 From: Tom Runyon Date: Thu, 15 Dec 2022 07:14:04 -0500 Subject: [PATCH] Revert testing back. Works locally, not in CI Signed-off-by: Tom Runyon --- pkg/registry/client_http_test.go | 1 + pkg/registry/utils_test.go | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/registry/client_http_test.go b/pkg/registry/client_http_test.go index 94b1b73b3..96ee8d882 100644 --- a/pkg/registry/client_http_test.go +++ b/pkg/registry/client_http_test.go @@ -36,6 +36,7 @@ func (suite *HTTPRegistryClientTestSuite) SetupSuite() { } func (suite *HTTPRegistryClientTestSuite) TearDownSuite() { + suite.Cancel() os.RemoveAll(suite.WorkspaceDir) } diff --git a/pkg/registry/utils_test.go b/pkg/registry/utils_test.go index 49b028a38..bf45a5b4a 100644 --- a/pkg/registry/utils_test.go +++ b/pkg/registry/utils_test.go @@ -65,6 +65,9 @@ type TestSuite struct { CompromisedRegistryHost string WorkspaceDir string RegistryClient *Client + + Context context.Context + Cancel func() } // 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, // decimal or hex form. suite.DockerRegistryHost = fmt.Sprintf("0x7f000001:%d", port) + } else { 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.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.CompromisedRegistryHost = initCompromisedRegistryTestServer()