From 1c4bcf3bc76ff70404a327f40bc29b619ed7d7cb Mon Sep 17 00:00:00 2001 From: baude Date: Mon, 5 Feb 2018 15:54:48 -0600 Subject: Migrate more tests to ginkgo Migrate the following to the ginkgo integration tests: * images * import * inspect * logs * run_dns Signed-off-by: baude Closes: #295 Approved by: mheon --- test/e2e/images_test.go | 53 +++++++++++++++++++++ test/e2e/import_test.go | 107 ++++++++++++++++++++++++++++++++++++++++++ test/e2e/inspect_test.go | 74 +++++++++++++++++++++++++++++ test/e2e/libpod_suite_test.go | 11 +++++ test/e2e/logs_test.go | 60 +++++++++++++++++++++++ test/e2e/run_dns_test.go | 82 ++++++++++++++++++++++++++++++++ test/podman_images.bats | 37 --------------- test/podman_import.bats | 83 -------------------------------- test/podman_inspect.bats | 51 -------------------- test/podman_logs.bats | 51 -------------------- test/podman_run_dns.bats | 56 ---------------------- 11 files changed, 387 insertions(+), 278 deletions(-) create mode 100644 test/e2e/images_test.go create mode 100644 test/e2e/import_test.go create mode 100644 test/e2e/inspect_test.go create mode 100644 test/e2e/logs_test.go create mode 100644 test/e2e/run_dns_test.go delete mode 100644 test/podman_images.bats delete mode 100644 test/podman_import.bats delete mode 100644 test/podman_inspect.bats delete mode 100644 test/podman_logs.bats delete mode 100644 test/podman_run_dns.bats diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go new file mode 100644 index 000000000..099331c94 --- /dev/null +++ b/test/e2e/images_test.go @@ -0,0 +1,53 @@ +package integration + +import ( + "os" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("Podman images", func() { + var ( + tempdir string + err error + podmanTest PodmanTest + ) + + BeforeEach(func() { + tempdir, err = CreateTempDirInTempDir() + if err != nil { + os.Exit(1) + } + podmanTest = PodmanCreate(tempdir) + podmanTest.RestoreAllArtifacts() + }) + + AfterEach(func() { + podmanTest.Cleanup() + + }) + + It("podman images", func() { + session := podmanTest.Podman([]string{"images"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 3)) + Expect(session.LineInOuputStartsWith("docker.io/library/alpine")).To(BeTrue()) + Expect(session.LineInOuputStartsWith("docker.io/library/busybox")).To(BeTrue()) + }) + + It("podman images in JSON format", func() { + session := podmanTest.Podman([]string{"images", "--format=json"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.IsJSONOutputValid()).To(BeTrue()) + }) + + It("podman images with short options", func() { + session := podmanTest.Podman([]string{"images", "-qn"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 2)) + }) +}) diff --git a/test/e2e/import_test.go b/test/e2e/import_test.go new file mode 100644 index 000000000..23208ca62 --- /dev/null +++ b/test/e2e/import_test.go @@ -0,0 +1,107 @@ +package integration + +import ( + "os" + "path/filepath" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("Podman import", func() { + var ( + tempdir string + err error + podmanTest PodmanTest + ) + + BeforeEach(func() { + tempdir, err = CreateTempDirInTempDir() + if err != nil { + os.Exit(1) + } + podmanTest = PodmanCreate(tempdir) + podmanTest.RestoreAllArtifacts() + }) + + AfterEach(func() { + podmanTest.Cleanup() + }) + + It("podman import with source and reference", func() { + outfile := filepath.Join(podmanTest.TempDir, "container.tar") + _, ec, cid := podmanTest.RunLsContainer("") + Expect(ec).To(Equal(0)) + + export := podmanTest.Podman([]string{"export", "-o", outfile, cid}) + export.WaitWithDefaultTimeout() + Expect(export.ExitCode()).To(Equal(0)) + + importImage := podmanTest.Podman([]string{"import", outfile, "foobar.com/imported-image:latest"}) + importImage.WaitWithDefaultTimeout() + Expect(importImage.ExitCode()).To(Equal(0)) + + results := podmanTest.Podman([]string{"inspect", "--type", "image", "foobar.com/imported-image:latest"}) + results.WaitWithDefaultTimeout() + Expect(results.ExitCode()).To(Equal(0)) + }) + + It("podman import without reference", func() { + outfile := filepath.Join(podmanTest.TempDir, "container.tar") + _, ec, cid := podmanTest.RunLsContainer("") + Expect(ec).To(Equal(0)) + + export := podmanTest.Podman([]string{"export", "-o", outfile, cid}) + export.WaitWithDefaultTimeout() + Expect(export.ExitCode()).To(Equal(0)) + + importImage := podmanTest.Podman([]string{"import", outfile}) + importImage.WaitWithDefaultTimeout() + Expect(importImage.ExitCode()).To(Equal(0)) + + results := podmanTest.Podman([]string{"images", "-q"}) + results.WaitWithDefaultTimeout() + Expect(results.ExitCode()).To(Equal(0)) + Expect(len(results.OutputToStringArray())).To(Equal(4)) + }) + + It("podman import with message flag", func() { + outfile := filepath.Join(podmanTest.TempDir, "container.tar") + _, ec, cid := podmanTest.RunLsContainer("") + Expect(ec).To(Equal(0)) + + export := podmanTest.Podman([]string{"export", "-o", outfile, cid}) + export.WaitWithDefaultTimeout() + Expect(export.ExitCode()).To(Equal(0)) + + importImage := podmanTest.Podman([]string{"import", "--message", "importing container test message", outfile, "imported-image"}) + importImage.WaitWithDefaultTimeout() + Expect(importImage.ExitCode()).To(Equal(0)) + + results := podmanTest.Podman([]string{"history", "imported-image", "--format", "{{.Comment}}"}) + results.WaitWithDefaultTimeout() + Expect(results.ExitCode()).To(Equal(0)) + Expect(results.LineInOuputStartsWith("importing container test message")).To(BeTrue()) + }) + + It("podman import with change flag", func() { + outfile := filepath.Join(podmanTest.TempDir, "container.tar") + _, ec, cid := podmanTest.RunLsContainer("") + Expect(ec).To(Equal(0)) + + export := podmanTest.Podman([]string{"export", "-o", outfile, cid}) + export.WaitWithDefaultTimeout() + Expect(export.ExitCode()).To(Equal(0)) + + importImage := podmanTest.Podman([]string{"import", "--change", "CMD=/bin/bash", outfile, "imported-image"}) + importImage.WaitWithDefaultTimeout() + Expect(importImage.ExitCode()).To(Equal(0)) + + results := podmanTest.Podman([]string{"inspect", "imported-image"}) + results.WaitWithDefaultTimeout() + Expect(results.ExitCode()).To(Equal(0)) + imageData := results.InspectImageJSON() + Expect(imageData.Config.Cmd[0]).To(Equal("/bin/bash")) + }) + +}) diff --git a/test/e2e/inspect_test.go b/test/e2e/inspect_test.go new file mode 100644 index 000000000..b22774575 --- /dev/null +++ b/test/e2e/inspect_test.go @@ -0,0 +1,74 @@ +package integration + +import ( + "os" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "strings" +) + +var _ = Describe("Podman inspect", func() { + var ( + tempdir string + err error + podmanTest PodmanTest + ) + + BeforeEach(func() { + tempdir, err = CreateTempDirInTempDir() + if err != nil { + os.Exit(1) + } + podmanTest = PodmanCreate(tempdir) + podmanTest.RestoreAllArtifacts() + }) + + AfterEach(func() { + podmanTest.Cleanup() + + }) + + It("podman inspect alpine image", func() { + session := podmanTest.Podman([]string{"inspect", "--format=json", ALPINE}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.IsJSONOutputValid()).To(BeTrue()) + imageData := session.InspectImageJSON() + Expect(imageData.RepoTags[0]).To(Equal("docker.io/library/alpine:latest")) + }) + + It("podman inspect bogus container", func() { + session := podmanTest.Podman([]string{"inspect", "foobar4321"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Not(Equal(0))) + }) + + It("podman inspect with GO format", func() { + session := podmanTest.Podman([]string{"inspect", "--format", "{{.ID}}", ALPINE}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + result := podmanTest.Podman([]string{"images", "-q", "--no-trunc", ALPINE}) + result.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(strings.Trim(result.OutputToString(), "sha256:")).To(Equal(session.OutputToString())) + }) + + It("podman inspect specified type", func() { + session := podmanTest.Podman([]string{"inspect", "--type", "image", ALPINE}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + }) + + It("podman inspect container with size", func() { + _, ec, _ := podmanTest.RunLsContainer("") + Expect(ec).To(Equal(0)) + + result := podmanTest.Podman([]string{"inspect", "--size", "-l"}) + result.WaitWithDefaultTimeout() + Expect(result.ExitCode()).To(Equal(0)) + conData := result.InspectContainerToJSON() + Expect(conData.CtrInspectData.SizeRootFs).To(BeNumerically(">", 0)) + }) +}) diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go index 27848517f..712af7236 100644 --- a/test/e2e/libpod_suite_test.go +++ b/test/e2e/libpod_suite_test.go @@ -413,3 +413,14 @@ func StringInSlice(s string, sl []string) bool { } return false } + +//LineInOutputStartsWith returns true if a line in a +// session output starts with the supplied string +func (s *PodmanSession) LineInOuputStartsWith(term string) bool { + for _, i := range s.OutputToStringArray() { + if strings.HasPrefix(i, term) { + return true + } + } + return false +} diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go new file mode 100644 index 000000000..d8fc440c0 --- /dev/null +++ b/test/e2e/logs_test.go @@ -0,0 +1,60 @@ +package integration + +import ( + "os" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("Podman logs", func() { + var ( + tempdir string + err error + podmanTest PodmanTest + ) + + BeforeEach(func() { + tempdir, err = CreateTempDirInTempDir() + if err != nil { + os.Exit(1) + } + podmanTest = PodmanCreate(tempdir) + podmanTest.RestoreAllArtifacts() + }) + + AfterEach(func() { + podmanTest.Cleanup() + + }) + + It("podman logs for container", func() { + _, ec, cid := podmanTest.RunLsContainer("") + Expect(ec).To(Equal(0)) + + results := podmanTest.Podman([]string{"logs", cid}) + results.WaitWithDefaultTimeout() + Expect(results.ExitCode()).To(Equal(0)) + }) + + It("podman logs tail three lines", func() { + Skip("Tail is not working correctly") + _, ec, cid := podmanTest.RunLsContainer("") + Expect(ec).To(Equal(0)) + + results := podmanTest.Podman([]string{"logs", "--tail", "3", cid}) + results.WaitWithDefaultTimeout() + Expect(results.ExitCode()).To(Equal(0)) + Expect(len(results.OutputToStringArray())).To(Equal(3)) + }) + + It("podman logs since a given time", func() { + _, ec, cid := podmanTest.RunLsContainer("") + Expect(ec).To(Equal(0)) + + results := podmanTest.Podman([]string{"logs", "--since", "2017-08-07T10:10:09.056611202-04:00", cid}) + results.WaitWithDefaultTimeout() + Expect(results.ExitCode()).To(Equal(0)) + }) + +}) diff --git a/test/e2e/run_dns_test.go b/test/e2e/run_dns_test.go new file mode 100644 index 000000000..27ca1e556 --- /dev/null +++ b/test/e2e/run_dns_test.go @@ -0,0 +1,82 @@ +package integration + +import ( + "os" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("Podman run dns", func() { + var ( + tempdir string + err error + podmanTest PodmanTest + ) + + BeforeEach(func() { + tempdir, err = CreateTempDirInTempDir() + if err != nil { + os.Exit(1) + } + podmanTest = PodmanCreate(tempdir) + podmanTest.RestoreAllArtifacts() + }) + + AfterEach(func() { + podmanTest.Cleanup() + + }) + + It("podman run add search domain", func() { + session := podmanTest.Podman([]string{"run", "--dns-search=foobar.com", ALPINE, "cat", "/etc/resolv.conf"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + session.LineInOuputStartsWith("search foobar.com") + }) + + It("podman run add bad dns server", func() { + session := podmanTest.Podman([]string{"run", "--dns=foobar", ALPINE, "ls"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Not(Equal(0))) + }) + + It("podman run add dns server", func() { + session := podmanTest.Podman([]string{"run", "--dns=1.2.3.4", ALPINE, "cat", "/etc/resolv.conf"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + session.LineInOuputStartsWith("server 1.2.3.4") + }) + + It("podman run add dns option", func() { + session := podmanTest.Podman([]string{"run", "--dns-opt=debug", ALPINE, "cat", "/etc/resolv.conf"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + session.LineInOuputStartsWith("options debug") + }) + + It("podman run add bad host", func() { + session := podmanTest.Podman([]string{"run", "--add-host=foo:1.2", ALPINE, "ls"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Not(Equal(0))) + }) + + It("podman run add host", func() { + session := podmanTest.Podman([]string{"run", "--add-host=foobar:1.1.1.1", ALPINE, "cat", "/etc/hosts"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + session.LineInOuputStartsWith("foobar 1.1.1.1") + }) + + It("podman run add hostname", func() { + session := podmanTest.Podman([]string{"run", "--hostname=foobar", ALPINE, "cat", "/etc/hostname"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(Equal("foobar")) + + session = podmanTest.Podman([]string{"run", "--hostname=foobar", ALPINE, "hostname"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(Equal("foobar")) + }) +}) diff --git a/test/podman_images.bats b/test/podman_images.bats deleted file mode 100644 index 5812e8f8b..000000000 --- a/test/podman_images.bats +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -function teardown() { - cleanup_test -} - -function setup() { - copy_images -} -@test "podman images" { - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} images - echo "$output" - [ "$status" -eq 0 ] -} - -@test "podman images test valid json" { - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} images --format json - echo "$output" | python -m json.tool - [ "$status" -eq 0 ] -} - -@test "podman images check name json output" { - ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi -fa - ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull ${ALPINE} - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} images --format json - [ "$status" -eq 0 ] - name=$(echo $output | python -c 'import sys; import json; print(json.loads(sys.stdin.read())[0])["names"][0]') - [ "$name" == "docker.io/library/alpine:latest" ] -} - -@test "podman images short options" { - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} images -qn - echo "$output" - [ "$status" -eq 0 ] -} diff --git a/test/podman_import.bats b/test/podman_import.bats deleted file mode 100644 index 69c704a68..000000000 --- a/test/podman_import.bats +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -function teardown() { - cleanup_test -} - -function setup() { - copy_images -} - -@test "podman import with source and reference" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $ALPINE sleep 60" - echo "$output" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash -cp "${PODMAN_BINARY} ${PODMAN_OPTIONS} export -o container.tar $ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} import container.tar imported-image" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} images" - echo "$output" - [ "$status" -eq 0 ] - [[ "$output" == *"imported-image"* ]] - rm -f container.tar -} - -@test "podman import without reference" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $ALPINE sleep 60" - echo "$output" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} export -o container.tar $ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} import container.tar" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} images" - echo "$output" - [ "$status" -eq 0 ] - [[ "$output" == *""* ]] - rm -f container.tar -} - -@test "podman import with message flag" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $ALPINE sleep 60" - echo "$output" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} export -o container.tar $ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} import --message 'importing container test message' container.tar imported-image" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} history imported-image" - echo "$output" - [ "$status" -eq 0 ] - [[ "$output" == *"importing container test message"* ]] - rm -f container.tar -} - -@test "podman import with change flag" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $ALPINE sleep 60" - echo "$output" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} export -o container.tar $ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} import --change 'CMD=/bin/bash' container.tar imported-image" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect imported-image" - echo "$output" - [ "$status" -eq 0 ] - [[ "$output" == *"/bin/bash"* ]] - rm -f container.tar -} diff --git a/test/podman_inspect.bats b/test/podman_inspect.bats deleted file mode 100644 index 19e5a0a9b..000000000 --- a/test/podman_inspect.bats +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -function teardown() { - cleanup_test -} - -function setup() { - copy_images -} - -@test "podman inspect image" { - run bash -c "${PODMAN_BINARY} $PODMAN_OPTIONS inspect ${ALPINE} | python -m json.tool" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "podman inspect non-existent container" { - run ${PODMAN_BINARY} $PODMAN_OPTIONS inspect 14rcole/non-existent - echo "$output" - [ "$status" -ne 0 ] -} - -@test "podman inspect with format" { - run ${PODMAN_BINARY} $PODMAN_OPTIONS inspect --format {{.ID}} ${ALPINE} - echo "$output" - [ "$status" -eq 0 ] - inspectOutput="$output" - bash -c run ${PODMAN_BINARY} $PODMAN_OPTIONS images --no-trunc --quiet ${ALPINE} | sed -e 's/sha256://g' - echo "$output" - [ "$status" -eq 0 ] - [ "$output" = "$inspectOutput" ] - echo "$output" - [ "$status" -eq 0 ] -} - -@test "podman inspect specified type" { - run bash -c "${PODMAN_BINARY} $PODMAN_OPTIONS inspect --type image ${ALPINE} | python -m json.tool" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "podman inspect container with size" { - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} create ${BB} ls - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} $PODMAN_OPTIONS inspect --size -l | python -m json.tool | grep SizeRootFs" - echo "$output" - [ "$status" -eq 0 ] -} diff --git a/test/podman_logs.bats b/test/podman_logs.bats deleted file mode 100644 index e76bf665a..000000000 --- a/test/podman_logs.bats +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -function teardown() { - cleanup_test -} - -function setup() { - copy_images -} - -@test "display logs for container" { - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB ls - echo "$output" - [ "$status" -eq 0 ] - ctr_id="$output" - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} logs $ctr_id - echo "$output" - [ "$status" -eq 0 ] - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rm $ctr_id - echo "$output" - [ "$status" -eq 0 ] -} - -@test "tail three lines of logs for container" { - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB ls - echo "$output" - [ "$status" -eq 0 ] - ctr_id="$output" - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} logs --tail 3 $ctr_id - echo "$output" - lines=$(echo "$output" | wc -l) - [ "$status" -eq 0 ] - [[ $(wc -l < "$output" ) -le 3 ]] - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rm $ctr_id - echo "$output" - [ "$status" -eq 0 ] -} - -@test "display logs for container since a given time" { - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB ls - echo "$output" - [ "$status" -eq 0 ] - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} logs --since 2017-08-07T10:10:09.056611202-04:00 -l - echo "$output" - [ "$status" -eq 0 ] - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rm -l - echo "$output" - [ "$status" -eq 0 ] -} diff --git a/test/podman_run_dns.bats b/test/podman_run_dns.bats deleted file mode 100644 index d37737093..000000000 --- a/test/podman_run_dns.bats +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -function teardown() { - cleanup_test -} - -function setup() { - copy_images -} - -@test "test addition of a search domain" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --dns-search=foobar.com ${ALPINE} cat /etc/resolv.conf | grep foo" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "test addition of a bad dns server" { - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} create --dns="foo" ${ALPINE} ls - echo "$output" - [ "$status" -ne 0 ] -} - -@test "test addition of a dns server" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --dns='1.2.3.4' ${ALPINE} cat /etc/resolv.conf | grep '1.2.3.4'" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "test addition of a dns option" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --dns-opt='debug' ${ALPINE} cat /etc/resolv.conf | grep 'options debug'" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "test addition of a bad add-host" { - run ${PODMAN_BINARY} ${PODMAN_OPTIONS} create --add-host="foo:1.2" ${ALPINE} ls - echo "$output" - [ "$status" -ne 0 ] -} - -@test "test addition of add-host" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --add-host='foobar:1.1.1.1' ${ALPINE} cat /etc/hosts | grep 'foobar'" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "test addition of hostname" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --hostname='foobar' ${ALPINE} cat /etc/hostname | grep foobar" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --hostname='foobar' ${ALPINE} hostname | grep foobar" - echo "$output" - [ "$status" -eq 0 ] -} -- cgit v1.2.3-54-g00ecf