log more err info when wait resource exist on member clusters
Signed-off-by: changzhen <changzhen5@huawei.com>
This commit is contained in:
parent
4d5428e798
commit
f95e14769a
|
@ -65,10 +65,18 @@ func WaitDeploymentDisappearOnCluster(cluster, namespace, name string) {
|
||||||
clusterClient := GetClusterClient(cluster)
|
clusterClient := GetClusterClient(cluster)
|
||||||
gomega.Expect(clusterClient).ShouldNot(gomega.BeNil())
|
gomega.Expect(clusterClient).ShouldNot(gomega.BeNil())
|
||||||
|
|
||||||
klog.Infof("Waiting for deployment disappear on cluster(%s)", cluster)
|
klog.Infof("Waiting for deployment(%s/%s) disappear on cluster(%s)", namespace, name, cluster)
|
||||||
gomega.Eventually(func() bool {
|
gomega.Eventually(func() bool {
|
||||||
_, err := clusterClient.AppsV1().Deployments(namespace).Get(context.TODO(), name, metav1.GetOptions{})
|
_, err := clusterClient.AppsV1().Deployments(namespace).Get(context.TODO(), name, metav1.GetOptions{})
|
||||||
return apierrors.IsNotFound(err)
|
if err == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if apierrors.IsNotFound(err) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
klog.Errorf("Failed to get deployment(%s/%s) on cluster(%s), err: %v", namespace, name, cluster, err)
|
||||||
|
return false
|
||||||
}, pollTimeout, pollInterval).Should(gomega.Equal(true))
|
}, pollTimeout, pollInterval).Should(gomega.Equal(true))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,10 +68,18 @@ func WaitJobDisappearOnCluster(cluster, namespace, name string) {
|
||||||
clusterClient := GetClusterClient(cluster)
|
clusterClient := GetClusterClient(cluster)
|
||||||
gomega.Expect(clusterClient).ShouldNot(gomega.BeNil())
|
gomega.Expect(clusterClient).ShouldNot(gomega.BeNil())
|
||||||
|
|
||||||
klog.Infof("Waiting for job disappear on cluster(%s)", cluster)
|
klog.Infof("Waiting for job(%s/%s) disappear on cluster(%s)", namespace, name, cluster)
|
||||||
gomega.Eventually(func() bool {
|
gomega.Eventually(func() bool {
|
||||||
_, err := clusterClient.BatchV1().Jobs(namespace).Get(context.TODO(), name, metav1.GetOptions{})
|
_, err := clusterClient.BatchV1().Jobs(namespace).Get(context.TODO(), name, metav1.GetOptions{})
|
||||||
return apierrors.IsNotFound(err)
|
if err == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if apierrors.IsNotFound(err) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
klog.Errorf("Failed to get job(%s/%s) on cluster(%s), err: %v", namespace, name, cluster, err)
|
||||||
|
return false
|
||||||
}, pollTimeout, pollInterval).Should(gomega.Equal(true))
|
}, pollTimeout, pollInterval).Should(gomega.Equal(true))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,10 +66,18 @@ func WaitNamespaceDisappearOnCluster(cluster, name string) {
|
||||||
clusterClient := GetClusterClient(cluster)
|
clusterClient := GetClusterClient(cluster)
|
||||||
gomega.Expect(clusterClient).ShouldNot(gomega.BeNil())
|
gomega.Expect(clusterClient).ShouldNot(gomega.BeNil())
|
||||||
|
|
||||||
klog.Infof("Waiting for namespace disappear on cluster(%s)", cluster)
|
klog.Infof("Waiting for namespace(%s) disappear on cluster(%s)", name, cluster)
|
||||||
gomega.Eventually(func() bool {
|
gomega.Eventually(func() bool {
|
||||||
_, err := clusterClient.CoreV1().Namespaces().Get(context.TODO(), name, metav1.GetOptions{})
|
_, err := clusterClient.CoreV1().Namespaces().Get(context.TODO(), name, metav1.GetOptions{})
|
||||||
return apierrors.IsNotFound(err)
|
if err == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if apierrors.IsNotFound(err) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
klog.Errorf("Failed to get namespace(%s) on cluster(%s), err: %v", name, cluster, err)
|
||||||
|
return false
|
||||||
}, pollTimeout, pollInterval).Should(gomega.Equal(true))
|
}, pollTimeout, pollInterval).Should(gomega.Equal(true))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,10 +60,18 @@ func WaitPodDisappearOnCluster(cluster, namespace, name string) {
|
||||||
clusterClient := GetClusterClient(cluster)
|
clusterClient := GetClusterClient(cluster)
|
||||||
gomega.Expect(clusterClient).ShouldNot(gomega.BeNil())
|
gomega.Expect(clusterClient).ShouldNot(gomega.BeNil())
|
||||||
|
|
||||||
klog.Infof("Waiting for pod disappear on cluster(%s)", cluster)
|
klog.Infof("Waiting for pod(%s/%s) disappear on cluster(%s)", namespace, name, cluster)
|
||||||
gomega.Eventually(func() bool {
|
gomega.Eventually(func() bool {
|
||||||
_, err := clusterClient.CoreV1().Pods(namespace).Get(context.TODO(), name, metav1.GetOptions{})
|
_, err := clusterClient.CoreV1().Pods(namespace).Get(context.TODO(), name, metav1.GetOptions{})
|
||||||
return apierrors.IsNotFound(err)
|
if err == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if apierrors.IsNotFound(err) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
klog.Errorf("Failed to get pod(%s/%s) on cluster(%s), err: %v", namespace, name, cluster, err)
|
||||||
|
return false
|
||||||
}, pollTimeout, pollInterval).Should(gomega.Equal(true))
|
}, pollTimeout, pollInterval).Should(gomega.Equal(true))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,14 @@ func WaitResourceQuotaDisappearOnCluster(cluster, namespace, name string) {
|
||||||
klog.Infof("Waiting for resourceQuota(%s/%s) disappear on cluster(%s)", namespace, name, cluster)
|
klog.Infof("Waiting for resourceQuota(%s/%s) disappear on cluster(%s)", namespace, name, cluster)
|
||||||
gomega.Eventually(func() bool {
|
gomega.Eventually(func() bool {
|
||||||
_, err := clusterClient.CoreV1().ResourceQuotas(namespace).Get(context.TODO(), name, metav1.GetOptions{})
|
_, err := clusterClient.CoreV1().ResourceQuotas(namespace).Get(context.TODO(), name, metav1.GetOptions{})
|
||||||
return apierrors.IsNotFound(err)
|
if err == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if apierrors.IsNotFound(err) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
klog.Errorf("Failed to get resourceQuota(%s/%s) on cluster(%s), err: %v", namespace, name, cluster, err)
|
||||||
|
return false
|
||||||
}, pollTimeout, pollInterval).Should(gomega.Equal(true))
|
}, pollTimeout, pollInterval).Should(gomega.Equal(true))
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,10 +58,18 @@ func WaitSecretDisappearOnCluster(cluster, namespace, name string) {
|
||||||
clusterClient := GetClusterClient(cluster)
|
clusterClient := GetClusterClient(cluster)
|
||||||
gomega.Expect(clusterClient).ShouldNot(gomega.BeNil())
|
gomega.Expect(clusterClient).ShouldNot(gomega.BeNil())
|
||||||
|
|
||||||
klog.Infof("Waiting for secret disappear on cluster(%s)", cluster)
|
klog.Infof("Waiting for secret(%s/%s) disappear on cluster(%s)", namespace, name, cluster)
|
||||||
gomega.Eventually(func() bool {
|
gomega.Eventually(func() bool {
|
||||||
_, err := clusterClient.CoreV1().Secrets(namespace).Get(context.TODO(), name, metav1.GetOptions{})
|
_, err := clusterClient.CoreV1().Secrets(namespace).Get(context.TODO(), name, metav1.GetOptions{})
|
||||||
return apierrors.IsNotFound(err)
|
if err == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if apierrors.IsNotFound(err) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
klog.Errorf("Failed to get secret(%s/%s) on cluster(%s), err: %v", namespace, name, cluster, err)
|
||||||
|
return false
|
||||||
}, pollTimeout, pollInterval).Should(gomega.Equal(true))
|
}, pollTimeout, pollInterval).Should(gomega.Equal(true))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,10 +60,18 @@ func WaitServiceDisappearOnCluster(cluster, namespace, name string) {
|
||||||
clusterClient := GetClusterClient(cluster)
|
clusterClient := GetClusterClient(cluster)
|
||||||
gomega.Expect(clusterClient).ShouldNot(gomega.BeNil())
|
gomega.Expect(clusterClient).ShouldNot(gomega.BeNil())
|
||||||
|
|
||||||
klog.Infof("Waiting for service disappear on cluster(%s)", cluster)
|
klog.Infof("Waiting for service(%s/%s) disappear on cluster(%s)", namespace, name, cluster)
|
||||||
gomega.Eventually(func() bool {
|
gomega.Eventually(func() bool {
|
||||||
_, err := clusterClient.CoreV1().Services(namespace).Get(context.TODO(), name, metav1.GetOptions{})
|
_, err := clusterClient.CoreV1().Services(namespace).Get(context.TODO(), name, metav1.GetOptions{})
|
||||||
return apierrors.IsNotFound(err)
|
if err == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if apierrors.IsNotFound(err) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
klog.Errorf("Failed to get service(%s/%s) on cluster(%s), err: %v", namespace, name, cluster, err)
|
||||||
|
return false
|
||||||
}, pollTimeout, pollInterval).Should(gomega.Equal(true))
|
}, pollTimeout, pollInterval).Should(gomega.Equal(true))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,10 +98,18 @@ func WaitWorkloadDisappearOnCluster(cluster, namespace, name string) {
|
||||||
clusterClient := GetClusterDynamicClient(cluster)
|
clusterClient := GetClusterDynamicClient(cluster)
|
||||||
gomega.Expect(clusterClient).ShouldNot(gomega.BeNil())
|
gomega.Expect(clusterClient).ShouldNot(gomega.BeNil())
|
||||||
|
|
||||||
klog.Infof("Waiting for workload disappear on cluster(%s)", cluster)
|
klog.Infof("Waiting for workload(%s/%s) disappear on cluster(%s)", namespace, name, cluster)
|
||||||
gomega.Eventually(func() bool {
|
gomega.Eventually(func() bool {
|
||||||
_, err := clusterClient.Resource(workloadGVR).Namespace(namespace).Get(context.TODO(), name, metav1.GetOptions{})
|
_, err := clusterClient.Resource(workloadGVR).Namespace(namespace).Get(context.TODO(), name, metav1.GetOptions{})
|
||||||
return apierrors.IsNotFound(err)
|
if err == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if apierrors.IsNotFound(err) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
klog.Errorf("Failed to get workload(%s/%s) on cluster(%s), err: %v", namespace, name, cluster, err)
|
||||||
|
return false
|
||||||
}, pollTimeout, pollInterval).Should(gomega.Equal(true))
|
}, pollTimeout, pollInterval).Should(gomega.Equal(true))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ var _ = ginkgo.Describe("[resource-status collection] resource status collection
|
||||||
|
|
||||||
ginkgo.BeforeEach(func() {
|
ginkgo.BeforeEach(func() {
|
||||||
policyNamespace = testNamespace
|
policyNamespace = testNamespace
|
||||||
policyName = deploymentNamePrefix + rand.String(RandomStrLength)
|
policyName = serviceNamePrefix + rand.String(RandomStrLength)
|
||||||
serviceNamespace = testNamespace
|
serviceNamespace = testNamespace
|
||||||
serviceName = policyName
|
serviceName = policyName
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue