Add exec tests

This commit is contained in:
David Heinemeier Hansson
2023-02-03 17:18:42 +01:00
parent 87e54d41e4
commit c453b947e0

View File

@@ -47,6 +47,19 @@ class CliAppTest < CliTestCase
end end
end end
test "exec" do
run_command("exec", "ruby -v").tap do |output|
assert_match /ruby -v/, output
end
end
test "exec with reuse" do
run_command("exec", "--reuse", "ruby -v").tap do |output|
assert_match %r[docker ps --filter label=service=app --format \"{{.Names}}\" | sed 's/-/\\n/g' | tail -n 1], output # Get current version
assert_match %r[docker exec app-999 ruby -v], output # Get current version
end
end
private private
def run_command(*command) def run_command(*command)
stdouted { Mrsk::Cli::App.start([*command, "-c", "test/fixtures/deploy_with_accessories.yml"]) } stdouted { Mrsk::Cli::App.start([*command, "-c", "test/fixtures/deploy_with_accessories.yml"]) }