Blame toolbox-Add-migration-paths-for-coreos-toolbox-users.patch

006d4f5
From d461caa5b1a278124d039df93140d2d5bf4eabe7 Mon Sep 17 00:00:00 2001
006d4f5
From: Debarshi Ray <rishi@fedoraproject.org>
006d4f5
Date: Wed, 18 Aug 2021 17:55:21 +0200
006d4f5
Subject: [PATCH 1/2] cmd/run: Make sosreport work by setting the HOST
006d4f5
 environment variable
006d4f5
006d4f5
https://bugzilla.redhat.com/show_bug.cgi?id=1940037
006d4f5
---
006d4f5
 src/cmd/run.go | 1 +
006d4f5
 1 file changed, 1 insertion(+)
006d4f5
006d4f5
diff --git a/src/cmd/run.go b/src/cmd/run.go
006d4f5
index 7657ffa50821..23d422623b14 100644
006d4f5
--- a/src/cmd/run.go
006d4f5
+++ b/src/cmd/run.go
006d4f5
@@ -501,6 +501,7 @@ func constructExecArgs(container, preserveFDs string,
006d4f5
 	execArgs = append(execArgs, envOptions...)
006d4f5
 
006d4f5
 	execArgs = append(execArgs, []string{
006d4f5
+		"--env", "HOST=/run/host",
006d4f5
 		"--interactive",
006d4f5
 		"--preserve-fds", preserveFDs,
006d4f5
 	}...)
006d4f5
-- 
006d4f5
2.39.2
006d4f5
006d4f5
006d4f5
From 3c2c67752e8f88f72058799cbce3612fc937b230 Mon Sep 17 00:00:00 2001
006d4f5
From: Debarshi Ray <rishi@fedoraproject.org>
006d4f5
Date: Fri, 10 Dec 2021 13:42:15 +0100
006d4f5
Subject: [PATCH 2/2] test/system: Update to test the migration path for
006d4f5
 coreos/toolbox users
006d4f5
006d4f5
This reverts the changes to the tests made in commit
006d4f5
411147988b730dabf8b9e761a5426e12d648f008 by restoring commit
006d4f5
ca899c8a561f357ae32c6ba6813520fd8b682abb and the parts of commit
006d4f5
3aeb7cf288319e35eb9c5e26ea18d97452462c1e that were removed.
006d4f5
---
006d4f5
 test/system/002-help.bats | 11 -----------
006d4f5
 test/system/100-root.bats | 27 +++++++++++++++++++++++++++
006d4f5
 2 files changed, 27 insertions(+), 11 deletions(-)
006d4f5
 create mode 100644 test/system/100-root.bats
006d4f5
006d4f5
diff --git a/test/system/002-help.bats b/test/system/002-help.bats
006d4f5
index 7e4565e9d23d..58a4c2c87ece 100644
006d4f5
--- a/test/system/002-help.bats
006d4f5
+++ b/test/system/002-help.bats
006d4f5
@@ -23,17 +23,6 @@ setup() {
006d4f5
   _setup_environment
006d4f5
 }
006d4f5
 
006d4f5
-@test "help: Try to run toolbox with no command" {
006d4f5
-  run $TOOLBOX
006d4f5
-
006d4f5
-  assert_failure
006d4f5
-  assert_line --index 0 "Error: missing command"
006d4f5
-  assert_line --index 1 "create    Create a new toolbox container"
006d4f5
-  assert_line --index 2 "enter     Enter an existing toolbox container"
006d4f5
-  assert_line --index 3 "list      List all existing toolbox containers and images"
006d4f5
-  assert_line --index 4 "Run 'toolbox --help' for usage."
006d4f5
-}
006d4f5
-
006d4f5
 @test "help: Run command 'help'" {
006d4f5
   if ! command -v man 2>/dev/null; then
006d4f5
     skip "Test works only if man is in PATH"
006d4f5
diff --git a/test/system/100-root.bats b/test/system/100-root.bats
006d4f5
new file mode 100644
006d4f5
index 000000000000..32d87904213e
006d4f5
--- /dev/null
006d4f5
+++ b/test/system/100-root.bats
006d4f5
@@ -0,0 +1,27 @@
006d4f5
+#!/usr/bin/env bats
006d4f5
+
006d4f5
+load 'libs/bats-support/load'
006d4f5
+load 'libs/bats-assert/load'
006d4f5
+load 'libs/helpers'
006d4f5
+
006d4f5
+setup() {
006d4f5
+  _setup_environment
006d4f5
+  cleanup_containers
006d4f5
+}
006d4f5
+
006d4f5
+teardown() {
006d4f5
+  cleanup_containers
006d4f5
+}
006d4f5
+
006d4f5
+@test "root: Try to enter the default container with no containers created" {
006d4f5
+  run $TOOLBOX <<< "n"
006d4f5
+
006d4f5
+  assert_success
006d4f5
+  assert_line --index 0 "No toolbox containers found. Create now? [y/N] A container can be created later with the 'create' command."
006d4f5
+  assert_line --index 1 "Run 'toolbox --help' for usage."
006d4f5
+}
006d4f5
+
006d4f5
+# TODO: Write the test
006d4f5
+@test "root: Enter the default container when 1 non-default container is present" {
006d4f5
+  skip "Testing of entering toolboxes is not implemented"
006d4f5
+}
006d4f5
-- 
006d4f5
2.39.2
006d4f5