From 03974c1ea4db71fc69de9dc93d4fd4f96cf22c1b Mon Sep 17 00:00:00 2001 From: YuikoTakada Date: Wed, 22 Jan 2020 07:00:10 +0000 Subject: [PATCH] Fix static check failures in test/integration/deployment --- hack/.staticcheck_failures | 1 - test/integration/deployment/BUILD | 1 - test/integration/deployment/util.go | 58 +---------------------------- 3 files changed, 1 insertion(+), 59 deletions(-) diff --git a/hack/.staticcheck_failures b/hack/.staticcheck_failures index 19fa84dc7c6..dd2c21f1bf3 100644 --- a/hack/.staticcheck_failures +++ b/hack/.staticcheck_failures @@ -37,7 +37,6 @@ pkg/volume/util/subpath pkg/volume/vsphere_volume test/e2e/apps test/e2e/autoscaling -test/integration/deployment test/integration/examples test/integration/framework test/integration/garbagecollector diff --git a/test/integration/deployment/BUILD b/test/integration/deployment/BUILD index 9cea5466b06..404fe0a79d8 100644 --- a/test/integration/deployment/BUILD +++ b/test/integration/deployment/BUILD @@ -40,7 +40,6 @@ go_library( "//pkg/controller/replicaset:go_default_library", "//staging/src/k8s.io/api/apps/v1:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/extensions/v1beta1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/intstr:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library", diff --git a/test/integration/deployment/util.go b/test/integration/deployment/util.go index dc2b3a13f1c..a6485146c99 100644 --- a/test/integration/deployment/util.go +++ b/test/integration/deployment/util.go @@ -25,7 +25,6 @@ import ( apps "k8s.io/api/apps/v1" "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/wait" @@ -101,47 +100,6 @@ func newDeployment(name, ns string, replicas int32) *apps.Deployment { } } -func newReplicaSet(name, ns string, replicas int32) *apps.ReplicaSet { - return &apps.ReplicaSet{ - TypeMeta: metav1.TypeMeta{ - Kind: "ReplicaSet", - APIVersion: "apps/v1", - }, - ObjectMeta: metav1.ObjectMeta{ - Namespace: ns, - Name: name, - Labels: testLabels(), - }, - Spec: apps.ReplicaSetSpec{ - Selector: &metav1.LabelSelector{ - MatchLabels: testLabels(), - }, - Replicas: &replicas, - Template: v1.PodTemplateSpec{ - ObjectMeta: metav1.ObjectMeta{ - Labels: testLabels(), - }, - Spec: v1.PodSpec{ - Containers: []v1.Container{ - { - Name: fakeContainerName, - Image: fakeImage, - }, - }, - }, - }, - }, - } -} - -func newDeploymentRollback(name string, annotations map[string]string, revision int64) *extensions.DeploymentRollback { - return &extensions.DeploymentRollback{ - Name: name, - UpdatedAnnotations: annotations, - RollbackTo: extensions.RollbackConfig{Revision: revision}, - } -} - // dcSetup sets up necessities for Deployment integration test, including master, apiserver, informers, and clientset func dcSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *replicaset.ReplicaSetController, *deployment.DeploymentController, informers.SharedInformerFactory, clientset.Interface) { masterConfig := framework.NewIntegrationTestMasterConfig() @@ -251,7 +209,7 @@ func (d *deploymentTester) markUpdatedPodsReady(wg *sync.WaitGroup) { return false, nil }) if err != nil { - d.t.Fatalf("failed to mark updated Deployment pods to ready: %v", err) + d.t.Errorf("failed to mark updated Deployment pods to ready: %v", err) } } @@ -367,20 +325,6 @@ func (d *deploymentTester) updateReplicaSet(name string, applyUpdate testutil.Up return testutil.UpdateReplicaSetWithRetries(d.c, d.deployment.Namespace, name, applyUpdate, d.t.Logf, pollInterval, pollTimeout) } -func (d *deploymentTester) updateReplicaSetStatus(name string, applyStatusUpdate testutil.UpdateReplicaSetFunc) (*apps.ReplicaSet, error) { - return testutil.UpdateReplicaSetStatusWithRetries(d.c, d.deployment.Namespace, name, applyStatusUpdate, d.t.Logf, pollInterval, pollTimeout) -} - -// waitForDeploymentRollbackCleared waits for deployment either started rolling back or doesn't need to rollback. -func (d *deploymentTester) waitForDeploymentRollbackCleared() error { - return testutil.WaitForDeploymentRollbackCleared(d.c, d.deployment.Namespace, d.deployment.Name, pollInterval, pollTimeout) -} - -// checkDeploymentRevisionAndImage checks if the input deployment's and its new replica set's revision and image are as expected. -func (d *deploymentTester) checkDeploymentRevisionAndImage(revision, image string) error { - return testutil.CheckDeploymentRevisionAndImage(d.c, d.deployment.Namespace, d.deployment.Name, revision, image) -} - func (d *deploymentTester) waitForDeploymentUpdatedReplicasGTE(minUpdatedReplicas int32) error { return testutil.WaitForDeploymentUpdatedReplicasGTE(d.c, d.deployment.Namespace, d.deployment.Name, minUpdatedReplicas, d.deployment.Generation, pollInterval, pollTimeout) }