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