Merge pull request #868 from nickhammond/env/service
Add ENV['KAMAL_SERVICE'] to hooks
This commit is contained in:
@@ -43,6 +43,7 @@ class CliTestCase < ActiveSupport::TestCase
|
||||
|
||||
def assert_hook_ran(hook, output, version:, service_version:, hosts:, command:, subcommand: nil, runtime: false)
|
||||
performer = `whoami`.strip
|
||||
service = service_version.split("@").first
|
||||
|
||||
assert_match "Running the #{hook} hook...\n", output
|
||||
|
||||
@@ -52,6 +53,7 @@ class CliTestCase < ActiveSupport::TestCase
|
||||
KAMAL_PERFORMER=\"#{performer}\"\s
|
||||
KAMAL_VERSION=\"#{version}\"\s
|
||||
KAMAL_SERVICE_VERSION=\"#{service_version}\"\s
|
||||
KAMAL_SERVICE=\"#{service}\"\s
|
||||
KAMAL_HOSTS=\"#{hosts}\"\s
|
||||
KAMAL_COMMAND=\"#{command}\"\s
|
||||
#{"KAMAL_SUBCOMMAND=\\\"#{subcommand}\\\"\\s" if subcommand}
|
||||
|
||||
@@ -22,7 +22,8 @@ class CommandsHookTest < ActiveSupport::TestCase
|
||||
"KAMAL_RECORDED_AT" => @recorded_at,
|
||||
"KAMAL_PERFORMER" => @performer,
|
||||
"KAMAL_VERSION" => "123",
|
||||
"KAMAL_SERVICE_VERSION" => "app@123" } }
|
||||
"KAMAL_SERVICE_VERSION" => "app@123",
|
||||
"KAMAL_SERVICE" => "app" } }
|
||||
], new_command.run("foo")
|
||||
end
|
||||
|
||||
@@ -33,7 +34,8 @@ class CommandsHookTest < ActiveSupport::TestCase
|
||||
"KAMAL_RECORDED_AT" => @recorded_at,
|
||||
"KAMAL_PERFORMER" => @performer,
|
||||
"KAMAL_VERSION" => "123",
|
||||
"KAMAL_SERVICE_VERSION" => "app@123" } }
|
||||
"KAMAL_SERVICE_VERSION" => "app@123",
|
||||
"KAMAL_SERVICE" => "app" } }
|
||||
], new_command(hooks_path: "custom/hooks/path").run("foo")
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user