Skip to content

Commit

Permalink
fix test stub
Browse files Browse the repository at this point in the history
  • Loading branch information
timothysmith0609 committed Dec 8, 2023
1 parent 54677a0 commit dda8739
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions test/unit/krane/resource_deployer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dda8739

Please sign in to comment.