Add dynamic client resource watch function

This commit is contained in:
Caleb Woodbine 2020-05-21 10:00:17 +12:00
parent a3248a7ba8
commit 82d76e2d6d

View File

@ -1286,6 +1286,14 @@ func taintExists(taints []v1.Taint, taintToFind *v1.Taint) bool {
return false
}
func getDynamicResourceWatch(testContext context.Context, dc dynamic.Interface, resourceType schema.GroupVersionResource, namespace string, resourceName string, listOptions metav1.ListOptions) func() (watch.Interface, error) {
return func() (watch.Interface, error) {
res, err := dc.Resource(resourceType).Namespace(namespace).Watch(context.TODO(), listOptions)
ExpectNoError(err, "Failed to create a watch for %v", resourceType.Resource)
return res, err
}
}
// WatchEventEnsurerAndManager
// manages a watch for a given resource, ensures that events take place in a given order, retries the test on failure
// testContext cancelation signal across API boundries, e.g: context.TODO()