From c453b947e01375c606ec57a87ef381b8cc9bfe0b Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 3 Feb 2023 17:18:42 +0100 Subject: [PATCH] Add exec tests --- test/cli/app_test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/cli/app_test.rb b/test/cli/app_test.rb index 28e7fbb0..b17ba8d4 100644 --- a/test/cli/app_test.rb +++ b/test/cli/app_test.rb @@ -47,6 +47,19 @@ class CliAppTest < CliTestCase 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 def run_command(*command) stdouted { Mrsk::Cli::App.start([*command, "-c", "test/fixtures/deploy_with_accessories.yml"]) }