Skip to content

Commit

Permalink
Rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
KnVerey committed May 26, 2017
1 parent bbefe42 commit 43dcf5a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions test/integration/kubernetes_deploy_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def test_bad_container_image_on_run_once_halts_and_fails_deploy
pod["spec"]["containers"].first["image"] = "hello-world:thisImageIsBad"
end
assert_equal false, success, "Deploy succeeded when it was expected to fail"
assert_logs_match(/The following priority resources failed to deploy: Pod\/unmanaged-pod/)
assert_logs_match(%r{The following priority resources failed to deploy: Pod\/unmanaged-pod})

hello_cloud = FixtureSetAssertions::HelloCloud.new(@namespace)
hello_cloud.assert_unmanaged_pod_statuses("Failed")
Expand All @@ -183,7 +183,7 @@ def test_wait_false_still_waits_for_priority_resources
pod["spec"]["containers"].first["image"] = "hello-world:thisImageIsBad"
end
assert_equal false, success, "Deploy succeeded when it was expected to fail"
assert_logs_match(/The following priority resources failed to deploy: Pod\/unmanaged-pod/)
assert_logs_match(%r{The following priority resources failed to deploy: Pod\/unmanaged-pod})
assert_logs_match(/DeadlineExceeded/)
end

Expand Down
7 changes: 4 additions & 3 deletions test/integration/runner_task_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_works
assert task_runner.run(
task_template: 'hello-cloud-template-runner',
entrypoint: ['/bin/bash'],
args: %w(echo "KUBERNETES-DEPLOY")
args: ["echo", "'KUBERNETES-DEPLOY'"]
)

assert_logs_match(/Starting task runner/)
Expand Down Expand Up @@ -68,8 +68,9 @@ def test_template_runner_template_missing
refute task_runner.run(
task_template: 'hello-cloud-template-runner',
entrypoint: ['/bin/bash'],
args: %w(echo "KUBERNETES-DEPLOY")
args: ["echo", "'KUBERNETES-DEPLOY'"]
)
assert_logs_match(/Pod template `hello-cloud-template-runner` cannot be found in namespace: `.+`, context: `minikube`/)
expected = /Pod template `hello-cloud-template-runner` cannot be found in namespace: `.+`, context: `minikube`/
assert_logs_match(expected)
end
end
3 changes: 2 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def assert_logs_match(regexp, times = nil)
@logger_stream.rewind
if times
count = @logger_stream.read.scan(regexp).count
assert_equal times, count, "Expected #{regexp} to appear #{times} time(s) in the log, but appeared #{count} times"
fail_msg = "Expected #{regexp} to appear #{times} time(s) in the log, but it appeared #{count} times"
assert_equal times, count, fail_msg
else
assert_match regexp, @logger_stream.read
end
Expand Down

0 comments on commit 43dcf5a

Please sign in to comment.