MCPcopy Create free account
hub / github.com/flant/shell-operator / existObject

Function existObject

pkg/kube/object_patch/patch_test.go:940–949  ·  view source on GitHub ↗
(t *testing.T, cluster *fake.Cluster, ns string, objYAML string)

Source from the content-addressed store, hash-verified

938}
939
940func existObject(t *testing.T, cluster *fake.Cluster, ns string, objYAML string) bool {
941 mft := manifest.MustFromYAML(objYAML)
942 gvk := cluster.MustFindGVR(mft.ApiVersion(), mft.Kind())
943 obj, err := cluster.Client.Dynamic().Resource(*gvk).Namespace(ns).Get(context.TODO(), mft.Name(), metav1.GetOptions{})
944 if errors.IsNotFound(err) {
945 return false
946 }
947 require.NoError(t, err)
948 return obj != nil
949}

Callers 2

Test_CreateOperationsFunction · 0.85
Test_DeleteOperationsFunction · 0.85

Calls 3

DynamicMethod · 0.80
GetMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected