diff --git a/test/unit/krane/resource_deployer_test.rb b/test/unit/krane/resource_deployer_test.rb index 16eee6ac8..8e6c8115f 100644 --- a/test/unit/krane/resource_deployer_test.rb +++ b/test/unit/krane/resource_deployer_test.rb @@ -4,21 +4,23 @@ class ResourceDeployerTest < Krane::TestCase def test_deploy_prune_builds_whitelist - allowlist_kind = "fake_kind" + whitelist_kind = "fake_kind" resource = build_mock_resource + Krane::Kubectl.any_instance.expects(:client_version).returns ("1.26") Krane::Kubectl.any_instance.expects(:run).with do |*args| - args.any? { |arg| arg == "--prune-allowlist=#{allowlist_kind}" || arg == "--prune-whitelist=#{allowlist_kind}"} + args.include?("--prune-allowlist=#{whitelist_kind}") end.returns(["", "", stub(success?: true)]) - resource_deployer(kubectl_times: 0, prune_allowlist: [allowlist_kind]).deploy!([resource], false, true) + resource_deployer(kubectl_times: 0, prune_allowlist: [whitelist_kind]).deploy!([resource], false, true) end def test_deploy_no_prune_doesnt_prune - allowlist_kind = "fake_kind" + whitelist_kind = "fake_kind" resource = build_mock_resource + Krane::Kubectl.any_instance.expects(:client_version).returns ("1.26") Krane::Kubectl.any_instance.expects(:run).with do |*args| - args.any? { |arg| arg == "--prune-allowlist=#{allowlist_kind}" || arg == "--prune-whitelist=#{allowlist_kind}"} + !args.include?("--prune-allowlist=#{whitelist_kind}") end.returns(["", "", stub(success?: true)]) - resource_deployer(kubectl_times: 0, prune_allowlist: [allowlist_kind]).deploy!([resource], false, false) + resource_deployer(kubectl_times: 0, prune_allowlist: [whitelist_kind]).deploy!([resource], false, false) end def test_deploy_verify_false_message