From 2685c8dc43ff3443e30185345627760c9b94efa3 Mon Sep 17 00:00:00 2001
From: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
Date: Tue, 2 Aug 2022 17:24:23 +0900
Subject: Output messages display rawInput

`init`, `checkpint/restore` and `cleanup` command now display
output messages which is rawInput instead of a container ID.

Example:
```
$ podman init <container name>
<container name>

$ podman init <short container ID>
<short container ID>
```

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
---
 test/system/045-start.bats      | 16 ++++++++++++++++
 test/system/050-stop.bats       | 16 ++++++++++++++++
 test/system/520-checkpoint.bats | 19 +++++++++++++++++++
 3 files changed, 51 insertions(+)

(limited to 'test/system')

diff --git a/test/system/045-start.bats b/test/system/045-start.bats
index ad8483bba..d19171ec3 100644
--- a/test/system/045-start.bats
+++ b/test/system/045-start.bats
@@ -66,4 +66,20 @@ load helpers
     is "$output" "$cid_exited_0"
 }
 
+@test "podman start print IDs or raw input" {
+    # start --all must print the IDs
+    run_podman create $IMAGE top
+    ctrID="$output"
+    run_podman start --all
+    is "$output" "$ctrID"
+
+    # start $input must print $input
+    cname=$(random_string)
+    run_podman create --name $cname $IMAGE top
+    run_podman start $cname
+    is "$output" $cname
+
+    run_podman rm -t 0 -f $ctrID $cname
+}
+
 # vim: filetype=sh
diff --git a/test/system/050-stop.bats b/test/system/050-stop.bats
index 39002512b..a21a036c2 100644
--- a/test/system/050-stop.bats
+++ b/test/system/050-stop.bats
@@ -59,6 +59,22 @@ load helpers
     is "${lines[3]}" "c4--Created.*" "ps -a, created container (unaffected)"
 }
 
+@test "podman stop print IDs or raw input" {
+    # stop -a must print the IDs
+    run_podman run -d $IMAGE top
+    ctrID="$output"
+    run_podman stop --all
+    is "$output" "$ctrID"
+
+    # stop $input must print $input
+    cname=$(random_string)
+    run_podman run -d --name $cname $IMAGE top
+    run_podman stop $cname
+    is "$output" $cname
+
+    run_podman rm -t 0 -f $ctrID $cname
+}
+
 # #9051 : podman stop --ignore was not working with podman-remote
 @test "podman stop --ignore" {
     name=thiscontainerdoesnotexist
diff --git a/test/system/520-checkpoint.bats b/test/system/520-checkpoint.bats
index 7c8fc143a..73fa5d4c4 100644
--- a/test/system/520-checkpoint.bats
+++ b/test/system/520-checkpoint.bats
@@ -101,6 +101,25 @@ function teardown() {
     run_podman rm -t 0 -f $cid
 }
 
+@test "podman checkpoint/restore print IDs or raw input" {
+    # checkpoint/restore -a must print the IDs
+    run_podman run -d $IMAGE top
+    ctrID="$output"
+    run_podman container checkpoint -a
+    is "$output" "$ctrID"
+    run_podman container restore -a
+    is "$output" "$ctrID"
+
+    # checkpoint/restore $input must print $input
+    cname=$(random_string)
+    run_podman run -d --name $cname $IMAGE top
+    run_podman container checkpoint $cname
+    is "$output" $cname
+    run_podman container restore $cname
+    is "$output" $cname
+
+    run_podman rm -t 0 -f $ctrID $cname
+}
 
 @test "podman checkpoint --export, with volumes" {
     skip_if_remote "Test uses --root/--runroot, which are N/A over remote"
-- 
cgit v1.2.3-54-g00ecf