summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/bin2img/bin2img.go12
-rw-r--r--test/copyimg/copyimg.go8
-rw-r--r--test/e2e/diff_test.go21
-rw-r--r--test/e2e/libpod_suite_test.go22
-rw-r--r--test/e2e/push_test.go2
-rw-r--r--test/e2e/restart_test.go56
-rw-r--r--test/e2e/rmi_test.go2
-rw-r--r--test/e2e/run_test.go23
-rw-r--r--test/e2e/search_test.go8
-rw-r--r--test/varlink/run_varlink_tests.sh37
-rw-r--r--test/varlink/test_containers.py99
-rw-r--r--test/varlink/test_images.py71
-rw-r--r--test/varlink/test_system.py21
13 files changed, 358 insertions, 24 deletions
diff --git a/test/bin2img/bin2img.go b/test/bin2img/bin2img.go
index b5be8615a..644832c77 100644
--- a/test/bin2img/bin2img.go
+++ b/test/bin2img/bin2img.go
@@ -3,6 +3,7 @@ package main
import (
"archive/tar"
"bytes"
+ "context"
"encoding/json"
"io"
"os"
@@ -148,13 +149,14 @@ func main() {
logrus.Errorf("error parsing image name: %v", err)
os.Exit(1)
}
- img, err := ref.NewImageDestination(nil)
+ ctx := context.TODO()
+ img, err := ref.NewImageDestination(ctx, nil)
if err != nil {
logrus.Errorf("error preparing to write image: %v", err)
os.Exit(1)
}
defer img.Close()
- layer, err := img.PutBlob(layerBuffer, layerInfo, false)
+ layer, err := img.PutBlob(ctx, layerBuffer, layerInfo, false)
if err != nil {
logrus.Errorf("error preparing to write image: %v", err)
os.Exit(1)
@@ -182,7 +184,7 @@ func main() {
Digest: digest.Canonical.FromBytes(cbytes),
Size: int64(len(cbytes)),
}
- configInfo, err = img.PutBlob(bytes.NewBuffer(cbytes), configInfo, false)
+ configInfo, err = img.PutBlob(ctx, bytes.NewBuffer(cbytes), configInfo, false)
if err != nil {
logrus.Errorf("error saving configuration: %v", err)
os.Exit(1)
@@ -207,12 +209,12 @@ func main() {
logrus.Errorf("error encoding manifest: %v", err)
os.Exit(1)
}
- err = img.PutManifest(mbytes)
+ err = img.PutManifest(ctx, mbytes)
if err != nil {
logrus.Errorf("error saving manifest: %v", err)
os.Exit(1)
}
- err = img.Commit()
+ err = img.Commit(ctx)
if err != nil {
logrus.Errorf("error committing image: %v", err)
os.Exit(1)
diff --git a/test/copyimg/copyimg.go b/test/copyimg/copyimg.go
index f83f92766..26100beea 100644
--- a/test/copyimg/copyimg.go
+++ b/test/copyimg/copyimg.go
@@ -1,6 +1,7 @@
package main
import (
+ "context"
"os"
"github.com/containers/image/copy"
@@ -156,9 +157,10 @@ func main() {
}
}
+ ctx := context.TODO()
if imageName != "" {
if importFrom != "" {
- err = copy.Image(policyContext, ref, importRef, options)
+ err = copy.Image(ctx, policyContext, ref, importRef, options)
if err != nil {
logrus.Errorf("error importing %s: %v", importFrom, err)
os.Exit(1)
@@ -178,7 +180,7 @@ func main() {
}
}
if exportTo != "" {
- err = copy.Image(policyContext, exportRef, ref, options)
+ err = copy.Image(ctx, policyContext, exportRef, ref, options)
if err != nil {
logrus.Errorf("error exporting %s: %v", exportTo, err)
os.Exit(1)
@@ -186,7 +188,7 @@ func main() {
}
} else {
if importFrom != "" && exportTo != "" {
- err = copy.Image(policyContext, exportRef, importRef, options)
+ err = copy.Image(ctx, policyContext, exportRef, importRef, options)
if err != nil {
logrus.Errorf("error copying %s to %s: %v", importFrom, exportTo, err)
os.Exit(1)
diff --git a/test/e2e/diff_test.go b/test/e2e/diff_test.go
index eca485c8b..319f086cd 100644
--- a/test/e2e/diff_test.go
+++ b/test/e2e/diff_test.go
@@ -2,6 +2,7 @@ package integration
import (
"os"
+ "sort"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -47,4 +48,24 @@ var _ = Describe("Podman diff", func() {
Expect(session.ExitCode()).To(Equal(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
})
+
+ It("podman diff container and committed image", func() {
+ session := podmanTest.Podman([]string{"run", "--name=diff-test", ALPINE, "touch", "/tmp/diff-test"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"diff", "diff-test"})
+ session.WaitWithDefaultTimeout()
+ containerDiff := session.OutputToStringArray()
+ sort.Strings(containerDiff)
+ Expect(session.LineInOutputContains("C /tmp")).To(BeTrue())
+ Expect(session.LineInOutputContains("A /tmp/diff-test")).To(BeTrue())
+ session = podmanTest.Podman([]string{"commit", "diff-test", "diff-test-img"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"diff", "diff-test-img"})
+ session.WaitWithDefaultTimeout()
+ imageDiff := session.OutputToStringArray()
+ sort.Strings(imageDiff)
+ Expect(imageDiff).To(Equal(containerDiff))
+ })
})
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index fa48334a3..1383b5a19 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -1,6 +1,7 @@
package integration
import (
+ "context"
"fmt"
"io/ioutil"
"os"
@@ -12,6 +13,7 @@ import (
"time"
"encoding/json"
+
"github.com/containers/image/copy"
"github.com/containers/image/signature"
"github.com/containers/image/storage"
@@ -109,7 +111,6 @@ var _ = BeforeSuite(func() {
}
}
for _, image := range CACHE_IMAGES {
- fmt.Printf("Caching %s...\n", image)
if err := podman.CreateArtifact(image); err != nil {
fmt.Printf("%q\n", err)
os.Exit(1)
@@ -298,6 +299,10 @@ func (p *PodmanTest) SystemExec(command string, args []string) *PodmanSession {
// CreateArtifact creates a cached image in the artifact dir
func (p *PodmanTest) CreateArtifact(image string) error {
+ if os.Getenv("NO_TEST_CACHE") != "" {
+ return nil
+ }
+ fmt.Printf("Caching %s...\n", image)
imageName := fmt.Sprintf("docker://%s", image)
systemContext := types.SystemContext{
SignaturePolicyPath: p.SignaturePolicyPath,
@@ -327,9 +332,7 @@ func (p *PodmanTest) CreateArtifact(image string) error {
return errors.Errorf("error parsing image name %v: %v", exportTo, err)
}
- return copy.Image(policyContext, exportRef, importRef, options)
-
- return nil
+ return copy.Image(getTestContext(), policyContext, exportRef, importRef, options)
}
// RestoreArtifact puts the cached image into our test store
@@ -378,7 +381,7 @@ func (p *PodmanTest) RestoreArtifact(image string) error {
}()
options := &copy.Options{}
- err = copy.Image(policyContext, ref, importRef, options)
+ err = copy.Image(getTestContext(), policyContext, ref, importRef, options)
if err != nil {
return errors.Errorf("error importing %s: %v", importFrom, err)
}
@@ -387,6 +390,9 @@ func (p *PodmanTest) RestoreArtifact(image string) error {
// RestoreAllArtifacts unpacks all cached images
func (p *PodmanTest) RestoreAllArtifacts() error {
+ if os.Getenv("NO_TEST_CACHE") != "" {
+ return nil
+ }
for _, image := range RESTORE_IMAGES {
if err := p.RestoreArtifact(image); err != nil {
return err
@@ -487,7 +493,7 @@ func (s *PodmanSession) LineInOuputStartsWith(term string) bool {
//LineInOutputContains returns true if a line in a
// session output starts with the supplied string
-func (s *PodmanSession) LineInOuputContains(term string) bool {
+func (s *PodmanSession) LineInOutputContains(term string) bool {
for _, i := range s.OutputToStringArray() {
if strings.Contains(i, term) {
return true
@@ -622,3 +628,7 @@ func IsCommandAvailable(command string) bool {
}
return true
}
+
+func getTestContext() context.Context {
+ return context.Background()
+}
diff --git a/test/e2e/push_test.go b/test/e2e/push_test.go
index 5267a66a4..46ec4ccbd 100644
--- a/test/e2e/push_test.go
+++ b/test/e2e/push_test.go
@@ -154,7 +154,7 @@ var _ = Describe("Podman push", func() {
setup := podmanTest.SystemExec("bash", []string{"-c", "systemctl status docker 2>&1"})
setup.WaitWithDefaultTimeout()
- if setup.LineInOuputContains("Active: inactive") {
+ if setup.LineInOutputContains("Active: inactive") {
setup = podmanTest.SystemExec("systemctl", []string{"start", "docker"})
setup.WaitWithDefaultTimeout()
diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go
index ea03d022f..812ba5ac9 100644
--- a/test/e2e/restart_test.go
+++ b/test/e2e/restart_test.go
@@ -2,6 +2,7 @@ package integration
import (
"os"
+ "time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -36,10 +37,15 @@ var _ = Describe("Podman restart", func() {
It("Podman restart stopped container by name", func() {
_, exitCode, _ := podmanTest.RunLsContainer("test1")
Expect(exitCode).To(Equal(0))
+ startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1"})
+ startTime.WaitWithDefaultTimeout()
session := podmanTest.Podman([]string{"restart", "test1"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
+ restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1"})
+ restartTime.WaitWithDefaultTimeout()
+ Expect(restartTime.OutputToString()).To(Not(Equal(startTime.OutputToString())))
})
It("Podman restart stopped container by ID", func() {
@@ -47,6 +53,8 @@ var _ = Describe("Podman restart", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
cid := session.OutputToString()
+ startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", cid})
+ startTime.WaitWithDefaultTimeout()
startSession := podmanTest.Podman([]string{"start", cid})
startSession.WaitWithDefaultTimeout()
@@ -55,16 +63,24 @@ var _ = Describe("Podman restart", func() {
session2 := podmanTest.Podman([]string{"restart", cid})
session2.WaitWithDefaultTimeout()
Expect(session2.ExitCode()).To(Equal(0))
+ restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", cid})
+ restartTime.WaitWithDefaultTimeout()
+ Expect(restartTime.OutputToString()).To(Not(Equal(startTime.OutputToString())))
})
It("Podman restart running container", func() {
_ = podmanTest.RunTopContainer("test1")
ok := WaitForContainer(&podmanTest)
Expect(ok).To(BeTrue())
+ startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1"})
+ startTime.WaitWithDefaultTimeout()
- session := podmanTest.Podman([]string{"restart", "--latest"})
+ session := podmanTest.Podman([]string{"restart", "test1"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
+ restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1"})
+ restartTime.WaitWithDefaultTimeout()
+ Expect(restartTime.OutputToString()).To(Not(Equal(startTime.OutputToString())))
})
It("Podman restart multiple containers", func() {
@@ -73,9 +89,47 @@ var _ = Describe("Podman restart", func() {
_, exitCode, _ = podmanTest.RunLsContainer("test2")
Expect(exitCode).To(Equal(0))
+ startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
+ startTime.WaitWithDefaultTimeout()
session := podmanTest.Podman([]string{"restart", "test1", "test2"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
+ restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
+ restartTime.WaitWithDefaultTimeout()
+ Expect(restartTime.OutputToStringArray()[0]).To(Not(Equal(startTime.OutputToStringArray()[0])))
+ Expect(restartTime.OutputToStringArray()[1]).To(Not(Equal(startTime.OutputToStringArray()[1])))
+ })
+
+ It("Podman restart the latest container", func() {
+ _, exitCode, _ := podmanTest.RunLsContainer("test1")
+ Expect(exitCode).To(Equal(0))
+
+ _, exitCode, _ = podmanTest.RunLsContainer("test2")
+ Expect(exitCode).To(Equal(0))
+
+ startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
+ startTime.WaitWithDefaultTimeout()
+
+ session := podmanTest.Podman([]string{"restart", "-l"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
+ restartTime.WaitWithDefaultTimeout()
+ Expect(restartTime.OutputToStringArray()[0]).To(Equal(startTime.OutputToStringArray()[0]))
+ Expect(restartTime.OutputToStringArray()[1]).To(Not(Equal(startTime.OutputToStringArray()[1])))
+ })
+
+ It("Podman restart non-stop container with short timeout", func() {
+ session := podmanTest.Podman([]string{"run", "-d", "--name", "test1", "--env", "STOPSIGNAL=SIGKILL", ALPINE, "sleep", "999"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ startTime := time.Now()
+ session = podmanTest.Podman([]string{"restart", "-t", "2", "test1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ timeSince := time.Since(startTime)
+ Expect(timeSince < 10*time.Second).To(BeTrue())
+ Expect(timeSince > 2*time.Second).To(BeTrue())
})
})
diff --git a/test/e2e/rmi_test.go b/test/e2e/rmi_test.go
index 67ccc1b95..43fe84157 100644
--- a/test/e2e/rmi_test.go
+++ b/test/e2e/rmi_test.go
@@ -80,7 +80,7 @@ var _ = Describe("Podman rmi", func() {
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
- Expect(result.LineInOuputContains(setup.OutputToString())).To(BeTrue())
+ Expect(result.LineInOutputContains(setup.OutputToString())).To(BeTrue())
})
It("podman rmi image with tags by ID cannot be done without force", func() {
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index 94a1fef57..501434852 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -302,6 +302,20 @@ var _ = Describe("Podman run", func() {
Expect(err).To(BeNil())
})
+ It("podman run with FIPS mode secrets", func() {
+ fipsFile := "/etc/system-fips"
+ err = ioutil.WriteFile(fipsFile, []byte{}, 0755)
+ Expect(err).To(BeNil())
+
+ session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "ls", "/run/secrets"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring("system-fips"))
+
+ err = os.Remove(fipsFile)
+ Expect(err).To(BeNil())
+ })
+
It("podman run without group-add", func() {
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "id"})
session.WaitWithDefaultTimeout()
@@ -316,11 +330,14 @@ var _ = Describe("Podman run", func() {
Expect(session.OutputToString()).To(Equal("uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),18(audio),20(dialout),26(tape),27(video),777,65533(nogroup)"))
})
- It("podman run with attach stdin has no output", func() {
- session := podmanTest.Podman([]string{"run", "--rm", "--attach", "stdin", ALPINE, "printenv"})
+ It("podman run with attach stdin outputs container ID", func() {
+ session := podmanTest.Podman([]string{"run", "--attach", "stdin", ALPINE, "printenv"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.OutputToString()).To(Equal(""))
+ ps := podmanTest.Podman([]string{"ps", "-aq", "--no-trunc"})
+ ps.WaitWithDefaultTimeout()
+ Expect(ps.ExitCode()).To(Equal(0))
+ Expect(ps.LineInOutputContains(session.OutputToString())).To(BeTrue())
})
It("podman run with attach stdout does not print stderr", func() {
diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go
index fbe5a4580..5f3dd1068 100644
--- a/test/e2e/search_test.go
+++ b/test/e2e/search_test.go
@@ -32,14 +32,14 @@ var _ = Describe("Podman search", func() {
search.WaitWithDefaultTimeout()
Expect(search.ExitCode()).To(Equal(0))
Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 1))
- Expect(search.LineInOuputContains("docker.io/library/alpine")).To(BeTrue())
+ Expect(search.LineInOutputContains("docker.io/library/alpine")).To(BeTrue())
})
It("podman search registry flag", func() {
search := podmanTest.Podman([]string{"search", "--registry", "registry.fedoraproject.org", "fedora-minimal"})
search.WaitWithDefaultTimeout()
Expect(search.ExitCode()).To(Equal(0))
- Expect(search.LineInOuputContains("fedoraproject.org/fedora-minimal")).To(BeTrue())
+ Expect(search.LineInOutputContains("fedoraproject.org/fedora-minimal")).To(BeTrue())
})
It("podman search format flag", func() {
@@ -47,7 +47,7 @@ var _ = Describe("Podman search", func() {
search.WaitWithDefaultTimeout()
Expect(search.ExitCode()).To(Equal(0))
Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 1))
- Expect(search.LineInOuputContains("docker.io/library/alpine")).To(BeTrue())
+ Expect(search.LineInOutputContains("docker.io/library/alpine")).To(BeTrue())
})
It("podman search no-trunc flag", func() {
@@ -55,7 +55,7 @@ var _ = Describe("Podman search", func() {
search.WaitWithDefaultTimeout()
Expect(search.ExitCode()).To(Equal(0))
Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 1))
- Expect(search.LineInOuputContains("docker.io/library/alpine")).To(BeTrue())
+ Expect(search.LineInOutputContains("docker.io/library/alpine")).To(BeTrue())
})
It("podman search limit flag", func() {
diff --git a/test/varlink/run_varlink_tests.sh b/test/varlink/run_varlink_tests.sh
new file mode 100644
index 000000000..9c247fec2
--- /dev/null
+++ b/test/varlink/run_varlink_tests.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+set -x
+if [ ! -n "${PYTHON+ }" ]; then
+ if hash python3 > /dev/null 2>&1 /dev/null; then
+ PYTHON=$(hash -t python3)
+ elif type python3 > /dev/null 2>&1; then
+ PYTHON=$(type python3 | awk '{print $3}')
+ elif hash python2 > /dev/null 2>&1; then
+ PYTHON=$(hash -t python2)
+ elif type python2 > /dev/null 2>&1; then
+ PYTHON=$(type python2 | awk '{print $3}')
+ else
+ PYTHON='/usr/bin/python'
+ fi
+fi
+
+# Create temporary directory for storage
+TMPSTORAGE=`mktemp -d`
+
+# Need a location to store the podman socket
+mkdir /run/podman
+
+# Run podman in background without systemd for test purposes
+bin/podman --storage-driver=vfs --root=${TMPSTORAGE}/crio --runroot=${TMPSTORAGE}/crio-run varlink unix:/run/podman/io.projectatomic.podman&
+
+# Record podman's pid to be killed later
+PODMAN_PID=`echo $!`
+
+# Run tests
+${PYTHON} -m unittest discover -s test/varlink/
+
+# Kill podman
+kill -9 ${PODMAN_PID}
+
+# Clean up
+rm -fr ${TMPSTORAGE}
diff --git a/test/varlink/test_containers.py b/test/varlink/test_containers.py
new file mode 100644
index 000000000..651461d55
--- /dev/null
+++ b/test/varlink/test_containers.py
@@ -0,0 +1,99 @@
+import unittest
+from varlink import (Client, VarlinkError)
+
+
+address = "unix:/run/podman/io.projectatomic.podman"
+client = Client(address=address)
+
+
+def runErrorTest(tfunc):
+ try:
+ tfunc()
+ except VarlinkError as e:
+ return e.error() == "org.varlink.service.MethodNotImplemented"
+ return False
+
+
+class ContainersAPI(unittest.TestCase):
+ def test_ListContainers(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.ListContainers))
+
+ def test_CreateContainer(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.CreateContainer))
+
+ def test_InspecContainer(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.InspectContainer))
+
+ def test_ListContainerProcesses(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.ListContainerProcesses))
+
+ def test_GetContainerLogs(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.GetContainerLogs))
+
+ def test_ListContainerChanges(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.ListContainerChanges))
+
+ def test_ExportContainer(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.ExportContainer))
+
+ def test_GetContainerStats(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.GetContainerStats))
+
+ def test_ResizeContainerTty(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.ResizeContainerTty))
+
+ def test_StartContainer(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.StartContainer))
+
+ def test_RestartContainer(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.RestartContainer))
+
+ def test_KillContainer(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.KillContainer))
+
+ def test_UpdateContainer(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.UpdateContainer))
+
+ def test_RenameContainer(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.RenameContainer))
+
+ def test_PauseContainer(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.PauseContainer))
+
+ def test_UnpauseContainer(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.UnpauseContainer))
+
+ def test_AttachToContainer(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.AttachToContainer))
+
+ def test_WaitContainer(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.WaitContainer))
+
+ def test_RemoveContainer(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.RemoveContainer))
+
+ def test_DeleteContainer(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.DeleteContainer))
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/test/varlink/test_images.py b/test/varlink/test_images.py
new file mode 100644
index 000000000..ef1ab1088
--- /dev/null
+++ b/test/varlink/test_images.py
@@ -0,0 +1,71 @@
+import unittest
+from varlink import (Client, VarlinkError)
+
+
+address = "unix:/run/podman/io.projectatomic.podman"
+client = Client(address=address)
+
+
+def runErrorTest(tfunc):
+ try:
+ tfunc()
+ except VarlinkError as e:
+ return e.error() == "org.varlink.service.MethodNotImplemented"
+ return False
+
+
+class ImagesAPI(unittest.TestCase):
+ def test_ListImages(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.ListImages))
+
+ def test_BuildImage(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.BuildImage))
+
+ def test_CreateImage(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.CreateImage))
+
+ def test_InspectImage(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.InspectImage))
+
+ def test_HistoryImage(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.HistoryImage))
+
+ def test_PushImage(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.PushImage))
+
+ def test_TagImage(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.TagImage))
+
+ def test_RemoveImage(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.TagImage))
+
+ def test_SearchImage(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.SearchImage))
+
+ def test_DeleteUnusedImages(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.DeleteUnusedImages))
+
+ def test_CreateFromContainer(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.CreateFromContainer))
+
+ def test_ImportImage(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.ImportImage))
+
+ def test_ExportImage(self):
+ podman = client.open("io.projectatomic.podman")
+ self.assertTrue(runErrorTest(podman.ExportImage))
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/test/varlink/test_system.py b/test/varlink/test_system.py
new file mode 100644
index 000000000..6180d2068
--- /dev/null
+++ b/test/varlink/test_system.py
@@ -0,0 +1,21 @@
+import unittest
+from varlink import (Client, VarlinkError)
+
+
+address = "unix:/run/podman/io.projectatomic.podman"
+client = Client(address=address)
+
+class SystemAPI(unittest.TestCase):
+ def test_ping(self):
+ podman = client.open("io.projectatomic.podman")
+ response = podman.Ping()
+ self.assertEqual("OK", response["ping"]["message"])
+
+ def test_GetVersion(self):
+ podman = client.open("io.projectatomic.podman")
+ response = podman.GetVersion()
+ for k in ["version", "go_version", "built", "os_arch"]:
+ self.assertTrue(k in response["version"].keys())
+
+if __name__ == '__main__':
+ unittest.main()