Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
timothysmith0609 committed Dec 8, 2023
1 parent dda8739 commit 94fe242
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions test/unit/krane/resource_deployer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,22 @@

class ResourceDeployerTest < Krane::TestCase
def test_deploy_prune_builds_whitelist
whitelist_kind = "fake_kind"
allowlist_kind = "fake_kind"
resource = build_mock_resource
Krane::Kubectl.any_instance.expects(:client_version).returns ("1.26")
Krane::Kubectl.any_instance.expects(:client_version).returns(Gem::Version.new("1.26"))
Krane::Kubectl.any_instance.expects(:run).with do |*args|
args.include?("--prune-allowlist=#{whitelist_kind}")
args.include?("--prune-allowlist=#{allowlist_kind}")
end.returns(["", "", stub(success?: true)])
resource_deployer(kubectl_times: 0, prune_allowlist: [whitelist_kind]).deploy!([resource], false, true)
resource_deployer(kubectl_times: 0, prune_allowlist: [allowlist_kind]).deploy!([resource], false, true)
end

def test_deploy_no_prune_doesnt_prune
whitelist_kind = "fake_kind"
allowlist_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.include?("--prune-allowlist=#{whitelist_kind}")
!args.include?("--prune-allowlist=#{allowlist_kind}")
end.returns(["", "", stub(success?: true)])
resource_deployer(kubectl_times: 0, prune_allowlist: [whitelist_kind]).deploy!([resource], false, false)
resource_deployer(kubectl_times: 0, prune_allowlist: [allowlist_kind]).deploy!([resource], false, false)
end

def test_deploy_verify_false_message
Expand Down

0 comments on commit 94fe242

Please sign in to comment.