Files
podman/pkg/bindings/test/create_test.go
Matt Heon 34166fc004 Bump Go version to v6
Tremendous amount of changes in here, but all should amount to
the same thing: changing Go import paths from v5 to v6.

Also bumped go.mod to github.com/containers/podman/v6 and updated
version to v6.0.0-dev.

Signed-off-by: Matt Heon <mheon@redhat.com>
2025-10-23 11:00:15 -04:00

52 lines
1.2 KiB
Go

package bindings_test
import (
"time"
"github.com/containers/podman/v6/pkg/bindings/containers"
"github.com/containers/podman/v6/pkg/specgen"
. "github.com/onsi/ginkgo/v2"
. "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).ToNot(HaveOccurred())
})
AfterEach(func() {
s.Kill()
bt.cleanup()
})
It("create a container running top", func() {
s := specgen.NewSpecGenerator(alpine.name, false)
s.Command = []string{"top"}
terminal := true
s.Terminal = &terminal
s.Name = "top"
ctr, err := containers.CreateWithSpec(bt.conn, s, nil)
Expect(err).ToNot(HaveOccurred())
data, err := containers.Inspect(bt.conn, ctr.ID, nil)
Expect(err).ToNot(HaveOccurred())
Expect(data.Name).To(Equal("top"))
err = containers.Start(bt.conn, ctr.ID, nil)
Expect(err).ToNot(HaveOccurred())
data, err = containers.Inspect(bt.conn, ctr.ID, nil)
Expect(err).ToNot(HaveOccurred())
Expect(data.State.Status).To(Equal("running"))
})
})