mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Remove watch tooling
This commit is contained in:
parent
e719b723f7
commit
b38d7f25fe
@ -180,7 +180,6 @@ var _ = SIGDescribe("Deployment", func() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
// TODO add watch tooling
|
|
||||||
_, err := f.ClientSet.AppsV1().Deployments(testNamespaceName).Create(context.TODO(), &testDeployment, metav1.CreateOptions{})
|
_, err := f.ClientSet.AppsV1().Deployments(testNamespaceName).Create(context.TODO(), &testDeployment, metav1.CreateOptions{})
|
||||||
framework.ExpectNoError(err, "failed to create Deployment %v in namespace %v", testDeploymentName, testNamespaceName)
|
framework.ExpectNoError(err, "failed to create Deployment %v in namespace %v", testDeploymentName, testNamespaceName)
|
||||||
|
|
||||||
@ -189,21 +188,28 @@ var _ = SIGDescribe("Deployment", func() {
|
|||||||
dplmtWatch, err := f.ClientSet.AppsV1().Deployments(testNamespaceName).Watch(context.TODO(), metav1.ListOptions{LabelSelector: testDeploymentLabelsFlat, TimeoutSeconds: &dplmtWatchTimeoutSeconds})
|
dplmtWatch, err := f.ClientSet.AppsV1().Deployments(testNamespaceName).Watch(context.TODO(), metav1.ListOptions{LabelSelector: testDeploymentLabelsFlat, TimeoutSeconds: &dplmtWatchTimeoutSeconds})
|
||||||
framework.ExpectNoError(err, "Failed to setup watch on newly created Deployment")
|
framework.ExpectNoError(err, "Failed to setup watch on newly created Deployment")
|
||||||
|
|
||||||
|
foundEvent := false
|
||||||
dplmtWatchChan := dplmtWatch.ResultChan()
|
dplmtWatchChan := dplmtWatch.ResultChan()
|
||||||
for event := range dplmtWatchChan {
|
for event := range dplmtWatchChan {
|
||||||
if event.Type == watch.Added {
|
if event.Type == watch.Added {
|
||||||
|
foundEvent = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
framework.ExpectEqual(foundEvent, true, "failed to find watch event %v", watch.Added)
|
||||||
|
|
||||||
ginkgo.By("waiting for all Replicas to be Ready")
|
ginkgo.By("waiting for all Replicas to be Ready")
|
||||||
|
foundEvent = false
|
||||||
for event := range dplmtWatchChan {
|
for event := range dplmtWatchChan {
|
||||||
deployment, ok := event.Object.(*appsv1.Deployment)
|
deployment, ok := event.Object.(*appsv1.Deployment)
|
||||||
framework.ExpectEqual(ok, true, "unable to convert event.Object type")
|
framework.ExpectEqual(ok, true, "unable to convert event.Object type")
|
||||||
if deployment.Status.AvailableReplicas == testDeploymentDefaultReplicas &&
|
if deployment.Status.AvailableReplicas == testDeploymentDefaultReplicas &&
|
||||||
deployment.Status.ReadyReplicas == testDeploymentDefaultReplicas {
|
deployment.Status.ReadyReplicas == testDeploymentDefaultReplicas {
|
||||||
|
foundEvent = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
framework.ExpectEqual(foundEvent, true, "failed to see scale of replicas")
|
||||||
|
|
||||||
ginkgo.By("patching the Deployment")
|
ginkgo.By("patching the Deployment")
|
||||||
deploymentPatch, err := json.Marshal(map[string]interface{}{
|
deploymentPatch, err := json.Marshal(map[string]interface{}{
|
||||||
@ -227,20 +233,27 @@ var _ = SIGDescribe("Deployment", func() {
|
|||||||
_, err = f.ClientSet.AppsV1().Deployments(testNamespaceName).Patch(context.TODO(), testDeploymentName, types.StrategicMergePatchType, []byte(deploymentPatch), metav1.PatchOptions{})
|
_, err = f.ClientSet.AppsV1().Deployments(testNamespaceName).Patch(context.TODO(), testDeploymentName, types.StrategicMergePatchType, []byte(deploymentPatch), metav1.PatchOptions{})
|
||||||
framework.ExpectNoError(err, "failed to patch Deployment")
|
framework.ExpectNoError(err, "failed to patch Deployment")
|
||||||
|
|
||||||
|
foundEvent = false
|
||||||
for event := range dplmtWatchChan {
|
for event := range dplmtWatchChan {
|
||||||
if event.Type == watch.Modified {
|
if event.Type == watch.Modified {
|
||||||
|
foundEvent = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
framework.ExpectEqual(foundEvent, true, "failed to see scale of replicas")
|
||||||
|
|
||||||
ginkgo.By("waiting for Replicas to scale")
|
ginkgo.By("waiting for Replicas to scale")
|
||||||
|
foundEvent = false
|
||||||
for event := range dplmtWatchChan {
|
for event := range dplmtWatchChan {
|
||||||
deployment, ok := event.Object.(*appsv1.Deployment)
|
deployment, ok := event.Object.(*appsv1.Deployment)
|
||||||
framework.ExpectEqual(ok, true, "unable to convert event.Object type")
|
framework.ExpectEqual(ok, true, "unable to convert event.Object type")
|
||||||
if deployment.Status.AvailableReplicas == testDeploymentMinimumReplicas &&
|
if deployment.Status.AvailableReplicas == testDeploymentMinimumReplicas &&
|
||||||
deployment.Status.ReadyReplicas == testDeploymentMinimumReplicas {
|
deployment.Status.ReadyReplicas == testDeploymentMinimumReplicas {
|
||||||
|
foundEvent = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
framework.ExpectEqual(foundEvent, true, "failed to see scale of replicas")
|
||||||
|
|
||||||
ginkgo.By("listing Deployments")
|
ginkgo.By("listing Deployments")
|
||||||
deploymentsList, err := f.ClientSet.AppsV1().Deployments("").List(context.TODO(), metav1.ListOptions{LabelSelector: testDeploymentLabelsFlat})
|
deploymentsList, err := f.ClientSet.AppsV1().Deployments("").List(context.TODO(), metav1.ListOptions{LabelSelector: testDeploymentLabelsFlat})
|
||||||
@ -272,11 +285,14 @@ var _ = SIGDescribe("Deployment", func() {
|
|||||||
// currently this hasn't been able to hit the endpoint replaceAppsV1NamespacedDeploymentStatus
|
// currently this hasn't been able to hit the endpoint replaceAppsV1NamespacedDeploymentStatus
|
||||||
_, err = dc.Resource(deploymentResource).Namespace(testNamespaceName).Update(context.TODO(), &testDeploymentUpdateUnstructured, metav1.UpdateOptions{}) //, "status")
|
_, err = dc.Resource(deploymentResource).Namespace(testNamespaceName).Update(context.TODO(), &testDeploymentUpdateUnstructured, metav1.UpdateOptions{}) //, "status")
|
||||||
framework.ExpectNoError(err, "failed to update the DeploymentStatus")
|
framework.ExpectNoError(err, "failed to update the DeploymentStatus")
|
||||||
|
foundEvent = false
|
||||||
for event := range dplmtWatchChan {
|
for event := range dplmtWatchChan {
|
||||||
if event.Type == watch.Modified {
|
if event.Type == watch.Modified {
|
||||||
|
foundEvent = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
framework.ExpectEqual(foundEvent, true, "failed to find watch event %v", watch.Modified)
|
||||||
|
|
||||||
ginkgo.By("fetching the DeploymentStatus")
|
ginkgo.By("fetching the DeploymentStatus")
|
||||||
deploymentGetUnstructured, err := dc.Resource(deploymentResource).Namespace(testNamespaceName).Get(context.TODO(), testDeploymentName, metav1.GetOptions{}, "status")
|
deploymentGetUnstructured, err := dc.Resource(deploymentResource).Namespace(testNamespaceName).Get(context.TODO(), testDeploymentName, metav1.GetOptions{}, "status")
|
||||||
@ -286,18 +302,25 @@ var _ = SIGDescribe("Deployment", func() {
|
|||||||
framework.ExpectNoError(err, "failed to convert the unstructured response to a Deployment")
|
framework.ExpectNoError(err, "failed to convert the unstructured response to a Deployment")
|
||||||
framework.ExpectEqual(deploymentGet.Spec.Template.Spec.Containers[0].Image, testDeploymentUpdateImage, "failed to update image")
|
framework.ExpectEqual(deploymentGet.Spec.Template.Spec.Containers[0].Image, testDeploymentUpdateImage, "failed to update image")
|
||||||
framework.ExpectEqual(deploymentGet.ObjectMeta.Labels["test-deployment"], "updated", "failed to update labels")
|
framework.ExpectEqual(deploymentGet.ObjectMeta.Labels["test-deployment"], "updated", "failed to update labels")
|
||||||
|
foundEvent = false
|
||||||
for event := range dplmtWatchChan {
|
for event := range dplmtWatchChan {
|
||||||
if event.Type == watch.Modified {
|
if event.Type == watch.Modified {
|
||||||
|
foundEvent = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
framework.ExpectEqual(foundEvent, true, "failed to find watch event %v", watch.Modified)
|
||||||
|
|
||||||
|
foundEvent = false
|
||||||
for event := range dplmtWatchChan {
|
for event := range dplmtWatchChan {
|
||||||
deployment, ok := event.Object.(*appsv1.Deployment)
|
deployment, ok := event.Object.(*appsv1.Deployment)
|
||||||
framework.ExpectEqual(ok, true, "unable to convert event.Object type")
|
framework.ExpectEqual(ok, true, "unable to convert event.Object type")
|
||||||
if deployment.Status.ReadyReplicas == testDeploymentDefaultReplicas {
|
if deployment.Status.ReadyReplicas == testDeploymentDefaultReplicas {
|
||||||
|
foundEvent = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
framework.ExpectEqual(foundEvent, true, "failed to see scale of replicas")
|
||||||
|
|
||||||
ginkgo.By("patching the DeploymentStatus")
|
ginkgo.By("patching the DeploymentStatus")
|
||||||
deploymentStatusPatch, err := json.Marshal(map[string]interface{}{
|
deploymentStatusPatch, err := json.Marshal(map[string]interface{}{
|
||||||
@ -319,11 +342,14 @@ var _ = SIGDescribe("Deployment", func() {
|
|||||||
framework.ExpectNoError(err, "failed to convert the unstructured response to a Deployment")
|
framework.ExpectNoError(err, "failed to convert the unstructured response to a Deployment")
|
||||||
framework.ExpectEqual(deploymentGet.Spec.Template.Spec.Containers[0].Image, testDeploymentUpdateImage, "failed to update image")
|
framework.ExpectEqual(deploymentGet.Spec.Template.Spec.Containers[0].Image, testDeploymentUpdateImage, "failed to update image")
|
||||||
framework.ExpectEqual(deploymentGet.ObjectMeta.Labels["test-deployment"], "updated", "failed to update labels")
|
framework.ExpectEqual(deploymentGet.ObjectMeta.Labels["test-deployment"], "updated", "failed to update labels")
|
||||||
|
foundEvent = false
|
||||||
for event := range dplmtWatchChan {
|
for event := range dplmtWatchChan {
|
||||||
if event.Type == watch.Modified {
|
if event.Type == watch.Modified {
|
||||||
|
foundEvent = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
framework.ExpectEqual(foundEvent, true, "failed to find watch event %v", watch.Modified)
|
||||||
for event := range dplmtWatchChan {
|
for event := range dplmtWatchChan {
|
||||||
deployment, ok := event.Object.(*appsv1.Deployment)
|
deployment, ok := event.Object.(*appsv1.Deployment)
|
||||||
framework.ExpectEqual(ok, true, "unable to convert event.Object type")
|
framework.ExpectEqual(ok, true, "unable to convert event.Object type")
|
||||||
@ -335,13 +361,17 @@ var _ = SIGDescribe("Deployment", func() {
|
|||||||
ginkgo.By("deleting the Deployment")
|
ginkgo.By("deleting the Deployment")
|
||||||
err = f.ClientSet.AppsV1().Deployments(testNamespaceName).DeleteCollection(context.TODO(), metav1.DeleteOptions{}, metav1.ListOptions{LabelSelector: testDeploymentLabelsFlat})
|
err = f.ClientSet.AppsV1().Deployments(testNamespaceName).DeleteCollection(context.TODO(), metav1.DeleteOptions{}, metav1.ListOptions{LabelSelector: testDeploymentLabelsFlat})
|
||||||
framework.ExpectNoError(err, "failed to delete Deployment via collection")
|
framework.ExpectNoError(err, "failed to delete Deployment via collection")
|
||||||
|
|
||||||
|
foundEvent = false
|
||||||
for event := range dplmtWatchChan {
|
for event := range dplmtWatchChan {
|
||||||
deployment, ok := event.Object.(*appsv1.Deployment)
|
deployment, ok := event.Object.(*appsv1.Deployment)
|
||||||
framework.ExpectEqual(ok, true, "unable to convert event.Object type")
|
framework.ExpectEqual(ok, true, "unable to convert event.Object type")
|
||||||
if event.Type == watch.Deleted && deployment.ObjectMeta.Name == testDeploymentName {
|
if event.Type == watch.Deleted && deployment.ObjectMeta.Name == testDeploymentName {
|
||||||
|
foundEvent = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
framework.ExpectEqual(foundEvent, true, "failed to find watch event %v", watch.Deleted)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user