Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow repotest OCI server to bind to localhost #12978

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/repo/repotest/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ func WithDependingChart(c *chart.Chart) OCIServerOpt {
}

func NewOCIServer(t *testing.T, dir string) (*OCIServer, error) {
return NewOCIServerWithBindAddress(t, dir, "")
}

func NewOCIServerWithBindAddress(t *testing.T, dir string, bindAddress string) (*OCIServer, error) {
testHtpasswdFileBasename := "authtest.htpasswd"
testUsername, testPassword := "username", "password"

Expand All @@ -113,7 +117,7 @@ func NewOCIServer(t *testing.T, dir string) (*OCIServer, error) {
t.Fatalf("error finding free port for test registry")
}

config.HTTP.Addr = fmt.Sprintf(":%d", port)
config.HTTP.Addr = fmt.Sprintf("%s:%d", bindAddress, port)
config.HTTP.DrainTimeout = time.Duration(10) * time.Second
config.Storage = map[string]configuration.Parameters{"inmemory": map[string]interface{}{}}
config.Auth = configuration.Auth{
Expand Down