summaryrefslogtreecommitdiff
path: root/pkg/bindings/test/containers_test.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-03-02 20:23:26 +0100
committerGitHub <noreply@github.com>2020-03-02 20:23:26 +0100
commit47c4ea39196cedac87e7a4e4c1ead54ed9d7ed50 (patch)
tree64ce3ceb630aaecf993b1747bf8ba7f3f3af170f /pkg/bindings/test/containers_test.go
parentf9a476833bc8461dd246db0b31f542ad4a6d7587 (diff)
parent09048731000e73b44a0243a0339d8c122eb8a165 (diff)
downloadpodman-47c4ea39196cedac87e7a4e4c1ead54ed9d7ed50.tar.gz
podman-47c4ea39196cedac87e7a4e4c1ead54ed9d7ed50.tar.bz2
podman-47c4ea39196cedac87e7a4e4c1ead54ed9d7ed50.zip
Merge pull request #5347 from baude/apiv2wait
rework apiv2 wait endpoint|binding
Diffstat (limited to 'pkg/bindings/test/containers_test.go')
-rw-r--r--pkg/bindings/test/containers_test.go57
1 files changed, 57 insertions, 0 deletions
diff --git a/pkg/bindings/test/containers_test.go b/pkg/bindings/test/containers_test.go
index 5a0bdebe6..299a78ac2 100644
--- a/pkg/bindings/test/containers_test.go
+++ b/pkg/bindings/test/containers_test.go
@@ -250,4 +250,61 @@ var _ = Describe("Podman containers ", func() {
Expect(isStopped(data.State.Status)).To(BeTrue())
})
+ It("podman wait no condition", func() {
+ var (
+ name = "top"
+ exitCode int32 = -1
+ )
+ _, err := containers.Wait(connText, "foobar", nil)
+ Expect(err).ToNot(BeNil())
+ code, _ := bindings.CheckResponseCode(err)
+ Expect(code).To(BeNumerically("==", http.StatusNotFound))
+
+ errChan := make(chan error)
+ bt.RunTopContainer(&name, nil, nil)
+ go func() {
+ exitCode, err = containers.Wait(connText, name, nil)
+ errChan <- err
+ close(errChan)
+ }()
+ err = containers.Stop(connText, name, nil)
+ Expect(err).To(BeNil())
+ wait := <-errChan
+ Expect(wait).To(BeNil())
+ Expect(exitCode).To(BeNumerically("==", 143))
+ })
+
+ It("podman wait to pause|unpause condition", func() {
+ var (
+ name = "top"
+ exitCode int32 = -1
+ pause = "paused"
+ unpause = "running"
+ )
+ errChan := make(chan error)
+ bt.RunTopContainer(&name, nil, nil)
+ go func() {
+ exitCode, err = containers.Wait(connText, name, &pause)
+ errChan <- err
+ close(errChan)
+ }()
+ err := containers.Pause(connText, name)
+ Expect(err).To(BeNil())
+ wait := <-errChan
+ Expect(wait).To(BeNil())
+ Expect(exitCode).To(BeNumerically("==", -1))
+
+ errChan = make(chan error)
+ go func() {
+ exitCode, err = containers.Wait(connText, name, &unpause)
+ errChan <- err
+ close(errChan)
+ }()
+ err = containers.Unpause(connText, name)
+ Expect(err).To(BeNil())
+ unPausewait := <-errChan
+ Expect(unPausewait).To(BeNil())
+ Expect(exitCode).To(BeNumerically("==", -1))
+ })
+
})