Skip to content

Commit

Permalink
Fix the tests when you have a git config email set
Browse files Browse the repository at this point in the history
The ran ok on CI where we fall back to `whoami`, but failed locally
where there was a git email set.
  • Loading branch information
djmb committed Jul 16, 2024
1 parent 27fede3 commit 9db6fc0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/cli/cli_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ def stub_setup
end

def assert_hook_ran(hook, output, version:, service_version:, hosts:, command:, subcommand: nil, runtime: false)
performer = Kamal::Git.email.presence || `whoami`.chomp
whoami = `whoami`.chomp
performer = Kamal::Git.email.presence || whoami
service = service_version.split("@").first

assert_match "Running the #{hook} hook...\n", output

expected = %r{Running\s/usr/bin/env\s\.kamal/hooks/#{hook}\sas\s#{performer}@localhost\n\s
expected = %r{Running\s/usr/bin/env\s\.kamal/hooks/#{hook}\sas\s#{whoami}@localhost\n\s
DEBUG\s\[[0-9a-f]*\]\sCommand:\s\(\sexport\s
KAMAL_RECORDED_AT=\"\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ\"\s
KAMAL_PERFORMER=\"#{performer}\"\s
Expand Down

0 comments on commit 9db6fc0

Please sign in to comment.