summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/e2e/checkpoint_test.go20
-rw-r--r--test/e2e/e2e.coverprofile11
-rw-r--r--test/system/010-images.bats39
-rw-r--r--test/system/helpers.bash2
4 files changed, 48 insertions, 24 deletions
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index f208a4cf0..237223283 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -439,6 +439,18 @@ var _ = Describe("Podman checkpoint", func() {
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
+ result = podmanTest.Podman([]string{"exec", "-l", "/bin/sh", "-c", "rm /etc/motd"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+
+ result = podmanTest.Podman([]string{"diff", "-l"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(result.OutputToString()).To(ContainSubstring("C /etc"))
+ Expect(result.OutputToString()).To(ContainSubstring("A /test.output"))
+ Expect(result.OutputToString()).To(ContainSubstring("D /etc/motd"))
+ Expect(len(result.OutputToStringArray())).To(Equal(3))
+
// Checkpoint the container
result = podmanTest.Podman([]string{"container", "checkpoint", "-l", "-e", fileName})
result.WaitWithDefaultTimeout()
@@ -462,6 +474,14 @@ var _ = Describe("Podman checkpoint", func() {
Expect(result.ExitCode()).To(Equal(0))
Expect(result.OutputToString()).To(ContainSubstring("test" + cid + "test"))
+ result = podmanTest.Podman([]string{"diff", "-l"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(result.OutputToString()).To(ContainSubstring("C /etc"))
+ Expect(result.OutputToString()).To(ContainSubstring("A /test.output"))
+ Expect(result.OutputToString()).To(ContainSubstring("D /etc/motd"))
+ Expect(len(result.OutputToStringArray())).To(Equal(3))
+
// Remove exported checkpoint
os.Remove(fileName)
})
diff --git a/test/e2e/e2e.coverprofile b/test/e2e/e2e.coverprofile
deleted file mode 100644
index d413679ea..000000000
--- a/test/e2e/e2e.coverprofile
+++ /dev/null
@@ -1,11 +0,0 @@
-mode: atomic
-github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:14.46,21.20 2 3
-github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:32.2,32.19 1 3
-github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:39.2,39.53 1 3
-github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:66.2,66.52 1 3
-github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:21.20,23.17 2 6
-github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:26.3,29.36 4 6
-github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:23.17,25.4 1 0
-github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:32.19,37.3 3 6
-github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:39.53,64.3 20 3
-github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:66.52,91.3 20 3 \ No newline at end of file
diff --git a/test/system/010-images.bats b/test/system/010-images.bats
index 543876509..66ef53590 100644
--- a/test/system/010-images.bats
+++ b/test/system/010-images.bats
@@ -45,18 +45,33 @@ size | [0-9]\\\+
}
@test "podman images - history output" {
- run_podman images --format json
- actual=$(echo $output | jq -r '.[0].history | length')
- is "$actual" "0"
-
- run_podman tag $PODMAN_TEST_IMAGE_REGISTRY/$PODMAN_TEST_IMAGE_USER/$PODMAN_TEST_IMAGE_NAME:$PODMAN_TEST_IMAGE_TAG test-image
- run_podman images --format json
- actual=$(echo $output | jq -r '.[1].history | length')
- is "$actual" "0"
- actual=$(echo $output | jq -r '.[0].history | length')
- is "$actual" "1"
- actual=$(echo $output | jq -r '.[0].history[0]')
- is "$actual" "$PODMAN_TEST_IMAGE_REGISTRY/$PODMAN_TEST_IMAGE_USER/$PODMAN_TEST_IMAGE_NAME:$PODMAN_TEST_IMAGE_TAG"
+ # podman history is persistent: it permanently alters our base image.
+ # Create a dummy image here so we leave our setup as we found it.
+ run_podman run --name my-container $IMAGE true
+ run_podman commit my-container my-test-image
+
+ run_podman images my-test-image --format '{{ .History }}'
+ is "$output" "" "Image has empty history to begin with"
+
+ # Generate two randomish tags; 'tr' because they must be all lower-case
+ rand_name1="test-image-history-$(random_string 10 | tr A-Z a-z)"
+ rand_name2="test-image-history-$(random_string 10 | tr A-Z a-z)"
+
+ # Tag once, rmi, and make sure the tag name appears in history
+ run_podman tag my-test-image $rand_name1
+ run_podman rmi $rand_name1
+ run_podman images my-test-image --format '{{ .History }}'
+ is "$output" "localhost/${rand_name1}:latest" "image history after one tag"
+
+ # Repeat with second tag. Now both tags should be in history
+ run_podman tag my-test-image $rand_name2
+ run_podman rmi $rand_name2
+ run_podman images my-test-image --format '{{ .History }}'
+ is "$output" "localhost/${rand_name2}:latest, localhost/${rand_name1}:latest" \
+ "image history after two tags"
+
+ run_podman rmi my-test-image
+ run_podman rm my-container
}
# vim: filetype=sh
diff --git a/test/system/helpers.bash b/test/system/helpers.bash
index 8c061d2c9..940f3f426 100644
--- a/test/system/helpers.bash
+++ b/test/system/helpers.bash
@@ -36,7 +36,7 @@ function basic_setup() {
if [ "$1" == "$PODMAN_TEST_IMAGE_FQN" ]; then
found_needed_image=1
else
- echo "# setup(): removing stray images" >&3
+ echo "# setup(): removing stray images $1 $2" >&3
run_podman rmi --force "$1" >/dev/null 2>&1 || true
run_podman rmi --force "$2" >/dev/null 2>&1 || true
fi