mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 02:41:25 +00:00
Fix static check failures in test/integration/deployment
This commit is contained in:
parent
962a61f51f
commit
03974c1ea4
@ -37,7 +37,6 @@ pkg/volume/util/subpath
|
|||||||
pkg/volume/vsphere_volume
|
pkg/volume/vsphere_volume
|
||||||
test/e2e/apps
|
test/e2e/apps
|
||||||
test/e2e/autoscaling
|
test/e2e/autoscaling
|
||||||
test/integration/deployment
|
|
||||||
test/integration/examples
|
test/integration/examples
|
||||||
test/integration/framework
|
test/integration/framework
|
||||||
test/integration/garbagecollector
|
test/integration/garbagecollector
|
||||||
|
@ -40,7 +40,6 @@ go_library(
|
|||||||
"//pkg/controller/replicaset:go_default_library",
|
"//pkg/controller/replicaset:go_default_library",
|
||||||
"//staging/src/k8s.io/api/apps/v1: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/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/apis/meta/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/intstr: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",
|
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
|
||||||
|
@ -25,7 +25,6 @@ import (
|
|||||||
|
|
||||||
apps "k8s.io/api/apps/v1"
|
apps "k8s.io/api/apps/v1"
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
extensions "k8s.io/api/extensions/v1beta1"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/intstr"
|
"k8s.io/apimachinery/pkg/util/intstr"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"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
|
// 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) {
|
func dcSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *replicaset.ReplicaSetController, *deployment.DeploymentController, informers.SharedInformerFactory, clientset.Interface) {
|
||||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||||
@ -251,7 +209,7 @@ func (d *deploymentTester) markUpdatedPodsReady(wg *sync.WaitGroup) {
|
|||||||
return false, nil
|
return false, nil
|
||||||
})
|
})
|
||||||
if err != 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)
|
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 {
|
func (d *deploymentTester) waitForDeploymentUpdatedReplicasGTE(minUpdatedReplicas int32) error {
|
||||||
return testutil.WaitForDeploymentUpdatedReplicasGTE(d.c, d.deployment.Namespace, d.deployment.Name, minUpdatedReplicas, d.deployment.Generation, pollInterval, pollTimeout)
|
return testutil.WaitForDeploymentUpdatedReplicasGTE(d.c, d.deployment.Namespace, d.deployment.Name, minUpdatedReplicas, d.deployment.Generation, pollInterval, pollTimeout)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user