diff --git a/test/fixtures/hello-cloud/stateful_set.yml b/test/fixtures/hello-cloud/stateful_set.yml index 318b7fc7b..8b11a21d1 100644 --- a/test/fixtures/hello-cloud/stateful_set.yml +++ b/test/fixtures/hello-cloud/stateful_set.yml @@ -27,6 +27,7 @@ metadata: spec: serviceName: "stateful-busybox" replicas: 2 + podManagementPolicy: Parallel selector: matchLabels: app: hello-cloud diff --git a/test/integration/restart_task_test.rb b/test/integration/restart_task_test.rb index d13a78193..336194237 100644 --- a/test/integration/restart_task_test.rb +++ b/test/integration/restart_task_test.rb @@ -38,8 +38,16 @@ def test_restart_by_annotation def test_restart_statefulset_on_delete_restarts_child_pods result = deploy_fixtures("hello-cloud", subset: ["configmap-data.yml", "unmanaged-pod-1.yml.erb", "stateful_set.yml"], render_erb: true) do |fixtures| + end + assert_deploy_success(result) + + result = deploy_fixtures("hello-cloud", subset: ["configmap-data.yml", "unmanaged-pod-1.yml.erb", + "stateful_set.yml"], render_erb: true, wait: false) do |fixtures| statefulset = fixtures["stateful_set.yml"]["StatefulSet"].first - statefulset["spec"]["updateStrategy"] = { "type" => "OnDelete" } + # https://github.com/kubernetes/kubernetes/issues/100151#issuecomment-801073848 + statefulset["spec"]["updateStrategy"] = { "type" => "OnDelete", "rollingUpdate" => nil } + container = statefulset['spec']['template']['spec']['containers'].first + container['readinessProbe'] = { "exec" => { "command" => ['ls'] } } end assert_deploy_success(result) before_pods = kubeclient.get_pods(namespace: @namespace, label_selector: "name=stateful-busybox").map do |p| @@ -47,7 +55,7 @@ def test_restart_statefulset_on_delete_restarts_child_pods end restart = build_restart_task - assert_restart_success(restart.perform) + assert_restart_success(restart.perform(verify_result: false)) after_pods = kubeclient.get_pods(namespace: @namespace, label_selector: "name=stateful-busybox").map do |p| p.metadata.uid end