Skip to content

Commit

Permalink
Add test for statefulset failure
Browse files Browse the repository at this point in the history
  • Loading branch information
karanthukral committed Oct 12, 2017
1 parent c31fe20 commit ee55396
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions test/integration/kubernetes_deploy_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ def test_full_hello_cloud_set_deploy_succeeds
"Deploying ConfigMap/hello-cloud-configmap-data (timeout: 30s)",
"Hello from Docker!", # unmanaged pod logs
"Result: SUCCESS",
"Successfully deployed 16 resources"
"Successfully deployed 15 resources"
], in_order: true)

assert_logs_match_all([
%r{ReplicaSet/bare-replica-set\s+1 replica, 1 availableReplica, 1 readyReplica},
%r{Deployment/web\s+1 replica, 1 updatedReplica, 1 availableReplica},
%r{Service/web\s+Selects at least 1 pod},
%r{DaemonSet/nginx\s+1 currentNumberScheduled, 1 desiredNumberScheduled, 1 numberReady, 1 numberAvailable},
%r{DaemonSet/nginx\s+1 currentNumberScheduled, 1 desiredNumberScheduled, 1 numberReady},
%r{Service/nginx-ss\s+Selects at least 1 pod},
%r{StatefulSet/nginx-ss\s+2 replicas}
])
Expand Down Expand Up @@ -649,6 +649,25 @@ def test_bad_container_on_daemon_sets_fails
], in_order: true)
end

def test_bad_container_on_stateful_sets_fails
result = deploy_fixtures("hello-cloud", subset: ["stateful_set.yml"]) do |fixtures|
daemon_set = fixtures['stateful_set.yml']['StatefulSet'].first
container = daemon_set['spec']['template']['spec']['containers'].first
container["image"] = "busybox"
container["command"] = ["ls", "/not-a-dir"]
end

assert_deploy_failure(result)
assert_logs_match_all([
"StatefulSet/nginx-ss: FAILED",
"nginx: Crashing repeatedly (exit 1). See logs for more information.",
"Events (common success events excluded):",
"[Pod/nginx-ss-0] FailedSync: Error syncing pod (2 events)",
"Logs from container 'nginx' (last 250 lines shown):",
"ls: /not-a-dir: No such file or directory"
], in_order: true)
end

def test_resource_quotas_are_deployed_first
forced_timeout = 10
KubernetesDeploy::Deployment.any_instance.stubs(:timeout).returns(forced_timeout)
Expand Down

0 comments on commit ee55396

Please sign in to comment.