Add cmd args for roles

This commit is contained in:
David Heinemeier Hansson
2023-03-09 11:01:06 +01:00
parent 487fcd4cea
commit 98a14f6173
3 changed files with 20 additions and 2 deletions

View File

@@ -34,6 +34,15 @@ class CommandsAppTest < ActiveSupport::TestCase
@app.run.join(" ")
end
test "run with cmd args" do
@config[:servers] = { "web" => [ "1.1.1.1" ], "jobs" => { "hosts" => [ "1.1.1.2" ], "cmd" => "bin/jobs", "args" => { "mount" => "somewhere" } } }
@app = Mrsk::Commands::App.new Mrsk::Configuration.new(@config).tap { |c| c.version = "999" }
assert_equal \
"docker run --detach --restart unless-stopped --log-opt max-size=10m --name app-999 -e RAILS_MASTER_KEY=\"456\" --label service=\"app\" --label role=\"jobs\" dhh/app:999 bin/jobs --mount \"somewhere\"",
@app.run(role: :jobs).join(" ")
end
test "start" do
assert_equal \
"docker start app-999",