Code change:
[X] Test PR: kuberenetes/kubernetes [x] Two weeks soak end date: 1 July 2021 [x] Test promotion PR: kubernetes/kubernetes According to this APIsnoop query, there are still some remaining StatefulSet endpoints which are untested. Create a watch to track deployment events. Create a deployment with a static label. Confirm that the pods are running. Get the deployment status. Parse the response and confirm that the deployment status conditions can be listed. Update the deployment status. Confirm via the watch that the status has been updated. Patch the deployment status. Confirm via the watch that the status has been patched. Using an existing as a template for a new for deployment lifecycle test. This query shows the endpoints hit within a short period of running the e2e test If a test with these calls gets merged, test coverage will go up by 1 point This test is also created with the goal of conformance promotion. /sig apps /sig testing /sig architecture /area conformance
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the label and provide further guidance. The label can be by org members by writing in a comment. <detailsInstructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
/reopen
Reopened this issue. <detailsIn response to : /reopen Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details

Related discussion:
text: }) framework.ExpectNoError(err, "failed to see %v event", watch.Deleted) }) <ins> ginkgo.It("should validate Deployment Status endpoints", func() { dClient := c.AppsV1().Deployments(ns) dName := "test-deployment-" + utilrand.String(5) labelSelector := "e2e=testing" w := &cache.ListWatch{ WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { options.LabelSelector = labelSelector return dClient.Watch(context.TODO(), options) }, } dList, err := c.AppsV1().Deployments("").List(context.TODO(), metav1.ListOptions{LabelSelector: labelSelector}) framework.ExpectNoError(err, "failed to list Deployments") ginkgo.By("creating a Deployment") podLabels := map[string]string{"name": WebserverImageName, "e2e": "testing"} replicas := int32(1) framework.Logf("Creating simple deployment %s", dName) d := e2edeployment.NewDeployment(dName, replicas, podLabels, WebserverImageName, WebserverImage, appsv1.RollingUpdateDeploymentStrategyType) deploy, err := c.AppsV1().Deployments(ns).Create(context.TODO(), d, metav1.CreateOptions{}) framework.ExpectNoError(err) // Wait for it to be updated to revision 1 err = e2edeployment.WaitForDeploymentRevisionAndImage(c, ns, dName, "1", WebserverImage) framework.ExpectNoError(err) err = e2edeployment.WaitForDeploymentComplete(c, deploy) framework.ExpectNoError(err) testDeployment, err := dClient.Get(context.TODO(), dName, metav1.GetOptions{}) framework.ExpectNoError(err) ginkgo.By("Getting /status") dResource := schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "deployments"} dStatusUnstructured, err := f.DynamicClient.Resource(dResource).Namespace(ns).Get(context.TODO(), dName, metav1.GetOptions{}, "status") framework.ExpectNoError(err, "Failed to fetch the status of deployment %s in namespace %s", dName, ns) dStatusBytes, err := json.Marshal(dStatusUnstructured) framework.ExpectNoError(err, "Failed to marshal unstructured response. %v", err) var dStatus appsv1.Deployment err = json.Unmarshal(dStatusBytes, &dStatus) framework.ExpectNoError(err, "Failed to unmarshal JSON bytes to a deployment object type") framework.Logf("Deployment %s has Conditions: %v", dName, dStatus.Status.Conditions) ginkgo.By("updating Deployment Status") var statusToUpdate, updatedStatus *appsv1.Deployment err = retry.RetryOnConflict(retry.DefaultRetry, func() error { statusToUpdate, err = dClient.Get(context.TODO(), dName, metav1.GetOptions{}) framework.ExpectNoError(err, "Unable to retrieve deployment %s", dName) statusToUpdate.Status.Conditions = append(statusToUpdate.Status.Conditions, appsv1.DeploymentCondition{ Type:    "StatusUpdate", Status:  "True", Reason:  "E2E", Message: "Set from e2e test", }) updatedStatus, err = dClient.UpdateStatus(context.TODO(), statusToUpdate, metav1.UpdateOptions{}) return err }) framework.ExpectNoError(err, "Failed to update status. %v", err) framework.Logf("updatedStatus.Conditions: %#v", updatedStatus.Status.Conditions) ginkgo.By("watching for the Deployment status to be updated") ctx, cancel := context.WithTimeout(context.Background(), dRetryTimeout) defer cancel() _, err = watchtools.Until(ctx, dList.ResourceVersion, w, func(event watch.Event) (bool, error) { if d, ok := event.Object.(*appsv1.Deployment); ok { found := d.ObjectMeta.Name == testDeployment.ObjectMeta.Name && d.ObjectMeta.Namespace == testDeployment.ObjectMeta.Namespace && d.Labels["e2e"] == "testing" if !found { framework.Logf("Observed Deployment %v in namespace %v with annotations: %v & Conditions: %vn", d.ObjectMeta.Name, d.ObjectMeta.Namespace, d.Annotations, d.Status.Conditions) return false, nil } for _, cond := range d.Status.Conditions { if cond.Type == "StatusUpdate" && cond.Reason == "E2E" && cond.Message == "Set from e2e test" { framework.Logf("Found Deployment %v in namespace %v with labels: %v annotations: %v & Conditions: %v", d.ObjectMeta.Name, d.ObjectMeta.Namespace, d.ObjectMeta.Labels, d.Annotations, cond) return found, nil } framework.Logf("Observed Deployment %v in namespace %v with annotations: %v & Conditions: %v", d.ObjectMeta.Name, d.ObjectMeta.Namespace, d.Annotations, cond) } } object := strings.Split(fmt.Sprintf("%v", event.Object), "{")[0] framework.Logf("Observed %v event: %+v", object, event.Type) return false, nil }) framework.ExpectNoError(err, "failed to locate Deployment %v in namespace %v", testDeployment.ObjectMeta.Name, ns) framework.Logf("Deployment %s has an updated status", dName) ginkgo.By("patching the Statefulset Status") payload := []byte(`{"status":{"conditions":[{"type":"StatusPatched","status":"True"}]}}`) framework.Logf("Patch payload: %v", string(payload)) patchedDeployment, err := dClient.Patch(context.TODO(), dName, types.MergePatchType, payload, metav1.PatchOptions{}, "status") framework.ExpectNoError(err, "Failed to patch status. %v", err) framework.Logf("Patched status conditions: %#v", patchedDeployment.Status.Conditions) ginkgo.By("watching for the Deployment status to be patched") ctx, cancel = context.WithTimeout(context.Background(), dRetryTimeout) defer cancel() _, err = watchtools.Until(ctx, dList.ResourceVersion, w, func(event watch.Event) (bool, error) { if e, ok := event.Object.(*appsv1.Deployment); ok { found := e.ObjectMeta.Name == testDeployment.ObjectMeta.Name && e.ObjectMeta.Namespace == testDeployment.ObjectMeta.Namespace && e.ObjectMeta.Labels["e2e"] == testDeployment.ObjectMeta.Labels["e2e"] if !found { framework.Logf("Observed deployment %v in namespace %v with annotations: %v & Conditions: %v", testDeployment.ObjectMeta.Name, testDeployment.ObjectMeta.Namespace, testDeployment.Annotations, testDeployment.Status.Conditions) return false, nil } for _, cond := range e.Status.Conditions { if cond.Type == "StatusPatched" { framework.Logf("Found deployment %v in namespace %v with labels: %v annotations: %v & Conditions: %v", testDeployment.ObjectMeta.Name, testDeployment.ObjectMeta.Namespace, testDeployment.ObjectMeta.Labels, testDeployment.Annotations, cond) return found, nil } framework.Logf("Observed deployment %v in namespace %v with annotations: %v & Conditions: %v", testDeployment.ObjectMeta.Name, testDeployment.ObjectMeta.Namespace, testDeployment.Annotations, cond) } } object := strings.Split(fmt.Sprintf("%v", event.Object), "{")[0] framework.Logf("Observed %v event: %+v", object, event.Type) return false, nil }) framework.ExpectNoError(err, "failed to locate deployment %v in namespace %v", testDeployment.ObjectMeta.Name, ns) framework.Logf("Deployment %s has a patched status", dName) }) </ins> }) func failureTrap(c clientset.Interface, ns string) {