Documentation
¶
Index ¶
- func ChangeGlobalConfig(ctx context.Context, t *testing.T, runcnx *params.Run, configMapName string, ...) func()
- func ProviderHost(t *testing.T, providerURL string) string
- func ResetTrustedProviderHostnames(ctx context.Context, t *testing.T, runcnx *params.Run, configMapName string) func()
- func TrustProviderHostname(ctx context.Context, t *testing.T, runcnx *params.Run, ...) func()
- func TrustedProviderHostnames(ctx context.Context, t *testing.T, runcnx *params.Run, configMapName string) (allowlist, autoTrusted []string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChangeGlobalConfig ¶
func ChangeGlobalConfig(ctx context.Context, t *testing.T, runcnx *params.Run, configMapName string, data map[string]string) func()
ChangeGlobalConfig patches keys into the controller ConfigMap and returns a function restoring the previous values.
func ProviderHost ¶ added in v0.51.0
ProviderHost extracts the hostname of a provider URL the way the controller stores it in the allowlist, so that a test comparing what the controller wrote against the instance it talks to compares equal spellings.
func ResetTrustedProviderHostnames ¶ added in v0.51.0
func ResetTrustedProviderHostnames(ctx context.Context, t *testing.T, runcnx *params.Run, configMapName string) func()
ResetTrustedProviderHostnames hands the policy back to the controller and forgets what it learned, which is the state a fresh install starts from. It returns a function putting both values back as they were.
A test that wants to watch the controller learn a hostname has to start from here: a configured list is authoritative, while an existing learned entry would make the controller skip the write.
func TrustProviderHostname ¶ added in v0.51.0
func TrustProviderHostname(ctx context.Context, t *testing.T, runcnx *params.Run, configMapName, providerURL string) func()
TrustProviderHostname adds the hostname of the provider under test to the controller allowlist, so that an incoming webhook, which carries no provider signature and therefore cannot be trusted on first use, reaches it. It returns a function removing that hostname again.
Only the hostname it added is removed on restore; writing the whole key back would otherwise delete another administrator entry added during the test.
func TrustedProviderHostnames ¶ added in v0.51.0
func TrustedProviderHostnames(ctx context.Context, t *testing.T, runcnx *params.Run, configMapName string) (allowlist, autoTrusted []string)
TrustedProviderHostnames returns the administrator allowlist together with the hostnames the controller recorded itself.
Types ¶
This section is empty.