From 369781a6d615a9bc540b10fdd4c290e1485529c1 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Tue, 10 Sep 2024 21:08:39 +0200 Subject: [PATCH] test/system: Test attempts to create the same container twice https://github.com/containers/toolbox/issues/957 --- test/system/501-create.bats | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/system/501-create.bats b/test/system/501-create.bats index b11f4c2d6..dc1c07818 100644 --- a/test/system/501-create.bats +++ b/test/system/501-create.bats @@ -57,6 +57,23 @@ teardown() { assert [ ${#lines[@]} -eq 3 ] } +@test "create: Try the same name again (forwarded to host)" { + local default_container + default_container="$(get_system_id)-toolbox-$(get_system_version)" + + create_default_container + + run -1 --keep-empty-lines --separate-stderr "$TOOLBX" run toolbox create + + assert_failure + assert [ ${#lines[@]} -eq 0 ] + lines=("${stderr_lines[@]}") + assert_line --index 0 "Error: container $default_container already exists" + assert_line --index 1 "Enter with: toolbox enter" + assert_line --index 2 "Run 'toolbox --help' for usage." + assert [ ${#stderr_lines[@]} -eq 3 ] +} + @test "create: Try an unsupported distribution (forwarded to host)" { create_default_container