From 9db6fc07043ee5546be7cf1ab56d169b611ebc97 Mon Sep 17 00:00:00 2001 From: Donal McBreen Date: Tue, 16 Jul 2024 12:09:05 +0100 Subject: [PATCH] Fix the tests when you have a git config email set The ran ok on CI where we fall back to `whoami`, but failed locally where there was a git email set. --- test/cli/cli_test_case.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/cli/cli_test_case.rb b/test/cli/cli_test_case.rb index 4ae7c1cb9..4c6b491d4 100644 --- a/test/cli/cli_test_case.rb +++ b/test/cli/cli_test_case.rb @@ -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