Files
podman/pkg/bindings/test/create_test.go
Valentin Rothberg bd09b7aa79 bump go module to version 4
Automated for .go files via gomove [1]:
`gomove github.com/containers/podman/v3 github.com/containers/podman/v4`

Remaining files via vgrep [2]:
`vgrep github.com/containers/podman/v3`

[1] https://github.com/KSubedi/gomove
[2] https://github.com/vrothberg/vgrep

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-18 12:47:07 +01:00

51 lines
1.1 KiB
Go

package bindings_test
import (
"time"
"github.com/containers/podman/v4/pkg/bindings/containers"
"github.com/containers/podman/v4/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, false)
s.Command = []string{"top"}
s.Terminal = true
s.Name = "top"
ctr, err := containers.CreateWithSpec(bt.conn, s, nil)
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"))
})
})