upgrade_test: fix delete operator
1. should defer delete operator after create 2. reduce grace period
This commit is contained in:
Родитель
b4bba1070f
Коммит
4d77895879
|
@ -73,7 +73,7 @@ func (f *Framework) CreateOperator() error {
|
|||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{{
|
||||
Name: "etcd-operator",
|
||||
Name: name,
|
||||
Image: image,
|
||||
ImagePullPolicy: v1.PullAlways,
|
||||
Command: cmd,
|
||||
|
@ -99,7 +99,8 @@ func (f *Framework) CreateOperator() error {
|
|||
func (f *Framework) DeleteOperator() error {
|
||||
foreground := metav1.DeletePropagationForeground
|
||||
return f.KubeCli.AppsV1beta1().Deployments(f.KubeNS).Delete("etcd-operator", &metav1.DeleteOptions{
|
||||
PropagationPolicy: &foreground,
|
||||
GracePeriodSeconds: func(t int64) *int64 { return &t }(0),
|
||||
PropagationPolicy: &foreground,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -24,16 +24,16 @@ import (
|
|||
)
|
||||
|
||||
func TestResize(t *testing.T) {
|
||||
err := testF.CreateOperator()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer func() {
|
||||
err := testF.DeleteOperator()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}()
|
||||
err := testF.CreateOperator()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err = k8sutil.WaitEtcdTPRReady(testF.KubeCli.CoreV1().RESTClient(), 3*time.Second, 30*time.Second, testF.KubeNS); err != nil {
|
||||
t.Fatalf("failed to see cluster TPR get created in time: %v", err)
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче