Merge pull request #300 from baude/ginkgo_version

More ginkgo migration
This commit is contained in:
Daniel J Walsh
2018-02-07 16:49:56 -05:00
committed by GitHub
19 changed files with 496 additions and 326 deletions

60
test/e2e/attach_test.go Normal file
View File

@ -0,0 +1,60 @@
package integration
import (
"os"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Podman attach", 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 attach to bogus container", func() {
session := podmanTest.Podman([]string{"attach", "foobar"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(125))
})
It("podman attach to non-running container", func() {
session := podmanTest.Podman([]string{"create", "--name", "test1", "-d", "-i", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
results := podmanTest.Podman([]string{"attach", "test1"})
results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(125))
})
It("podman attach to multiple containers", func() {
session := podmanTest.RunSleepContainer("test1")
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.RunSleepContainer("test2")
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
results := podmanTest.Podman([]string{"attach", "test1", "test2"})
results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(125))
})
})

View File

@ -74,6 +74,7 @@ var _ = Describe("Podman commit", func() {
})
It("podman commit container with change flag", func() {
podmanTest.RestoreArtifact(fedoraMinimal)
test := podmanTest.Podman([]string{"run", "--name", "test1", "-d", fedoraMinimal, "ls"})
test.WaitWithDefaultTimeout()
Expect(test.ExitCode()).To(Equal(0))

View File

@ -39,7 +39,8 @@ var (
INTEGRATION_ROOT string
STORAGE_OPTIONS = "--storage-driver vfs"
ARTIFACT_DIR = "/tmp/.artifacts"
IMAGES = []string{"alpine", "busybox"}
CACHE_IMAGES = []string{"alpine", "busybox", fedoraMinimal}
RESTORE_IMAGES = []string{"alpine", "busybox"}
ALPINE = "docker.io/library/alpine:latest"
BB_GLIBC = "docker.io/library/busybox:glibc"
fedoraMinimal = "registry.fedoraproject.org/fedora-minimal:latest"
@ -86,7 +87,7 @@ var _ = BeforeSuite(func() {
os.Exit(1)
}
}
for _, image := range IMAGES {
for _, image := range CACHE_IMAGES {
fmt.Printf("Caching %s...\n", image)
if err := podman.CreateArtifact(image); err != nil {
fmt.Printf("%q\n", err)
@ -280,7 +281,8 @@ func (p *PodmanTest) CreateArtifact(image string) error {
return errors.Errorf("error parsing image name %v: %v", image, err)
}
exportTo := filepath.Join("dir:", p.ArtifactPath, image)
imageDir := strings.Replace(image, "/", "_", -1)
exportTo := filepath.Join("dir:", p.ArtifactPath, imageDir)
exportRef, err := alltransports.ParseImageName(exportTo)
if err != nil {
return errors.Errorf("error parsing image name %v: %v", exportTo, err)
@ -314,7 +316,8 @@ func (p *PodmanTest) RestoreArtifact(image string) error {
return errors.Errorf("error parsing image name: %v", err)
}
importFrom := fmt.Sprintf("dir:%s", filepath.Join(p.ArtifactPath, image))
imageDir := strings.Replace(image, "/", "_", -1)
importFrom := fmt.Sprintf("dir:%s", filepath.Join(p.ArtifactPath, imageDir))
importRef, err := alltransports.ParseImageName(importFrom)
if err != nil {
return errors.Errorf("error parsing image name %v: %v", image, err)
@ -342,7 +345,7 @@ func (p *PodmanTest) RestoreArtifact(image string) error {
// RestoreAllArtifacts unpacks all cached images
func (p *PodmanTest) RestoreAllArtifacts() error {
for _, image := range IMAGES {
for _, image := range RESTORE_IMAGES {
if err := p.RestoreArtifact(image); err != nil {
return err
}

View File

@ -5,6 +5,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"strings"
)
var _ = Describe("Podman privileged container tests", func() {
@ -36,4 +37,40 @@ var _ = Describe("Podman privileged container tests", func() {
Expect(ok).To(BeTrue())
Expect(lines[0]).To(ContainSubstring("sysfs (rw,"))
})
It("podman privileged CapEff", func() {
cap := podmanTest.SystemExec("grep", []string{"CapEff", "/proc/self/status"})
cap.WaitWithDefaultTimeout()
Expect(cap.ExitCode()).To(Equal(0))
session := podmanTest.Podman([]string{"run", "--privileged", "busybox", "grep", "CapEff", "/proc/self/status"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(Equal(cap.OutputToString()))
})
It("podman cap-add CapEff", func() {
cap := podmanTest.SystemExec("grep", []string{"CapEff", "/proc/self/status"})
cap.WaitWithDefaultTimeout()
Expect(cap.ExitCode()).To(Equal(0))
session := podmanTest.Podman([]string{"run", "--cap-add", "all", "busybox", "grep", "CapEff", "/proc/self/status"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(Equal(cap.OutputToString()))
})
It("podman cap-drop CapEff", func() {
cap := podmanTest.SystemExec("grep", []string{"CapAmb", "/proc/self/status"})
cap.WaitWithDefaultTimeout()
Expect(cap.ExitCode()).To(Equal(0))
session := podmanTest.Podman([]string{"run", "--cap-drop", "all", "busybox", "grep", "CapEff", "/proc/self/status"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
capAmp := strings.Split(cap.OutputToString(), " ")
capEff := strings.Split(session.OutputToString(), " ")
Expect(capAmp[1]).To(Equal(capEff[1]))
})
})

61
test/e2e/run_exit_test.go Normal file
View File

@ -0,0 +1,61 @@
package integration
import (
"os"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Podman run exit", 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 exit 125", func() {
result := podmanTest.Podman([]string{"run", "--foobar", ALPINE, "ls", "$tmp"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(125))
})
It("podman run exit 126", func() {
result := podmanTest.Podman([]string{"run", ALPINE, "foobar"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(126))
})
It("podman run exit 127", func() {
result := podmanTest.Podman([]string{"run", ALPINE, "/etc"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(127))
})
It("podman run exit 0", func() {
result := podmanTest.Podman([]string{"run", ALPINE, "ls"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
})
It("podman run exit 50", func() {
podmanTest.RestoreArtifact(fedoraMinimal)
result := podmanTest.Podman([]string{"run", "registry.fedoraproject.org/fedora-minimal", "bash", "-c", "exit 50"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(50))
})
})

View File

@ -0,0 +1,58 @@
package integration
import (
"os"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Podman run memory", 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 memory test", func() {
session := podmanTest.Podman([]string{"run", "--memory=40m", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.limit_in_bytes"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(Equal("41943040"))
})
It("podman run memory-reservation test", func() {
session := podmanTest.Podman([]string{"run", "--memory-reservation=40m", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.soft_limit_in_bytes"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(Equal("41943040"))
})
It("podman run memory-swappiness test", func() {
session := podmanTest.Podman([]string{"run", "--memory-swappiness=15", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.swappiness"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(Equal("15"))
})
It("podman run kernel-memory test", func() {
session := podmanTest.Podman([]string{"run", "--kernel-memory=40m", ALPINE, "cat", "/sys/fs/cgroup/memory/memory.kmem.limit_in_bytes"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(Equal("41943040"))
})
})

67
test/e2e/run_ns_test.go Normal file
View File

@ -0,0 +1,67 @@
package integration
import (
"os"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Podman run ns", func() {
var (
tempdir string
err error
podmanTest PodmanTest
)
BeforeEach(func() {
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
}
podmanTest = PodmanCreate(tempdir)
podmanTest.RestoreAllArtifacts()
podmanTest.RestoreArtifact(fedoraMinimal)
})
AfterEach(func() {
podmanTest.Cleanup()
})
It("podman run pidns test", func() {
session := podmanTest.Podman([]string{"run", fedoraMinimal, "bash", "-c", "echo $$"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(Equal("1"))
session = podmanTest.Podman([]string{"run", "--pid=host", fedoraMinimal, "bash", "-c", "echo $$"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(Not(Equal("1")))
session = podmanTest.Podman([]string{"run", "--pid=badpid", fedoraMinimal, "bash", "-c", "echo $$"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Not(Equal(0)))
})
It("podman run ipcns test", func() {
setup := podmanTest.SystemExec("mktemp", []string{"/dev/shm/podmantest.XXXX)"})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
session := podmanTest.Podman([]string{"run", "--ipc=host", fedoraMinimal, "ls", setup.OutputToString()})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(ContainSubstring(setup.OutputToString()))
err := os.Remove(setup.OutputToString())
Expect(err).To(BeNil())
})
It("podman run bad ipc pid test", func() {
session := podmanTest.Podman([]string{"run", "--ipc=badpid", fedoraMinimal, "bash", "-c", "echo $$"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).ToNot(Equal(0))
})
})

View File

@ -115,6 +115,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run limits test", func() {
podmanTest.RestoreArtifact(fedoraMinimal)
session := podmanTest.Podman([]string{"run", "--rm", "--ulimit", "rtprio=99", "--cap-add=sys_nice", fedoraMinimal, "cat", "/proc/self/sched"})
session.Wait(45)
Expect(session.ExitCode()).To(Equal(0))

96
test/e2e/save_test.go Normal file
View File

@ -0,0 +1,96 @@
package integration
import (
"os"
"path/filepath"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Podman save", 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 save output flag", func() {
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
})
It("podman save oci flag", func() {
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
save := podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
})
It("podman save with stdout", func() {
Skip("Pipe redirection in ginkgo probably wont work")
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
save := podmanTest.Podman([]string{"save", ALPINE, ">", outfile})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
})
It("podman save quiet flag", func() {
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
})
It("podman save bogus image", func() {
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
save := podmanTest.Podman([]string{"save", "-o", outfile, "FOOBAR"})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Not(Equal(0)))
})
It("podman save to directory with oci format", func() {
outdir := filepath.Join(podmanTest.TempDir, "save")
save := podmanTest.Podman([]string{"save", "--format", "oci-dir", "-o", outdir, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
})
It("podman save to directory with v2s2 docker format", func() {
outdir := filepath.Join(podmanTest.TempDir, "save")
save := podmanTest.Podman([]string{"save", "--format", "docker-dir", "-o", outdir, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
})
It("podman save to directory with docker format and compression", func() {
outdir := filepath.Join(podmanTest.TempDir, "save")
save := podmanTest.Podman([]string{"save", "--compress", "--format", "docker-dir", "-o", outdir, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
})
})

69
test/e2e/tag_test.go Normal file
View File

@ -0,0 +1,69 @@
package integration
import (
"os"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Podman tag", 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 tag shortname:latest", func() {
session := podmanTest.Podman([]string{"tag", ALPINE, "foobar:latest"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
results := podmanTest.Podman([]string{"inspect", "foobar:latest"})
results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(0))
inspectData := results.InspectImageJSON()
Expect(StringInSlice("docker.io/library/alpine:latest", inspectData.RepoTags)).To(BeTrue())
Expect(StringInSlice("foobar:latest", inspectData.RepoTags)).To(BeTrue())
})
It("podman tag shortname", func() {
session := podmanTest.Podman([]string{"tag", ALPINE, "foobar"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
results := podmanTest.Podman([]string{"inspect", "foobar:latest"})
results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(0))
inspectData := results.InspectImageJSON()
Expect(StringInSlice("docker.io/library/alpine:latest", inspectData.RepoTags)).To(BeTrue())
Expect(StringInSlice("foobar:latest", inspectData.RepoTags)).To(BeTrue())
})
It("podman tag shortname:tag", func() {
session := podmanTest.Podman([]string{"tag", ALPINE, "foobar:new"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
results := podmanTest.Podman([]string{"inspect", "foobar:new"})
results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(0))
inspectData := results.InspectImageJSON()
Expect(StringInSlice("docker.io/library/alpine:latest", inspectData.RepoTags)).To(BeTrue())
Expect(StringInSlice("foobar:new", inspectData.RepoTags)).To(BeTrue())
})
})

38
test/e2e/version_test.go Normal file
View File

@ -0,0 +1,38 @@
package integration
import (
"os"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Podman version", func() {
var (
tempdir string
err error
podmanTest PodmanTest
)
BeforeEach(func() {
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
}
podmanTest = PodmanCreate(tempdir)
podmanTest.RestoreAllArtifacts()
podmanTest.RestoreArtifact(fedoraMinimal)
})
AfterEach(func() {
podmanTest.Cleanup()
})
It("podman version", func() {
session := podmanTest.Podman([]string{"version"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 3))
})
})

View File

@ -1,32 +0,0 @@
#!/usr/bin/env bats
load helpers
function teardown() {
cleanup_test
}
function setup() {
copy_images
}
@test "attach to a bogus container" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} attach foobar
echo "$output"
[ "$status" -eq 125 ]
}
@test "attach to non-running container" {
${PODMAN_BINARY} ${PODMAN_OPTIONS} create --name foobar -d -i ${ALPINE} ls
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} attach foobar
echo "$output"
[ "$status" -eq 125 ]
}
@test "attach to multiple containers" {
${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name foobar1 -d -i ${ALPINE} /bin/sh
${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name foobar2 -d -i ${ALPINE} /bin/sh
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} attach foobar1 foobar2
echo "$output"
[ "$status" -eq 125 ]
}

View File

@ -1,46 +0,0 @@
#!/usr/bin/env bats
load helpers
function teardown() {
cleanup_test
}
function setup() {
copy_images
}
@test "run exit125 test" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --foobar ${ALPINE} ls $tmp
echo $output
echo $status != 125
[ $status -eq 125 ]
}
@test "run exit126 test" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run ${ALPINE} foobar
echo $output
echo $status != 126
[ "$status" -eq 126 ]
}
@test "run exit127 test" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run ${ALPINE} /etc
echo $output
echo $status != 127
[ "$status" -eq 127 ]
}
@test "run exit0 test" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run ${ALPINE} ps
echo $output
echo $status != 0
[ "$status" -eq 0 ]
}
@test "run exit50 test" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run ${ALPINE} sh -c "exit 50"
echo $output
echo $status != 50
[ "$status" -eq 50 ]
}

View File

@ -1,39 +0,0 @@
#!/usr/bin/env bats
load helpers
function teardown() {
cleanup_test
}
function setup() {
copy_images
}
@test "run memory test" {
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --memory=40m ${ALPINE} cat /sys/fs/cgroup/memory/memory.limit_in_bytes | tr -d '\r'"
echo $output
[ "$status" -eq 0 ]
[ "$output" = 41943040 ]
}
@test "run memory-reservation test" {
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --memory-reservation=40m ${ALPINE} cat /sys/fs/cgroup/memory/memory.soft_limit_in_bytes | tr -d '\r'"
echo "$output"
[ "$status" -eq 0 ]
[ "$output" = 41943040 ]
}
@test "run memory-swappiness test" {
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --memory-swappiness=15 ${ALPINE} cat /sys/fs/cgroup/memory/memory.swappiness | tr -d '\r'"
echo "$output"
[ "$status" -eq 0 ]
[ "$output" = 15 ]
}
@test "run kernel-memory test" {
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --kernel-memory=40m ${ALPINE} cat /sys/fs/cgroup/memory/memory.kmem.limit_in_bytes | tr -d '\r'"
echo "$output"
[ "$status" -eq 0 ]
[ "$output" = 41943040 ]
}

View File

@ -1,44 +0,0 @@
#!/usr/bin/env bats
load helpers
function teardown() {
cleanup_test
}
function setup() {
copy_images
}
@test "run pidns test" {
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run ${ALPINE} sh -c 'echo \$\$'"
echo $output
[ "$status" -eq 0 ]
pid=$(echo $output | tr -d '\r')
[ $pid = "1" ]
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --pid=host ${ALPINE} sh -c 'echo \$\$'"
echo $output
pid=$(echo $output | tr -d '\r')
[ "$status" -eq 0 ]
[ $pid != "1" ]
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --pid=badpid ${ALPINE} sh -c 'echo $$'
echo $output
[ "$status" -ne 0 ]
}
@test "run ipcns test" {
tmp=$(mktemp /dev/shm/foo.XXXXX)
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --ipc=host ${ALPINE} ls $tmp
echo $output
out=$(echo $output | tr -d '\r')
[ "$status" -eq 0 ]
[ $out != $tmp ]
rm -f $tmp
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --ipc=badpid ${ALPINE} sh -c 'echo $$'
echo $output
[ "$status" -ne 0 ]
}

View File

@ -1,34 +0,0 @@
#!/usr/bin/env bats
load helpers
function teardown() {
cleanup_test
}
function setup() {
copy_images
}
@test "run privileged test" {
cap=$(grep CapEff /proc/self/status | cut -f2 -d":")
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --privileged ${ALPINE} grep CapEff /proc/self/status
echo $output
[ "$status" -eq 0 ]
containercap=$(echo $output | tr -d '\r'| cut -f2 -d":")
[ $containercap = $cap ]
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --cap-add all ${ALPINE} grep CapEff /proc/self/status
echo $output
[ "$status" -eq 0 ]
containercap=$(echo $output | tr -d '\r'| cut -f2 -d":")
[ $containercap = $cap ]
cap=$(grep CapAmb /proc/self/status | cut -f2 -d":")
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --cap-drop all ${ALPINE} grep CapEff /proc/self/status
echo $output
[ "$status" -eq 0 ]
containercap=$(echo $output | tr -d '\r'| cut -f2 -d":")
[ $containercap = $cap ]
}

View File

@ -1,70 +0,0 @@
#!/usr/bin/env bats
load helpers
function teardown() {
cleanup_test
}
function setup() {
copy_images
}
@test "podman save output flag" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar $ALPINE
echo "$output"
[ "$status" -eq 0 ]
rm -f alpine.tar
}
@test "podman save oci flag" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar --format oci-archive $ALPINE
echo "$output"
[ "$status" -eq 0 ]
rm -f alpine.tar
}
@test "podman save using stdout" {
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} save $ALPINE > alpine.tar"
[ "$status" -eq 0 ]
rm -f alpine.tar
}
@test "podman save quiet flag" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -q -o alpine.tar $ALPINE
echo "$output"
[ "$status" -eq 0 ]
rm -f alpine.tar
}
@test "podman save non-existent image" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar FOOBAR
echo "$output"
[ "$status" -ne 0 ]
}
@test "podman save to directory with oci format" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save --format oci-dir -o alp-dir $ALPINE
echo "$output"
[ "$status" -eq 0 ]
rm -rf alp-dir
}
@test "podman save to directory with v2s2 (docker) format" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save --format docker-dir -o alp-dir $ALPINE
echo "$output"
[ "$status" -eq 0 ]
rm -rf alp-dir
}
@test "podman save to directory with compression" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save --compress --format docker-dir -o alp-dir $ALPINE
echo "$output"
[ "$status" -eq 0 ]
rm -rf alp-dir
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save --format docker-dir --compress -o alp-dir $ALPINE
echo "$output"
[ "$status" -eq 0 ]
rm -rf alp-dir
}

View File

@ -1,43 +0,0 @@
#!/usr/bin/env bats
load helpers
function teardown() {
cleanup_test
}
function setup() {
copy_images
}
@test "podman tag with shortname:latest" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} tag ${ALPINE} foobar:latest
[ "$status" -eq 0 ]
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect foobar:latest
echo "$output"
[ "$status" -eq 0 ]
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi --force foobar:latest
[ "$status" -eq 0 ]
}
@test "podman tag with shortname" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} tag ${ALPINE} foobar
echo "$output"
[ "$status" -eq 0 ]
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect foobar:latest
echo "$output"
[ "$status" -eq 0 ]
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi --force foobar:latest
[ "$status" -eq 0 ]
}
@test "podman tag with shortname:tag" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} tag ${ALPINE} foobar:v
echo "$output"
[ "$status" -eq 0 ]
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect foobar:v
echo "$output"
[ "$status" -eq 0 ]
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi --force foobar:v
[ "$status" -eq 0 ]
}

View File

@ -1,13 +0,0 @@
#!/usr/bin/env bats
load helpers
function teardown() {
cleanup_test
}
@test "podman version test" {
run ${PODMAN_BINARY} version
echo "$output"
[ "$status" -eq 0 ]
}