Protect against rolling back to a bad version

This commit is contained in:
David Heinemeier Hansson
2023-02-18 14:33:47 +01:00
parent 854795c2b6
commit 2e06bf59a4
3 changed files with 41 additions and 7 deletions

View File

@@ -5,4 +5,18 @@ class CliMainTest < CliTestCase
version = stdouted { Mrsk::Cli::Main.new.version }
assert_equal Mrsk::VERSION, version
end
test "rollback bad version" do
run_command("details") # Preheat MRSK const
run_command("rollback", "nonsense").tap do |output|
assert_match /docker container ls -a --filter label=service=app --format '{{ .Names }}'/, output
assert_match /The app version 'nonsense' is not available as a container/, output
end
end
private
def run_command(*command)
stdouted { Mrsk::Cli::Main.start([*command, "-c", "test/fixtures/deploy_with_accessories.yml"]) }
end
end