Move audits back to run dir so they survive kamal remove

This commit is contained in:
Donal McBreen
2024-09-12 16:05:56 +01:00
parent b8972a6833
commit 35fe9c154d
3 changed files with 13 additions and 11 deletions

View File

@@ -18,22 +18,22 @@ class CommandsAuditorTest < ActiveSupport::TestCase
test "record" do
assert_equal [
:mkdir, "-p", ".kamal/apps/app", "&&",
:mkdir, "-p", ".kamal", "&&",
:echo,
"[#{@recorded_at}] [#{@performer}]",
"app removed container",
">>", ".kamal/apps/app/audit.log"
">>", ".kamal/app-audit.log"
], @auditor.record("app removed container")
end
test "record with destination" do
new_command(destination: "staging").tap do |auditor|
assert_equal [
:mkdir, "-p", ".kamal/apps/app-staging", "&&",
:mkdir, "-p", ".kamal", "&&",
:echo,
"[#{@recorded_at}] [#{@performer}] [staging]",
"app removed container",
">>", ".kamal/apps/app-staging/audit.log"
">>", ".kamal/app-staging-audit.log"
], auditor.record("app removed container")
end
end
@@ -41,22 +41,22 @@ class CommandsAuditorTest < ActiveSupport::TestCase
test "record with command details" do
new_command(role: "web").tap do |auditor|
assert_equal [
:mkdir, "-p", ".kamal/apps/app", "&&",
:mkdir, "-p", ".kamal", "&&",
:echo,
"[#{@recorded_at}] [#{@performer}] [web]",
"app removed container",
">>", ".kamal/apps/app/audit.log"
">>", ".kamal/app-audit.log"
], auditor.record("app removed container")
end
end
test "record with arg details" do
assert_equal [
:mkdir, "-p", ".kamal/apps/app", "&&",
:mkdir, "-p", ".kamal", "&&",
:echo,
"[#{@recorded_at}] [#{@performer}] [value]",
"app removed container",
">>", ".kamal/apps/app/audit.log"
">>", ".kamal/app-audit.log"
], @auditor.record("app removed container", detail: "value")
end