Rename metadata.NewConfigOrDie to be consistent

Updated name to match dynamic client
This commit is contained in:
Clayton Coleman 2019-07-10 18:35:45 -04:00
parent 637cc83341
commit 98d87a4f03
No known key found for this signature in database
GPG Key ID: 3D16906B4F1C5CB3
3 changed files with 8 additions and 8 deletions

View File

@ -70,9 +70,9 @@ func ConfigFor(inConfig *rest.Config) *rest.Config {
return config
}
// NewConfigOrDie creates a new metadata client for the given config and
// NewForConfigOrDie creates a new metadata client for the given config and
// panics if there is an error in the config.
func NewConfigOrDie(c *rest.Config) Interface {
func NewForConfigOrDie(c *rest.Config) Interface {
ret, err := NewForConfig(c)
if err != nil {
panic(err)

View File

@ -236,7 +236,7 @@ func TestClient(t *testing.T) {
defer s.Close()
cfg := ConfigFor(&rest.Config{Host: s.URL})
client := NewConfigOrDie(cfg).(*Client)
client := NewForConfigOrDie(cfg).(*Client)
tt.want(t, client)
})
}

View File

@ -545,7 +545,7 @@ func TestMetadataClient(t *testing.T) {
return wrapper
})
client := metadata.NewConfigOrDie(cfg).Resource(v1.SchemeGroupVersion.WithResource("services"))
client := metadata.NewForConfigOrDie(cfg).Resource(v1.SchemeGroupVersion.WithResource("services"))
items, err := client.Namespace(ns).List(metav1.ListOptions{})
if err != nil {
t.Fatal(err)
@ -622,7 +622,7 @@ func TestMetadataClient(t *testing.T) {
return wrapper
})
client := metadata.NewConfigOrDie(cfg).Resource(crdGVR)
client := metadata.NewForConfigOrDie(cfg).Resource(crdGVR)
items, err := client.Namespace(ns).List(metav1.ListOptions{})
if err != nil {
t.Fatal(err)
@ -688,7 +688,7 @@ func TestMetadataClient(t *testing.T) {
return wrapper
})
client := metadata.NewConfigOrDie(cfg).Resource(v1.SchemeGroupVersion.WithResource("services"))
client := metadata.NewForConfigOrDie(cfg).Resource(v1.SchemeGroupVersion.WithResource("services"))
w, err := client.Namespace(ns).Watch(metav1.ListOptions{ResourceVersion: svc.ResourceVersion, Watch: true})
if err != nil {
t.Fatal(err)
@ -744,7 +744,7 @@ func TestMetadataClient(t *testing.T) {
}
cfg := metadata.ConfigFor(config)
client := metadata.NewConfigOrDie(cfg).Resource(crdGVR)
client := metadata.NewForConfigOrDie(cfg).Resource(crdGVR)
patched, err := client.Namespace(ns).Patch("test-2", types.MergePatchType, []byte(`{"metadata":{"annotations":{"test":"1"}}}`), metav1.PatchOptions{})
if err != nil {
@ -759,7 +759,7 @@ func TestMetadataClient(t *testing.T) {
wrapper.nested = rt
return wrapper
})
client = metadata.NewConfigOrDie(cfg).Resource(crdGVR)
client = metadata.NewForConfigOrDie(cfg).Resource(crdGVR)
w, err := client.Namespace(ns).Watch(metav1.ListOptions{ResourceVersion: cr.GetResourceVersion(), Watch: true})
if err != nil {