diff --git a/provider/kubernetes/builder_configuration_test.go b/provider/kubernetes/builder_configuration_test.go index 4e53e9a1f..81ec0f08a 100644 --- a/provider/kubernetes/builder_configuration_test.go +++ b/provider/kubernetes/builder_configuration_test.go @@ -180,11 +180,22 @@ func frontend(backend string, opts ...func(*types.Frontend)) func(*types.Fronten for _, opt := range opts { opt(f) } + // related the function frontendName + name := f.Backend f.Backend = backend + if len(name) > 0 { + return name + } return backend } } +func frontendName(name string) func(*types.Frontend) { + return func(f *types.Frontend) { + // store temporary the frontend name into the backend name + f.Backend = name + } +} func passHostHeader() func(*types.Frontend) { return func(f *types.Frontend) { f.PassHostHeader = true diff --git a/testhelpers/config.go b/testhelpers/config.go index 2217787dd..1abe0cf77 100644 --- a/testhelpers/config.go +++ b/testhelpers/config.go @@ -91,11 +91,25 @@ func WithFrontend(backend string, opts ...func(*types.Frontend)) func(*types.Fro for _, opt := range opts { opt(f) } + + // related the function WithFrontendName + name := f.Backend f.Backend = backend + if len(name) > 0 { + return name + } return backend } } +// WithFrontendName is a helper to create a configuration +func WithFrontendName(name string) func(*types.Frontend) { + return func(f *types.Frontend) { + // store temporary the frontend name into the backend name + f.Backend = name + } +} + // WithEntryPoints is a helper to create a configuration func WithEntryPoints(eps ...string) func(*types.Frontend) { return func(f *types.Frontend) {