diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-03-07 14:16:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-07 14:16:43 +0100 |
commit | c8de26fb0835bb3572af250088d4f66a3162ccd0 (patch) | |
tree | 9fa5f0d4b6f2591b5809dd23d0349d984f630db7 /pkg/bindings/test/create_test.go | |
parent | 43bf4f6626cc25ab839d989c025771de4669f86b (diff) | |
parent | 8b5e2a6297e6f6a5426551d1648278906a9d23de (diff) | |
download | podman-c8de26fb0835bb3572af250088d4f66a3162ccd0.tar.gz podman-c8de26fb0835bb3572af250088d4f66a3162ccd0.tar.bz2 podman-c8de26fb0835bb3572af250088d4f66a3162ccd0.zip |
Merge pull request #5374 from baude/create
add default network for apiv2 create
Diffstat (limited to 'pkg/bindings/test/create_test.go')
-rw-r--r-- | pkg/bindings/test/create_test.go | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/pkg/bindings/test/create_test.go b/pkg/bindings/test/create_test.go new file mode 100644 index 000000000..f83a9b14d --- /dev/null +++ b/pkg/bindings/test/create_test.go @@ -0,0 +1,50 @@ +package test_bindings + +import ( + "time" + + "github.com/containers/libpod/pkg/bindings/containers" + "github.com/containers/libpod/pkg/specgen" + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gexec" +) + +var _ = Describe("Create containers ", func() { + var ( + bt *bindingTest + s *gexec.Session + ) + + BeforeEach(func() { + bt = newBindingTest() + bt.RestoreImagesFromCache() + s = bt.startAPIService() + time.Sleep(1 * time.Second) + err := bt.NewConnection() + Expect(err).To(BeNil()) + }) + + AfterEach(func() { + s.Kill() + bt.cleanup() + }) + + It("create a container running top", func() { + s := specgen.NewSpecGenerator(alpine.name) + s.Command = []string{"top"} + s.Terminal = true + s.Name = "top" + ctr, err := containers.CreateWithSpec(bt.conn, s) + Expect(err).To(BeNil()) + data, err := containers.Inspect(bt.conn, ctr.ID, nil) + Expect(err).To(BeNil()) + Expect(data.Name).To(Equal("top")) + err = containers.Start(bt.conn, ctr.ID, nil) + Expect(err).To(BeNil()) + data, err = containers.Inspect(bt.conn, ctr.ID, nil) + Expect(err).To(BeNil()) + Expect(data.State.Status).To(Equal("running")) + }) + +}) |