mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-07 18:11:31 +00:00
add noop persister to plugin loader
Kubernetes-commit: 2dd86fe8c2cc7b655085b773bd1a06bc2ab54bbd
This commit is contained in:
committed by
Kubernetes Publisher
parent
f80da32721
commit
b804f9f657
@@ -171,6 +171,28 @@ func TestAuthPluginPersist(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
func Test_WhenNilPersister_NoOpPersisterIsAssigned(t *testing.T) {
|
||||
|
||||
if err := RegisterAuthProviderPlugin("anyPlugin", pluginPersistProvider); err != nil {
|
||||
t.Errorf("unexpected error: failed to register 'anyPlugin': %v", err)
|
||||
}
|
||||
cfg := &clientcmdapi.AuthProviderConfig{
|
||||
Name: "anyPlugin",
|
||||
Config: nil,
|
||||
}
|
||||
plugin, err := GetAuthProvider("127.0.0.1", cfg, nil)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: failed to get 'anyPlugin': %v", err)
|
||||
}
|
||||
|
||||
anyPlugin := plugin.(*pluginPersist)
|
||||
|
||||
if _, ok := anyPlugin.persister.(*noopPersister); !ok {
|
||||
t.Errorf("expected to be No Operation persister")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// emptyTransport provides an empty http.Response with an initialized header
|
||||
// to allow wrapping RoundTrippers to set header values.
|
||||
type emptyTransport struct{}
|
||||
|
Reference in New Issue
Block a user