mirror of https://github.com/containers/podman.git
ginkgo tests: apply ginkgolinter fixes
I found the ginkgolinter[1] by accident, this looks for not optimal matching and suggest how to do it better. Overall these fixes seem to be all correct and they will give much better error messages when something fails. Check out the repo to see what the linter reports. [1] https://github.com/nunnatsa/ginkgolinter Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
parent
c7827957a4
commit
2ddf1c5cbd
|
@ -26,21 +26,21 @@ var _ = Describe("Podman images", func() {
|
|||
// the test. Otherwise, the registry is not reachable for
|
||||
// currently unknown reasons.
|
||||
registry, err = podmanRegistry.Start()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
bt = newBindingTest()
|
||||
bt.RestoreImagesFromCache()
|
||||
s = bt.startAPIService()
|
||||
time.Sleep(1 * time.Second)
|
||||
err := bt.NewConnection()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
s.Kill()
|
||||
bt.cleanup()
|
||||
err := registry.Stop()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
// Test using credentials.
|
||||
|
@ -52,19 +52,19 @@ var _ = Describe("Podman images", func() {
|
|||
|
||||
// Tag the alpine image and verify it has worked.
|
||||
err = images.Tag(bt.conn, alpine.shortName, imageTag, imageRep, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = images.GetImage(bt.conn, imageRef, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Now push the image.
|
||||
pushOpts := new(images.PushOptions)
|
||||
err = images.Push(bt.conn, imageRef, imageRef, pushOpts.WithUsername(registry.User).WithPassword(registry.Password).WithSkipTLSVerify(true))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Now pull the image.
|
||||
pullOpts := new(images.PullOptions)
|
||||
_, err = images.Pull(bt.conn, imageRef, pullOpts.WithSkipTLSVerify(true).WithPassword(registry.Password).WithUsername(registry.User))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
// Test using authfile.
|
||||
|
@ -76,11 +76,11 @@ var _ = Describe("Podman images", func() {
|
|||
|
||||
// Create a temporary authentication file.
|
||||
tmpFile, err := os.CreateTemp("", "auth.json.")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = tmpFile.Write([]byte{'{', '}'})
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = tmpFile.Close()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
authFilePath := tmpFile.Name()
|
||||
|
||||
|
@ -98,28 +98,28 @@ var _ = Describe("Podman images", func() {
|
|||
Stdout: os.Stdout,
|
||||
}
|
||||
err = auth.Login(bt.conn, &sys, &loginOptions, []string{imageRep})
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Tag the alpine image and verify it has worked.
|
||||
err = images.Tag(bt.conn, alpine.shortName, imageTag, imageRep, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = images.GetImage(bt.conn, imageRef, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Now push the image.
|
||||
pushOpts := new(images.PushOptions)
|
||||
err = images.Push(bt.conn, imageRef, imageRef, pushOpts.WithAuthfile(authFilePath).WithSkipTLSVerify(true))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Now pull the image.
|
||||
pullOpts := new(images.PullOptions)
|
||||
_, err = images.Pull(bt.conn, imageRef, pullOpts.WithAuthfile(authFilePath).WithSkipTLSVerify(true))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Last, but not least, exercise search.
|
||||
searchOptions := new(images.SearchOptions)
|
||||
_, err = images.Search(bt.conn, imageRef, searchOptions.WithSkipTLSVerify(true).WithAuthfile(authFilePath))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
})
|
||||
|
|
|
@ -23,7 +23,7 @@ var _ = Describe("Podman connection", func() {
|
|||
s = bt.startAPIService()
|
||||
time.Sleep(1 * time.Second)
|
||||
err := bt.NewConnection()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
|
@ -41,7 +41,7 @@ var _ = Describe("Podman connection", func() {
|
|||
It("cancel request in flight reports cancelled context", func() {
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
errChan := make(chan error)
|
||||
ctx, cancel := context.WithCancel(bt.conn)
|
||||
|
|
|
@ -28,7 +28,7 @@ var _ = Describe("Podman containers ", func() {
|
|||
s = bt.startAPIService()
|
||||
time.Sleep(1 * time.Second)
|
||||
err := bt.NewConnection()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
|
@ -39,7 +39,7 @@ var _ = Describe("Podman containers ", func() {
|
|||
It("podman pause a bogus container", func() {
|
||||
// Pausing bogus container should return 404
|
||||
err = containers.Pause(bt.conn, "foobar", nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusNotFound))
|
||||
})
|
||||
|
@ -47,7 +47,7 @@ var _ = Describe("Podman containers ", func() {
|
|||
It("podman unpause a bogus container", func() {
|
||||
// Unpausing bogus container should return 404
|
||||
err = containers.Unpause(bt.conn, "foobar", nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusNotFound))
|
||||
})
|
||||
|
@ -56,13 +56,13 @@ var _ = Describe("Podman containers ", func() {
|
|||
// Pausing by name should work
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Pause(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Ensure container is paused
|
||||
data, err := containers.Inspect(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(data.State.Status).To(Equal("paused"))
|
||||
})
|
||||
|
||||
|
@ -70,13 +70,13 @@ var _ = Describe("Podman containers ", func() {
|
|||
// Pausing by id should work
|
||||
var name = "top"
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Pause(bt.conn, cid, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Ensure container is paused
|
||||
data, err := containers.Inspect(bt.conn, cid, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(data.State.Status).To(Equal("paused"))
|
||||
})
|
||||
|
||||
|
@ -84,15 +84,15 @@ var _ = Describe("Podman containers ", func() {
|
|||
// Unpausing by name should work
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Pause(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Unpause(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Ensure container is unpaused
|
||||
data, err := containers.Inspect(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(data.State.Status).To(Equal("running"))
|
||||
})
|
||||
|
||||
|
@ -100,19 +100,19 @@ var _ = Describe("Podman containers ", func() {
|
|||
// Unpausing by ID should work
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Pause by name
|
||||
err = containers.Pause(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil(), "error from containers.Pause()")
|
||||
Expect(err).ToNot(HaveOccurred(), "error from containers.Pause()")
|
||||
// paused := "paused"
|
||||
// _, err = containers.Wait(bt.conn, cid, &paused)
|
||||
// Expect(err).To(BeNil())
|
||||
err = containers.Unpause(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Ensure container is unpaused
|
||||
data, err := containers.Inspect(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(data.State.Status).To(Equal("running"))
|
||||
})
|
||||
|
||||
|
@ -120,11 +120,11 @@ var _ = Describe("Podman containers ", func() {
|
|||
// Pausing a paused container by name should fail
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Pause(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Pause(bt.conn, name, nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
})
|
||||
|
@ -133,11 +133,11 @@ var _ = Describe("Podman containers ", func() {
|
|||
// Pausing a paused container by id should fail
|
||||
var name = "top"
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Pause(bt.conn, cid, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Pause(bt.conn, cid, nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
})
|
||||
|
@ -146,11 +146,11 @@ var _ = Describe("Podman containers ", func() {
|
|||
// Pausing a stopped container by name should fail
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Stop(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Pause(bt.conn, name, nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
})
|
||||
|
@ -159,11 +159,11 @@ var _ = Describe("Podman containers ", func() {
|
|||
// Pausing a stopped container by id should fail
|
||||
var name = "top"
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Stop(bt.conn, cid, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Pause(bt.conn, cid, nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
})
|
||||
|
@ -172,11 +172,11 @@ var _ = Describe("Podman containers ", func() {
|
|||
// Removing a paused container without force should fail
|
||||
var name = "top"
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Pause(bt.conn, cid, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = containers.Remove(bt.conn, cid, nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
})
|
||||
|
@ -185,24 +185,24 @@ var _ = Describe("Podman containers ", func() {
|
|||
// Removing a paused container with force should work
|
||||
var name = "top"
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Pause(bt.conn, cid, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
rmResponse, err := containers.Remove(bt.conn, cid, new(containers.RemoveOptions).WithForce(true))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(reports.RmReportsErrs(rmResponse))).To(Equal(0))
|
||||
Expect(len(reports.RmReportsIds(rmResponse))).To(Equal(1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(reports.RmReportsErrs(rmResponse)).To(BeEmpty())
|
||||
Expect(reports.RmReportsIds(rmResponse)).To(HaveLen(1))
|
||||
})
|
||||
|
||||
It("podman stop a paused container by name", func() {
|
||||
// Stopping a paused container by name should fail
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Pause(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Stop(bt.conn, name, nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
})
|
||||
|
@ -211,11 +211,11 @@ var _ = Describe("Podman containers ", func() {
|
|||
// Stopping a paused container by id should fail
|
||||
var name = "top"
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Pause(bt.conn, cid, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Stop(bt.conn, cid, nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
})
|
||||
|
@ -224,13 +224,13 @@ var _ = Describe("Podman containers ", func() {
|
|||
// Stopping a running container by name should work
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Stop(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Ensure container is stopped
|
||||
data, err := containers.Inspect(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(isStopped(data.State.Status)).To(BeTrue())
|
||||
})
|
||||
|
||||
|
@ -238,13 +238,13 @@ var _ = Describe("Podman containers ", func() {
|
|||
// Stopping a running container by ID should work
|
||||
var name = "top"
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Stop(bt.conn, cid, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Ensure container is stopped
|
||||
data, err := containers.Inspect(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(isStopped(data.State.Status)).To(BeTrue())
|
||||
})
|
||||
|
||||
|
@ -254,13 +254,13 @@ var _ = Describe("Podman containers ", func() {
|
|||
exitCode int32 = -1
|
||||
)
|
||||
_, err := containers.Wait(bt.conn, "foobar", nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusNotFound))
|
||||
|
||||
errChan := make(chan error)
|
||||
_, err = bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
go func() {
|
||||
defer GinkgoRecover()
|
||||
exitCode, err = containers.Wait(bt.conn, name, nil)
|
||||
|
@ -268,9 +268,9 @@ var _ = Describe("Podman containers ", func() {
|
|||
close(errChan)
|
||||
}()
|
||||
err = containers.Stop(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
wait := <-errChan
|
||||
Expect(wait).To(BeNil())
|
||||
Expect(wait).ToNot(HaveOccurred())
|
||||
Expect(exitCode).To(BeNumerically("==", 143))
|
||||
})
|
||||
|
||||
|
@ -283,7 +283,7 @@ var _ = Describe("Podman containers ", func() {
|
|||
)
|
||||
errChan := make(chan error)
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
go func() {
|
||||
defer GinkgoRecover()
|
||||
exitCode, err = containers.Wait(bt.conn, name, new(containers.WaitOptions).WithCondition([]define.ContainerStatus{pause}))
|
||||
|
@ -291,9 +291,9 @@ var _ = Describe("Podman containers ", func() {
|
|||
close(errChan)
|
||||
}()
|
||||
err = containers.Pause(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
wait := <-errChan
|
||||
Expect(wait).To(BeNil())
|
||||
Expect(wait).ToNot(HaveOccurred())
|
||||
Expect(exitCode).To(BeNumerically("==", -1))
|
||||
|
||||
unpauseErrChan := make(chan error)
|
||||
|
@ -305,9 +305,9 @@ var _ = Describe("Podman containers ", func() {
|
|||
close(unpauseErrChan)
|
||||
}()
|
||||
err = containers.Unpause(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
unPausewait := <-unpauseErrChan
|
||||
Expect(unPausewait).To(BeNil())
|
||||
Expect(unPausewait).ToNot(HaveOccurred())
|
||||
Expect(exitCode).To(BeNumerically("==", -1))
|
||||
})
|
||||
|
||||
|
@ -316,16 +316,16 @@ var _ = Describe("Podman containers ", func() {
|
|||
|
||||
// bogus name should result in 404
|
||||
_, err := containers.RunHealthCheck(bt.conn, "foobar", nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusNotFound))
|
||||
|
||||
// a container that has no healthcheck should be a 409
|
||||
var name = "top"
|
||||
_, err = bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = containers.RunHealthCheck(bt.conn, name, nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ = bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusConflict))
|
||||
|
||||
|
@ -363,12 +363,12 @@ var _ = Describe("Podman containers ", func() {
|
|||
s.Terminal = true
|
||||
s.Command = []string{"date", "-R"}
|
||||
r, err := containers.CreateWithSpec(bt.conn, s, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Start(bt.conn, r.ID, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
_, err = containers.Wait(bt.conn, r.ID, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
opts := new(containers.LogOptions).WithStdout(true).WithFollow(true)
|
||||
go func() {
|
||||
|
@ -386,19 +386,19 @@ var _ = Describe("Podman containers ", func() {
|
|||
It("podman top", func() {
|
||||
var name = "top"
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// By name
|
||||
_, err = containers.Top(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// By id
|
||||
_, err = containers.Top(bt.conn, cid, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// With descriptors
|
||||
output, err := containers.Top(bt.conn, cid, new(containers.TopOptions).WithDescriptors([]string{"user", "pid", "hpid"}))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
header := strings.Split(output[0], "\t")
|
||||
for _, d := range []string{"USER", "PID", "HPID"} {
|
||||
Expect(d).To(BeElementOf(header))
|
||||
|
@ -406,17 +406,17 @@ var _ = Describe("Podman containers ", func() {
|
|||
|
||||
// With bogus ID
|
||||
_, err = containers.Top(bt.conn, "IdoNotExist", nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
|
||||
// With bogus descriptors
|
||||
_, err = containers.Top(bt.conn, cid, new(containers.TopOptions).WithDescriptors([]string{"Me,Neither"}))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman bogus container does not exist in local storage", func() {
|
||||
// Bogus container existence check should fail
|
||||
containerExists, err := containers.Exists(bt.conn, "foobar", nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(containerExists).To(BeFalse())
|
||||
})
|
||||
|
||||
|
@ -424,9 +424,9 @@ var _ = Describe("Podman containers ", func() {
|
|||
// Container existence check by name should work
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
containerExists, err := containers.Exists(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(containerExists).To(BeTrue())
|
||||
})
|
||||
|
||||
|
@ -434,9 +434,9 @@ var _ = Describe("Podman containers ", func() {
|
|||
// Container existence check by ID should work
|
||||
var name = "top"
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
containerExists, err := containers.Exists(bt.conn, cid, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(containerExists).To(BeTrue())
|
||||
})
|
||||
|
||||
|
@ -444,16 +444,16 @@ var _ = Describe("Podman containers ", func() {
|
|||
// Container existence check by short ID should work
|
||||
var name = "top"
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
containerExists, err := containers.Exists(bt.conn, cid[0:12], nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(containerExists).To(BeTrue())
|
||||
})
|
||||
|
||||
It("podman kill bogus container", func() {
|
||||
// Killing bogus container should return 404
|
||||
err := containers.Kill(bt.conn, "foobar", new(containers.KillOptions).WithSignal("SIGTERM"))
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusNotFound))
|
||||
})
|
||||
|
@ -462,40 +462,40 @@ var _ = Describe("Podman containers ", func() {
|
|||
// Killing a running container should work
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Kill(bt.conn, name, new(containers.KillOptions).WithSignal("SIGINT"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = containers.Exists(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman kill a running container by ID with SIGTERM", func() {
|
||||
// Killing a running container by ID should work
|
||||
var name = "top"
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Kill(bt.conn, cid, new(containers.KillOptions).WithSignal("SIGTERM"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = containers.Exists(bt.conn, cid, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman kill a running container by ID with SIGKILL", func() {
|
||||
// Killing a running container by ID with TERM should work
|
||||
var name = "top"
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Kill(bt.conn, cid, new(containers.KillOptions).WithSignal("SIGKILL"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman kill a running container by bogus signal", func() {
|
||||
// Killing a running container by bogus signal should fail
|
||||
var name = "top"
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Kill(bt.conn, cid, new(containers.KillOptions).WithSignal("foobar"))
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
})
|
||||
|
@ -505,18 +505,18 @@ var _ = Describe("Podman containers ", func() {
|
|||
var name1 = "first"
|
||||
var name2 = "second"
|
||||
_, err := bt.RunTopContainer(&name1, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = bt.RunTopContainer(&name2, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
containerLatestList, err := containers.List(bt.conn, new(containers.ListOptions).WithLast(1))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Kill(bt.conn, containerLatestList[0].Names[0], new(containers.KillOptions).WithSignal("SIGTERM"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("container init on a bogus container", func() {
|
||||
err := containers.ContainerInit(bt.conn, "doesnotexist", nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusNotFound))
|
||||
})
|
||||
|
@ -524,110 +524,110 @@ var _ = Describe("Podman containers ", func() {
|
|||
It("container init", func() {
|
||||
s := specgen.NewSpecGenerator(alpine.name, false)
|
||||
ctr, err := containers.CreateWithSpec(bt.conn, s, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.ContainerInit(bt.conn, ctr.ID, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// trying to init again should be an error
|
||||
err = containers.ContainerInit(bt.conn, ctr.ID, nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman prune stopped containers", func() {
|
||||
// Start and stop a container to enter in exited state.
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Stop(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Prune container should return no errors and one pruned container ID.
|
||||
pruneResponse, err := containers.Prune(bt.conn, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(reports.PruneReportsErrs(pruneResponse))).To(Equal(0))
|
||||
Expect(len(reports.PruneReportsIds(pruneResponse))).To(Equal(1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(reports.PruneReportsErrs(pruneResponse)).To(BeEmpty())
|
||||
Expect(reports.PruneReportsIds(pruneResponse)).To(HaveLen(1))
|
||||
})
|
||||
|
||||
It("podman prune stopped containers with filters", func() {
|
||||
// Start and stop a container to enter in exited state.
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Stop(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Invalid filter keys should return error.
|
||||
filtersIncorrect := map[string][]string{
|
||||
"status": {"dummy"},
|
||||
}
|
||||
_, err = containers.Prune(bt.conn, new(containers.PruneOptions).WithFilters(filtersIncorrect))
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
|
||||
// List filter params should not work with prune.
|
||||
filtersIncorrect = map[string][]string{
|
||||
"name": {"top"},
|
||||
}
|
||||
_, err = containers.Prune(bt.conn, new(containers.PruneOptions).WithFilters(filtersIncorrect))
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
|
||||
// Mismatched filter params no container should be pruned.
|
||||
filtersIncorrect = map[string][]string{
|
||||
"label": {"xyz"},
|
||||
}
|
||||
pruneResponse, err := containers.Prune(bt.conn, new(containers.PruneOptions).WithFilters(filtersIncorrect))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(reports.PruneReportsIds(pruneResponse))).To(Equal(0))
|
||||
Expect(len(reports.PruneReportsErrs(pruneResponse))).To(Equal(0))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(reports.PruneReportsIds(pruneResponse)).To(BeEmpty())
|
||||
Expect(reports.PruneReportsErrs(pruneResponse)).To(BeEmpty())
|
||||
|
||||
// Valid filter params container should be pruned now.
|
||||
filters := map[string][]string{
|
||||
"until": {"5000000000"}, // Friday, June 11, 2128
|
||||
}
|
||||
pruneResponse, err = containers.Prune(bt.conn, new(containers.PruneOptions).WithFilters(filters))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(reports.PruneReportsErrs(pruneResponse))).To(Equal(0))
|
||||
Expect(len(reports.PruneReportsIds(pruneResponse))).To(Equal(1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(reports.PruneReportsErrs(pruneResponse)).To(BeEmpty())
|
||||
Expect(reports.PruneReportsIds(pruneResponse)).To(HaveLen(1))
|
||||
})
|
||||
|
||||
It("podman list containers with until filter", func() {
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
filters := map[string][]string{
|
||||
"until": {"5000000000"}, // Friday, June 11, 2128
|
||||
}
|
||||
c, err := containers.List(bt.conn, new(containers.ListOptions).WithFilters(filters).WithAll(true))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(c)).To(Equal(1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(c).To(HaveLen(1))
|
||||
|
||||
filters = map[string][]string{
|
||||
"until": {"500000"}, // Tuesday, January 6, 1970
|
||||
}
|
||||
c, err = containers.List(bt.conn, new(containers.ListOptions).WithFilters(filters).WithAll(true))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(c)).To(Equal(0))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(c).To(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman prune running containers", func() {
|
||||
// Start the container.
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Check if the container is running.
|
||||
data, err := containers.Inspect(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(data.State.Status).To(Equal("running"))
|
||||
|
||||
// Prune. Should return no error no prune response ID.
|
||||
pruneResponse, err := containers.Prune(bt.conn, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(pruneResponse)).To(Equal(0))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pruneResponse).To(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman inspect bogus container", func() {
|
||||
_, err := containers.Inspect(bt.conn, "foobar", nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusNotFound))
|
||||
})
|
||||
|
@ -635,45 +635,45 @@ var _ = Describe("Podman containers ", func() {
|
|||
It("podman inspect running container", func() {
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Inspecting running container should succeed
|
||||
_, err = containers.Inspect(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman inspect stopped container", func() {
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Stop(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Inspecting stopped container should succeed
|
||||
_, err = containers.Inspect(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman inspect running container with size", func() {
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = containers.Inspect(bt.conn, name, new(containers.InspectOptions).WithSize(true))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman inspect stopped container with size", func() {
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Stop(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Inspecting stopped container with size should succeed
|
||||
_, err = containers.Inspect(bt.conn, name, new(containers.InspectOptions).WithSize(true))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman remove bogus container", func() {
|
||||
_, err := containers.Remove(bt.conn, "foobar", nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusNotFound))
|
||||
})
|
||||
|
@ -681,10 +681,10 @@ var _ = Describe("Podman containers ", func() {
|
|||
It("podman remove running container by name", func() {
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Removing running container should fail
|
||||
_, err = containers.Remove(bt.conn, name, nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
})
|
||||
|
@ -692,10 +692,10 @@ var _ = Describe("Podman containers ", func() {
|
|||
It("podman remove running container by ID", func() {
|
||||
var name = "top"
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Removing running container should fail
|
||||
_, err = containers.Remove(bt.conn, cid, nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
})
|
||||
|
@ -703,32 +703,32 @@ var _ = Describe("Podman containers ", func() {
|
|||
It("podman forcibly remove running container by name", func() {
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Removing running container should succeed
|
||||
rmResponse, err := containers.Remove(bt.conn, name, new(containers.RemoveOptions).WithForce(true))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(reports.RmReportsErrs(rmResponse))).To(Equal(0))
|
||||
Expect(len(reports.RmReportsIds(rmResponse))).To(Equal(1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(reports.RmReportsErrs(rmResponse)).To(BeEmpty())
|
||||
Expect(reports.RmReportsIds(rmResponse)).To(HaveLen(1))
|
||||
})
|
||||
|
||||
It("podman forcibly remove running container by ID", func() {
|
||||
var name = "top"
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Forcibly Removing running container should succeed
|
||||
rmResponse, err := containers.Remove(bt.conn, cid, new(containers.RemoveOptions).WithForce(true))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(reports.RmReportsErrs(rmResponse))).To(Equal(0))
|
||||
Expect(len(reports.RmReportsIds(rmResponse))).To(Equal(1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(reports.RmReportsErrs(rmResponse)).To(BeEmpty())
|
||||
Expect(reports.RmReportsIds(rmResponse)).To(HaveLen(1))
|
||||
})
|
||||
|
||||
It("podman remove running container and volume by name", func() {
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Removing running container should fail
|
||||
_, err = containers.Remove(bt.conn, name, new(containers.RemoveOptions).WithVolumes(true))
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
})
|
||||
|
@ -736,10 +736,10 @@ var _ = Describe("Podman containers ", func() {
|
|||
It("podman remove running container and volume by ID", func() {
|
||||
var name = "top"
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Removing running container should fail
|
||||
_, err = containers.Remove(bt.conn, cid, new(containers.RemoveOptions).WithVolumes(true))
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
})
|
||||
|
@ -747,43 +747,43 @@ var _ = Describe("Podman containers ", func() {
|
|||
It("podman forcibly remove running container and volume by name", func() {
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Forcibly Removing running container should succeed
|
||||
rmResponse, err := containers.Remove(bt.conn, name, new(containers.RemoveOptions).WithVolumes(true).WithForce(true))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(reports.RmReportsErrs(rmResponse))).To(Equal(0))
|
||||
Expect(len(reports.RmReportsIds(rmResponse))).To(Equal(1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(reports.RmReportsErrs(rmResponse)).To(BeEmpty())
|
||||
Expect(reports.RmReportsIds(rmResponse)).To(HaveLen(1))
|
||||
})
|
||||
|
||||
It("podman forcibly remove running container and volume by ID", func() {
|
||||
var name = "top"
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Removing running container should fail
|
||||
rmResponse, err := containers.Remove(bt.conn, cid, new(containers.RemoveOptions).WithForce(true).WithVolumes(true))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(reports.RmReportsErrs(rmResponse))).To(Equal(0))
|
||||
Expect(len(reports.RmReportsIds(rmResponse))).To(Equal(1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(reports.RmReportsErrs(rmResponse)).To(BeEmpty())
|
||||
Expect(reports.RmReportsIds(rmResponse)).To(HaveLen(1))
|
||||
})
|
||||
|
||||
It("List containers with filters", func() {
|
||||
var name = "top"
|
||||
var name2 = "top2"
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = bt.RunTopContainer(&name2, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
s := specgen.NewSpecGenerator(alpine.name, false)
|
||||
s.Terminal = true
|
||||
s.Command = []string{"date", "-R"}
|
||||
_, err = containers.CreateWithSpec(bt.conn, s, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Validate list container with id filter
|
||||
filters := make(map[string][]string)
|
||||
filters["id"] = []string{cid}
|
||||
c, err := containers.List(bt.conn, new(containers.ListOptions).WithFilters(filters).WithAll(true))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(c)).To(Equal(1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(c).To(HaveLen(1))
|
||||
})
|
||||
|
||||
It("List containers always includes pod information", func() {
|
||||
|
@ -791,13 +791,13 @@ var _ = Describe("Podman containers ", func() {
|
|||
ctrName := "testctr"
|
||||
bt.Podcreate(&podName)
|
||||
_, err := bt.RunTopContainer(&ctrName, &podName)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
lastNum := 1
|
||||
|
||||
c, err := containers.List(bt.conn, new(containers.ListOptions).WithAll(true).WithLast(lastNum))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(c)).To(Equal(1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(c).To(HaveLen(1))
|
||||
Expect(c[0].PodName).To(Equal(podName))
|
||||
})
|
||||
})
|
||||
|
|
|
@ -22,7 +22,7 @@ var _ = Describe("Create containers ", func() {
|
|||
s = bt.startAPIService()
|
||||
time.Sleep(1 * time.Second)
|
||||
err := bt.NewConnection()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
|
@ -36,14 +36,14 @@ var _ = Describe("Create containers ", func() {
|
|||
s.Terminal = true
|
||||
s.Name = "top"
|
||||
ctr, err := containers.CreateWithSpec(bt.conn, s, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
data, err := containers.Inspect(bt.conn, ctr.ID, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(data.Name).To(Equal("top"))
|
||||
err = containers.Start(bt.conn, ctr.ID, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
data, err = containers.Inspect(bt.conn, ctr.ID, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(data.State.Status).To(Equal("running"))
|
||||
})
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ var _ = Describe("Podman containers exec", func() {
|
|||
s = bt.startAPIService()
|
||||
time.Sleep(1 * time.Second)
|
||||
err := bt.NewConnection()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
|
@ -33,32 +33,32 @@ var _ = Describe("Podman containers exec", func() {
|
|||
It("Podman exec create makes an exec session", func() {
|
||||
name := "testCtr"
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
execConfig := new(handlers.ExecCreateConfig)
|
||||
execConfig.Cmd = []string{"echo", "hello world"}
|
||||
|
||||
sessionID, err := containers.ExecCreate(bt.conn, name, execConfig)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(sessionID).To(Not(Equal("")))
|
||||
|
||||
inspectOut, err := containers.ExecInspect(bt.conn, sessionID, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(inspectOut.ContainerID).To(Equal(cid))
|
||||
Expect(inspectOut.ProcessConfig.Entrypoint).To(Equal("echo"))
|
||||
Expect(len(inspectOut.ProcessConfig.Arguments)).To(Equal(1))
|
||||
Expect(inspectOut.ProcessConfig.Arguments).To(HaveLen(1))
|
||||
Expect(inspectOut.ProcessConfig.Arguments[0]).To(Equal("hello world"))
|
||||
})
|
||||
|
||||
It("Podman exec create with bad command fails", func() {
|
||||
name := "testCtr"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
execConfig := new(handlers.ExecCreateConfig)
|
||||
|
||||
_, err = containers.ExecCreate(bt.conn, name, execConfig)
|
||||
Expect(err).To(Not(BeNil()))
|
||||
Expect(err).To(HaveOccurred())
|
||||
})
|
||||
|
||||
It("Podman exec create with invalid container fails", func() {
|
||||
|
@ -66,11 +66,11 @@ var _ = Describe("Podman containers exec", func() {
|
|||
execConfig.Cmd = []string{"echo", "hello world"}
|
||||
|
||||
_, err := containers.ExecCreate(bt.conn, "doesnotexist", execConfig)
|
||||
Expect(err).To(Not(BeNil()))
|
||||
Expect(err).To(HaveOccurred())
|
||||
})
|
||||
|
||||
It("Podman exec inspect on invalid session fails", func() {
|
||||
_, err := containers.ExecInspect(bt.conn, "0000000000000000000000000000000000000000000000000000000000000000", nil)
|
||||
Expect(err).To(Not(BeNil()))
|
||||
Expect(err).To(HaveOccurred())
|
||||
})
|
||||
})
|
||||
|
|
|
@ -26,8 +26,8 @@ var _ = Describe("Podman API Bindings", func() {
|
|||
}))
|
||||
|
||||
Expect(actual.GetDetachKeys()).To(Equal("Test"))
|
||||
Expect(actual.GetLogs()).To(Equal(true))
|
||||
Expect(actual.GetStream()).To(Equal(false))
|
||||
Expect(actual.GetLogs()).To(BeTrue())
|
||||
Expect(actual.GetStream()).To(BeFalse())
|
||||
})
|
||||
|
||||
It("verify composite setters", func() {
|
||||
|
|
|
@ -56,7 +56,7 @@ var _ = Describe("Podman images", func() {
|
|||
It("inspect image", func() {
|
||||
// Inspect invalid image be 404
|
||||
_, err = images.GetImage(bt.conn, "foobar5000", nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusNotFound))
|
||||
|
||||
|
@ -96,14 +96,14 @@ var _ = Describe("Podman images", func() {
|
|||
// images for performance reasons and for hiding the logic of
|
||||
// deciding which exit code to use from the client.
|
||||
response, errs := images.Remove(bt.conn, []string{"foobar5000"}, nil)
|
||||
Expect(len(errs)).To(BeNumerically(">", 0))
|
||||
Expect(errs).ToNot(BeEmpty())
|
||||
Expect(response.ExitCode).To(BeNumerically("==", 1)) // podman-remote would exit with 1
|
||||
|
||||
// Remove an image by name, validate image is removed and error is nil
|
||||
inspectData, err := images.GetImage(bt.conn, busybox.shortName, nil)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
response, errs = images.Remove(bt.conn, []string{busybox.shortName}, nil)
|
||||
Expect(len(errs)).To(BeZero())
|
||||
Expect(errs).To(BeEmpty())
|
||||
|
||||
Expect(inspectData.ID).To(Equal(response.Deleted[0]))
|
||||
_, err = images.GetImage(bt.conn, busybox.shortName, nil)
|
||||
|
@ -150,7 +150,7 @@ var _ = Describe("Podman images", func() {
|
|||
|
||||
// Validates if invalid image name is given a bad response is encountered.
|
||||
err = images.Tag(bt.conn, "dummy", "demo", alpine.shortName, nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusNotFound))
|
||||
|
||||
|
@ -172,7 +172,7 @@ var _ = Describe("Podman images", func() {
|
|||
Expect(err).ToNot(HaveOccurred())
|
||||
// Since in the begin context two images are created the
|
||||
// list context should have only 2 images
|
||||
Expect(len(imageSummary)).To(Equal(2))
|
||||
Expect(imageSummary).To(HaveLen(2))
|
||||
|
||||
// Adding one more image. There Should be no errors in the response.
|
||||
// And the count should be three now.
|
||||
|
@ -195,13 +195,13 @@ var _ = Describe("Podman images", func() {
|
|||
options := new(images.ListOptions).WithFilters(filters).WithAll(false)
|
||||
filteredImages, err := images.List(bt.conn, options)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(filteredImages)).To(BeNumerically("==", 1))
|
||||
Expect(filteredImages).To(HaveLen(1))
|
||||
|
||||
// List images with a bad filter
|
||||
filters["name"] = []string{alpine.name}
|
||||
options = new(images.ListOptions).WithFilters(filters)
|
||||
_, err = images.List(bt.conn, options)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
})
|
||||
|
@ -226,7 +226,7 @@ var _ = Describe("Podman images", func() {
|
|||
It("Load|Import Image", func() {
|
||||
// load an image
|
||||
_, errs := images.Remove(bt.conn, []string{alpine.name}, nil)
|
||||
Expect(len(errs)).To(BeZero())
|
||||
Expect(errs).To(BeEmpty())
|
||||
exists, err := images.Exists(bt.conn, alpine.name, nil)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(exists).To(BeFalse())
|
||||
|
@ -244,7 +244,7 @@ var _ = Describe("Podman images", func() {
|
|||
f, err = os.Open(filepath.Join(ImageCacheDir, alpine.tarballName))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, errs = images.Remove(bt.conn, []string{alpine.name}, nil)
|
||||
Expect(len(errs)).To(BeZero())
|
||||
Expect(errs).To(BeEmpty())
|
||||
exists, err = images.Exists(bt.conn, alpine.name, nil)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(exists).To(BeFalse())
|
||||
|
@ -254,7 +254,7 @@ var _ = Describe("Podman images", func() {
|
|||
|
||||
// load with a bad repo name should trigger a 500
|
||||
_, errs = images.Remove(bt.conn, []string{alpine.name}, nil)
|
||||
Expect(len(errs)).To(BeZero())
|
||||
Expect(errs).To(BeEmpty())
|
||||
exists, err = images.Exists(bt.conn, alpine.name, nil)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(exists).To(BeFalse())
|
||||
|
@ -277,7 +277,7 @@ var _ = Describe("Podman images", func() {
|
|||
It("Import Image", func() {
|
||||
// load an image
|
||||
_, errs := images.Remove(bt.conn, []string{alpine.name}, nil)
|
||||
Expect(len(errs)).To(BeZero())
|
||||
Expect(errs).To(BeEmpty())
|
||||
exists, err := images.Exists(bt.conn, alpine.name, nil)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(exists).To(BeFalse())
|
||||
|
@ -301,7 +301,7 @@ var _ = Describe("Podman images", func() {
|
|||
It("History Image", func() {
|
||||
// a bogus name should return a 404
|
||||
_, err := images.History(bt.conn, "foobar", nil)
|
||||
Expect(err).To(Not(BeNil()))
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusNotFound))
|
||||
|
||||
|
@ -350,15 +350,15 @@ var _ = Describe("Podman images", func() {
|
|||
|
||||
// Search with a fqdn
|
||||
reports, err = images.Search(bt.conn, "quay.io/libpod/alpine_nginx", nil)
|
||||
Expect(err).To(BeNil(), "Error in images.Search()")
|
||||
Expect(len(reports)).To(BeNumerically(">=", 1))
|
||||
Expect(err).ToNot(HaveOccurred(), "Error in images.Search()")
|
||||
Expect(reports).ToNot(BeEmpty())
|
||||
})
|
||||
|
||||
It("Prune images", func() {
|
||||
options := new(images.PruneOptions).WithAll(true)
|
||||
results, err := images.Prune(bt.conn, options)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(len(results)).To(BeNumerically(">", 0))
|
||||
Expect(results).ToNot(BeEmpty())
|
||||
})
|
||||
|
||||
// TODO: we really need to extent to pull tests once we have a more sophisticated CI.
|
||||
|
@ -369,7 +369,7 @@ var _ = Describe("Podman images", func() {
|
|||
pullOpts := new(images.PullOptions).WithProgressWriter(&writer)
|
||||
pulledImages, err := images.Pull(bt.conn, rawImage, pullOpts)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(len(pulledImages)).To(Equal(1))
|
||||
Expect(pulledImages).To(HaveLen(1))
|
||||
output := writer.String()
|
||||
Expect(output).To(ContainSubstring("Trying to pull "))
|
||||
Expect(output).To(ContainSubstring("Getting image source signatures"))
|
||||
|
@ -389,7 +389,7 @@ var _ = Describe("Podman images", func() {
|
|||
|
||||
It("Image Push", func() {
|
||||
registry, err := podmanRegistry.Start()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
var writer bytes.Buffer
|
||||
pushOpts := new(images.PushOptions).WithUsername(registry.User).WithPassword(registry.Password).WithSkipTLSVerify(true).WithProgressWriter(&writer).WithQuiet(false)
|
||||
|
|
|
@ -25,7 +25,7 @@ var _ = Describe("Podman info", func() {
|
|||
s = bt.startAPIService()
|
||||
time.Sleep(1 * time.Second)
|
||||
err := bt.NewConnection()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
|
@ -35,35 +35,35 @@ var _ = Describe("Podman info", func() {
|
|||
|
||||
It("podman info", func() {
|
||||
info, err := system.Info(bt.conn, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(info.Host.Arch).To(Equal(runtime.GOARCH))
|
||||
Expect(info.Host.OS).To(Equal(runtime.GOOS))
|
||||
listOptions := new(images.ListOptions)
|
||||
i, err := images.List(bt.conn, listOptions.WithAll(true))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(info.Store.ImageStore.Number).To(Equal(len(i)))
|
||||
})
|
||||
|
||||
It("podman info container counts", func() {
|
||||
s := specgen.NewSpecGenerator(alpine.name, false)
|
||||
_, err := containers.CreateWithSpec(bt.conn, s, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
idPause, err := bt.RunTopContainer(nil, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Pause(bt.conn, idPause, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
idStop, err := bt.RunTopContainer(nil, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Stop(bt.conn, idStop, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
_, err = bt.RunTopContainer(nil, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
info, err := system.Info(bt.conn, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(info.Store.ContainerStore.Number).To(BeNumerically("==", 4))
|
||||
Expect(info.Store.ContainerStore.Paused).To(Equal(1))
|
||||
|
|
|
@ -43,7 +43,7 @@ var _ = Describe("Podman manifests", func() {
|
|||
list, err := manifests.Inspect(bt.conn, id, nil)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(len(list.Manifests)).To(BeZero())
|
||||
Expect(list.Manifests).To(BeEmpty())
|
||||
|
||||
// creating a duplicate should fail as a 500
|
||||
_, err = manifests.Create(bt.conn, "quay.io/libpod/foobar:latest", nil, nil)
|
||||
|
@ -53,7 +53,7 @@ var _ = Describe("Podman manifests", func() {
|
|||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
|
||||
_, errs := images.Remove(bt.conn, []string{id}, nil)
|
||||
Expect(len(errs)).To(BeZero())
|
||||
Expect(errs).To(BeEmpty())
|
||||
|
||||
// create manifest list with images
|
||||
id, err = manifests.Create(bt.conn, "quay.io/libpod/foobar:latest", []string{alpine.name}, nil)
|
||||
|
@ -62,7 +62,7 @@ var _ = Describe("Podman manifests", func() {
|
|||
list, err = manifests.Inspect(bt.conn, id, nil)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(len(list.Manifests)).To(BeNumerically("==", 1))
|
||||
Expect(list.Manifests).To(HaveLen(1))
|
||||
})
|
||||
|
||||
It("delete manifest", func() {
|
||||
|
@ -71,11 +71,11 @@ var _ = Describe("Podman manifests", func() {
|
|||
list, err := manifests.Inspect(bt.conn, id, nil)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(len(list.Manifests)).To(BeZero())
|
||||
Expect(list.Manifests).To(BeEmpty())
|
||||
|
||||
removeReport, err := manifests.Delete(bt.conn, "quay.io/libpod/foobar:latest")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(removeReport.Deleted)).To(BeNumerically("==", 1))
|
||||
Expect(removeReport.Deleted).To(HaveLen(1))
|
||||
})
|
||||
|
||||
It("inspect", func() {
|
||||
|
@ -104,7 +104,7 @@ var _ = Describe("Podman manifests", func() {
|
|||
list, err := manifests.Inspect(bt.conn, id, nil)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(len(list.Manifests)).To(BeNumerically("==", 1))
|
||||
Expect(list.Manifests).To(HaveLen(1))
|
||||
|
||||
// add bogus name to existing list should fail
|
||||
options.WithImages([]string{"larry"})
|
||||
|
@ -129,7 +129,7 @@ var _ = Describe("Podman manifests", func() {
|
|||
data, err := manifests.Inspect(bt.conn, id, nil)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(len(data.Manifests)).To(BeNumerically("==", 1))
|
||||
Expect(data.Manifests).To(HaveLen(1))
|
||||
|
||||
// removal on a good manifest list with a bad digest should be 400
|
||||
_, err = manifests.Remove(bt.conn, id, "!234", nil)
|
||||
|
@ -161,7 +161,7 @@ var _ = Describe("Podman manifests", func() {
|
|||
data, err := manifests.Inspect(bt.conn, id, nil)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(len(data.Manifests)).To(BeNumerically("==", 1))
|
||||
Expect(data.Manifests).To(HaveLen(1))
|
||||
|
||||
digest := data.Manifests[0].Digest.String()
|
||||
annoOpts := new(manifests.ModifyOptions).WithOS("foo")
|
||||
|
@ -171,13 +171,13 @@ var _ = Describe("Podman manifests", func() {
|
|||
list, err := manifests.Inspect(bt.conn, id, nil)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(len(list.Manifests)).To(BeNumerically("==", 1))
|
||||
Expect(list.Manifests).To(HaveLen(1))
|
||||
Expect(list.Manifests[0].Platform.OS).To(Equal("foo"))
|
||||
})
|
||||
|
||||
It("Manifest Push", func() {
|
||||
registry, err := podmanRegistry.Start()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
name := "quay.io/libpod/foobar:latest"
|
||||
_, err = manifests.Create(bt.conn, name, []string{alpine.name}, nil)
|
||||
|
|
|
@ -30,9 +30,9 @@ var _ = Describe("Podman networks", func() {
|
|||
s = bt.startAPIService()
|
||||
time.Sleep(1 * time.Second)
|
||||
connText, err = bindings.NewConnection(context.Background(), bt.sock)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = network.Prune(connText, &network.PruneOptions{})
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
|
@ -46,51 +46,51 @@ var _ = Describe("Podman networks", func() {
|
|||
Name: name,
|
||||
}
|
||||
_, err = network.Create(connText, &net)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Invalid filters should return error
|
||||
filtersIncorrect := map[string][]string{
|
||||
"status": {"dummy"},
|
||||
}
|
||||
_, err = network.Prune(connText, new(network.PruneOptions).WithFilters(filtersIncorrect))
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
|
||||
// List filter params should not work with prune.
|
||||
filtersIncorrect = map[string][]string{
|
||||
"name": {name},
|
||||
}
|
||||
_, err = network.Prune(connText, new(network.PruneOptions).WithFilters(filtersIncorrect))
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
|
||||
// Mismatched label, correct filter params => no network should be pruned.
|
||||
filtersIncorrect = map[string][]string{
|
||||
"label": {"xyz"},
|
||||
}
|
||||
pruneResponse, err := network.Prune(connText, new(network.PruneOptions).WithFilters(filtersIncorrect))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(pruneResponse)).To(Equal(0))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pruneResponse).To(BeEmpty())
|
||||
|
||||
// Mismatched until, correct filter params => no network should be pruned.
|
||||
filters := map[string][]string{
|
||||
"until": {"50"}, // January 1, 1970
|
||||
}
|
||||
pruneResponse, err = network.Prune(connText, new(network.PruneOptions).WithFilters(filters))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(pruneResponse)).To(Equal(0))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pruneResponse).To(BeEmpty())
|
||||
|
||||
// Valid filter params => network should be pruned now.
|
||||
filters = map[string][]string{
|
||||
"until": {"5000000000"}, // June 11, 2128
|
||||
}
|
||||
pruneResponse, err = network.Prune(connText, new(network.PruneOptions).WithFilters(filters))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(pruneResponse)).To(Equal(1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pruneResponse).To(HaveLen(1))
|
||||
})
|
||||
|
||||
It("create network", func() {
|
||||
// create a network with blank config should work
|
||||
_, err = network.Create(connText, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
name := "foobar"
|
||||
net := types.Network{
|
||||
|
@ -98,12 +98,12 @@ var _ = Describe("Podman networks", func() {
|
|||
}
|
||||
|
||||
report, err := network.Create(connText, &net)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(report.Name).To(Equal(name))
|
||||
|
||||
// create network with same name should 500
|
||||
_, err = network.Create(connText, &net)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusConflict))
|
||||
})
|
||||
|
@ -114,9 +114,9 @@ var _ = Describe("Podman networks", func() {
|
|||
Name: name,
|
||||
}
|
||||
_, err = network.Create(connText, &net)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
data, err := network.Inspect(connText, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(data.Name).To(Equal(name))
|
||||
})
|
||||
|
||||
|
@ -128,10 +128,10 @@ var _ = Describe("Podman networks", func() {
|
|||
Name: netNames[i],
|
||||
}
|
||||
_, err = network.Create(connText, &net)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
}
|
||||
list, err := network.List(connText, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(list)).To(BeNumerically(">=", 5))
|
||||
for _, n := range list {
|
||||
if n.Name != "podman" {
|
||||
|
@ -144,7 +144,7 @@ var _ = Describe("Podman networks", func() {
|
|||
filters["foobar"] = []string{"1234"}
|
||||
options := new(network.ListOptions).WithFilters(filters)
|
||||
_, err = network.List(connText, options)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
|
||||
|
@ -153,8 +153,8 @@ var _ = Describe("Podman networks", func() {
|
|||
filters["name"] = []string{"homer"}
|
||||
options = new(network.ListOptions).WithFilters(filters)
|
||||
list, err = network.List(connText, options)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(list)).To(BeNumerically("==", 1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(list).To(HaveLen(1))
|
||||
Expect(list[0].Name).To(Equal("homer"))
|
||||
})
|
||||
|
||||
|
@ -162,7 +162,7 @@ var _ = Describe("Podman networks", func() {
|
|||
// removing a noName network should result in 404
|
||||
_, err := network.Remove(connText, "noName", nil)
|
||||
code, err := bindings.CheckResponseCode(err)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(code).To(BeNumerically("==", http.StatusNotFound))
|
||||
|
||||
// Removing an unused network should work
|
||||
|
@ -171,9 +171,9 @@ var _ = Describe("Podman networks", func() {
|
|||
Name: name,
|
||||
}
|
||||
_, err = network.Create(connText, &net)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
report, err := network.Remove(connText, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(report[0].Name).To(Equal(name))
|
||||
|
||||
// Removing a network that is being used without force should be 500
|
||||
|
@ -182,7 +182,7 @@ var _ = Describe("Podman networks", func() {
|
|||
Name: name,
|
||||
}
|
||||
_, err = network.Create(connText, &net)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Start container and wait
|
||||
container := "ntest"
|
||||
|
@ -192,15 +192,15 @@ var _ = Describe("Podman networks", func() {
|
|||
|
||||
_, err = network.Remove(connText, name, nil)
|
||||
code, err = bindings.CheckResponseCode(err)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
|
||||
// Removing with a network in use with force should work with a stopped container
|
||||
err = containers.Stop(connText, container, new(containers.StopOptions).WithTimeout(0))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
options := new(network.RemoveOptions).WithForce(true)
|
||||
report, err = network.Remove(connText, name, options)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(report[0].Name).To(Equal(name))
|
||||
})
|
||||
})
|
||||
|
|
|
@ -34,7 +34,7 @@ var _ = Describe("Podman pods", func() {
|
|||
s = bt.startAPIService()
|
||||
time.Sleep(1 * time.Second)
|
||||
err := bt.NewConnection()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
|
@ -45,13 +45,13 @@ var _ = Describe("Podman pods", func() {
|
|||
It("inspect pod", func() {
|
||||
// Inspect an invalid pod name
|
||||
_, err := pods.Inspect(bt.conn, "dummyname", nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusNotFound))
|
||||
|
||||
// Inspect an valid pod name
|
||||
response, err := pods.Inspect(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(response.Name).To(Equal(newpod))
|
||||
})
|
||||
|
||||
|
@ -59,28 +59,28 @@ var _ = Describe("Podman pods", func() {
|
|||
It("list pod", func() {
|
||||
// List all the pods in the current instance
|
||||
podSummary, err := pods.List(bt.conn, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(podSummary)).To(Equal(1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(podSummary).To(HaveLen(1))
|
||||
|
||||
// Start the pod
|
||||
_, err = pods.Start(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Adding an alpine container to the existing pod
|
||||
_, err = bt.RunTopContainer(nil, &newpod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
podSummary, err = pods.List(bt.conn, nil)
|
||||
// Verify no errors.
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Verify number of containers in the pod.
|
||||
Expect(len(podSummary[0].Containers)).To(Equal(2))
|
||||
Expect(podSummary[0].Containers).To(HaveLen(2))
|
||||
|
||||
// Add multiple pods and verify them by name and size.
|
||||
var newpod2 string = "newpod2"
|
||||
bt.Podcreate(&newpod2)
|
||||
podSummary, err = pods.List(bt.conn, nil)
|
||||
Expect(err).To(BeNil(), "Error from pods.List")
|
||||
Expect(len(podSummary)).To(Equal(2))
|
||||
Expect(err).ToNot(HaveOccurred(), "Error from pods.List")
|
||||
Expect(podSummary).To(HaveLen(2))
|
||||
var names []string
|
||||
for _, i := range podSummary {
|
||||
names = append(names, i.Name)
|
||||
|
@ -96,18 +96,18 @@ var _ = Describe("Podman pods", func() {
|
|||
|
||||
// Start the pod
|
||||
_, err = pods.Start(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
_, err = bt.RunTopContainer(nil, &newpod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Expected err with invalid filter params
|
||||
filters := make(map[string][]string)
|
||||
filters["dummy"] = []string{"dummy"}
|
||||
options := new(pods.ListOptions).WithFilters(filters)
|
||||
filteredPods, err := pods.List(bt.conn, options)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(len(filteredPods)).To(Equal(0), "len(filteredPods)")
|
||||
Expect(err).To(HaveOccurred())
|
||||
Expect(filteredPods).To(BeEmpty(), "len(filteredPods)")
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
|
||||
|
@ -116,16 +116,16 @@ var _ = Describe("Podman pods", func() {
|
|||
filters["name"] = []string{"dummy"}
|
||||
options = new(pods.ListOptions).WithFilters(filters)
|
||||
filteredPods, err = pods.List(bt.conn, options)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(filteredPods)).To(BeNumerically("==", 0))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(filteredPods).To(BeEmpty())
|
||||
|
||||
// Validate list pod with name filter
|
||||
filters = make(map[string][]string)
|
||||
filters["name"] = []string{newpod2}
|
||||
options = new(pods.ListOptions).WithFilters(filters)
|
||||
filteredPods, err = pods.List(bt.conn, options)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(filteredPods)).To(BeNumerically("==", 1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(filteredPods).To(HaveLen(1))
|
||||
var names []string
|
||||
for _, i := range filteredPods {
|
||||
names = append(names, i.Name)
|
||||
|
@ -135,13 +135,13 @@ var _ = Describe("Podman pods", func() {
|
|||
// Validate list pod with id filter
|
||||
filters = make(map[string][]string)
|
||||
response, err := pods.Inspect(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
id := response.ID
|
||||
filters["id"] = []string{id}
|
||||
options = new(pods.ListOptions).WithFilters(filters)
|
||||
filteredPods, err = pods.List(bt.conn, options)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(filteredPods)).To(BeNumerically("==", 1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(filteredPods).To(HaveLen(1))
|
||||
names = names[:0]
|
||||
for _, i := range filteredPods {
|
||||
names = append(names, i.Name)
|
||||
|
@ -152,8 +152,8 @@ var _ = Describe("Podman pods", func() {
|
|||
filters["name"] = []string{newpod}
|
||||
options = new(pods.ListOptions).WithFilters(filters)
|
||||
filteredPods, err = pods.List(bt.conn, options)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(filteredPods)).To(BeNumerically("==", 1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(filteredPods).To(HaveLen(1))
|
||||
names = names[:0]
|
||||
for _, i := range filteredPods {
|
||||
names = append(names, i.Name)
|
||||
|
@ -164,12 +164,12 @@ var _ = Describe("Podman pods", func() {
|
|||
// The test validates if the exists responds
|
||||
It("exists pod", func() {
|
||||
response, err := pods.Exists(bt.conn, "dummyName", nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(response).To(BeFalse())
|
||||
|
||||
// Should exit with no error and response should be true
|
||||
response, err = pods.Exists(bt.conn, "newpod", nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(response).To(BeTrue())
|
||||
})
|
||||
|
||||
|
@ -180,21 +180,21 @@ var _ = Describe("Podman pods", func() {
|
|||
Skip("Pod behavior is jacked right now.")
|
||||
// Pause invalid container
|
||||
_, err := pods.Pause(bt.conn, "dummyName", nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusNotFound))
|
||||
|
||||
// Adding an alpine container to the existing pod
|
||||
_, err = bt.RunTopContainer(nil, &newpod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Binding needs to be modified to inspect the pod state.
|
||||
// Since we don't have a pod state we inspect the states of the containers within the pod.
|
||||
// Pause a valid container
|
||||
_, err = pods.Pause(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
response, err := pods.Inspect(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(response.State).To(Equal(define.PodStatePaused))
|
||||
for _, i := range response.Containers {
|
||||
Expect(define.StringToContainerStatus(i.State)).
|
||||
|
@ -203,9 +203,9 @@ var _ = Describe("Podman pods", func() {
|
|||
|
||||
// Unpause a valid container
|
||||
_, err = pods.Unpause(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
response, err = pods.Inspect(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(response.State).To(Equal(define.PodStateRunning))
|
||||
for _, i := range response.Containers {
|
||||
Expect(define.StringToContainerStatus(i.State)).
|
||||
|
@ -215,7 +215,7 @@ var _ = Describe("Podman pods", func() {
|
|||
|
||||
It("start pod with port conflict", func() {
|
||||
randomport, err := utils.GetRandomPort()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
portPublish := fmt.Sprintf("%d:%d", randomport, randomport)
|
||||
var podwithport string = "newpodwithport"
|
||||
|
@ -223,14 +223,14 @@ var _ = Describe("Podman pods", func() {
|
|||
|
||||
// Start pod and expose port 12345
|
||||
_, err = pods.Start(bt.conn, podwithport, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Start another pod and expose same port 12345
|
||||
var podwithport2 string = "newpodwithport2"
|
||||
bt.PodcreateAndExpose(&podwithport2, &portPublish)
|
||||
|
||||
_, err = pods.Start(bt.conn, podwithport2, nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusConflict))
|
||||
Expect(err).To(BeAssignableToTypeOf(&errorhandling.PodConflictErrorModel{}))
|
||||
|
@ -239,28 +239,28 @@ var _ = Describe("Podman pods", func() {
|
|||
It("start stop restart pod", func() {
|
||||
// Start an invalid pod
|
||||
_, err = pods.Start(bt.conn, "dummyName", nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusNotFound))
|
||||
|
||||
// Stop an invalid pod
|
||||
_, err = pods.Stop(bt.conn, "dummyName", nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ = bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusNotFound))
|
||||
|
||||
// Restart an invalid pod
|
||||
_, err = pods.Restart(bt.conn, "dummyName", nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ = bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusNotFound))
|
||||
|
||||
// Start a valid pod and inspect status of each container
|
||||
_, err = pods.Start(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
response, err := pods.Inspect(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(response.State).To(Equal(define.PodStateRunning))
|
||||
for _, i := range response.Containers {
|
||||
Expect(define.StringToContainerStatus(i.State)).
|
||||
|
@ -269,11 +269,11 @@ var _ = Describe("Podman pods", func() {
|
|||
|
||||
// Start an already running pod
|
||||
_, err = pods.Start(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Stop the running pods
|
||||
_, err = pods.Stop(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
response, _ = pods.Inspect(bt.conn, newpod, nil)
|
||||
Expect(response.State).To(Equal(define.PodStateExited))
|
||||
for _, i := range response.Containers {
|
||||
|
@ -283,10 +283,10 @@ var _ = Describe("Podman pods", func() {
|
|||
|
||||
// Stop an already stopped pod
|
||||
_, err = pods.Stop(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
_, err = pods.Restart(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
response, _ = pods.Inspect(bt.conn, newpod, nil)
|
||||
Expect(response.State).To(Equal(define.PodStateRunning))
|
||||
for _, i := range response.Containers {
|
||||
|
@ -302,75 +302,75 @@ var _ = Describe("Podman pods", func() {
|
|||
bt.Podcreate(&newpod2)
|
||||
// No pods pruned since no pod in exited state
|
||||
pruneResponse, err := pods.Prune(bt.conn, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(pruneResponse)).To(Equal(0), "len(pruneResponse)")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pruneResponse).To(BeEmpty(), "len(pruneResponse)")
|
||||
podSummary, err := pods.List(bt.conn, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(podSummary)).To(Equal(2))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(podSummary).To(HaveLen(2))
|
||||
|
||||
// Prune only one pod which is in exited state.
|
||||
// Start then stop a pod.
|
||||
// pod moves to exited state one pod should be pruned now.
|
||||
_, err = pods.Start(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = pods.Stop(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
response, err := pods.Inspect(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(response.State).To(Equal(define.PodStateExited))
|
||||
pruneResponse, err = pods.Prune(bt.conn, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(pruneResponse)).To(Equal(1), "len(pruneResponse)")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pruneResponse).To(HaveLen(1), "len(pruneResponse)")
|
||||
// Validate status and record pod id of pod to be pruned
|
||||
Expect(response.State).To(Equal(define.PodStateExited))
|
||||
podID := response.ID
|
||||
// Check if right pod was pruned
|
||||
Expect(len(pruneResponse)).To(Equal(1))
|
||||
Expect(pruneResponse).To(HaveLen(1))
|
||||
Expect(pruneResponse[0].Id).To(Equal(podID))
|
||||
// One pod is pruned hence only one pod should be active.
|
||||
podSummary, err = pods.List(bt.conn, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(podSummary)).To(Equal(1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(podSummary).To(HaveLen(1))
|
||||
|
||||
// Test prune multiple pods.
|
||||
bt.Podcreate(&newpod)
|
||||
_, err = pods.Start(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = pods.Start(bt.conn, newpod2, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = pods.Stop(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
response, err = pods.Inspect(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(response.State).To(Equal(define.PodStateExited))
|
||||
for _, i := range response.Containers {
|
||||
Expect(define.StringToContainerStatus(i.State)).
|
||||
To(Equal(define.ContainerStateExited))
|
||||
}
|
||||
_, err = pods.Stop(bt.conn, newpod2, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
response, err = pods.Inspect(bt.conn, newpod2, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(response.State).To(Equal(define.PodStateExited))
|
||||
for _, i := range response.Containers {
|
||||
Expect(define.StringToContainerStatus(i.State)).
|
||||
To(Equal(define.ContainerStateExited))
|
||||
}
|
||||
_, err = pods.Prune(bt.conn, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
podSummary, err = pods.List(bt.conn, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(podSummary)).To(Equal(0))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(podSummary).To(BeEmpty())
|
||||
})
|
||||
|
||||
It("simple create pod", func() {
|
||||
ps := entities.PodSpec{PodSpecGen: specgen.PodSpecGenerator{InfraContainerSpec: &specgen.SpecGenerator{}}}
|
||||
ps.PodSpecGen.Name = "foobar"
|
||||
_, err := pods.CreatePodFromSpec(bt.conn, &ps)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
exists, err := pods.Exists(bt.conn, "foobar", nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(exists).To(BeTrue())
|
||||
})
|
||||
|
||||
|
@ -380,16 +380,16 @@ var _ = Describe("Podman pods", func() {
|
|||
|
||||
bt.Podcreate(&name)
|
||||
_, err := pods.Start(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// By name
|
||||
_, err = pods.Top(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// With descriptors
|
||||
options := new(pods.TopOptions).WithDescriptors([]string{"user,pid,hpid"})
|
||||
output, err := pods.Top(bt.conn, name, options)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
header := strings.Split(output[0], "\t")
|
||||
for _, d := range []string{"USER", "PID", "HPID"} {
|
||||
Expect(d).To(BeElementOf(header))
|
||||
|
@ -397,11 +397,11 @@ var _ = Describe("Podman pods", func() {
|
|||
|
||||
// With bogus ID
|
||||
_, err = pods.Top(bt.conn, "IdoNotExist", nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
|
||||
// With bogus descriptors
|
||||
options = new(pods.TopOptions).WithDescriptors([]string{"Me,Neither"})
|
||||
_, err = pods.Top(bt.conn, name, options)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
})
|
||||
})
|
||||
|
|
|
@ -27,7 +27,7 @@ var _ = Describe("Podman secrets", func() {
|
|||
s = bt.startAPIService()
|
||||
time.Sleep(1 * time.Second)
|
||||
connText, err = bindings.NewConnection(context.Background(), bt.sock)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
|
@ -43,11 +43,11 @@ var _ = Describe("Podman secrets", func() {
|
|||
Name: &name,
|
||||
}
|
||||
_, err := secrets.Create(connText, r, opts)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// should not be allowed to create duplicate secret name
|
||||
_, err = secrets.Create(connText, r, opts)
|
||||
Expect(err).To(Not(BeNil()))
|
||||
Expect(err).To(HaveOccurred())
|
||||
})
|
||||
|
||||
It("inspect secret", func() {
|
||||
|
@ -57,10 +57,10 @@ var _ = Describe("Podman secrets", func() {
|
|||
Name: &name,
|
||||
}
|
||||
_, err := secrets.Create(connText, r, opts)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
data, err := secrets.Inspect(connText, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(data.Spec.Name).To(Equal(name))
|
||||
|
||||
// inspecting non-existent secret should fail
|
||||
|
@ -76,10 +76,10 @@ var _ = Describe("Podman secrets", func() {
|
|||
Name: &name,
|
||||
}
|
||||
_, err := secrets.Create(connText, r, opts)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
data, err := secrets.List(connText, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(data[0].Spec.Name).To(Equal(name))
|
||||
})
|
||||
|
||||
|
@ -90,7 +90,7 @@ var _ = Describe("Podman secrets", func() {
|
|||
Name: &name,
|
||||
}
|
||||
_, err := secrets.Create(connText, r, opts)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
r2 := strings.NewReader("mysecret2")
|
||||
name2 := "mysecret2"
|
||||
|
@ -98,17 +98,17 @@ var _ = Describe("Podman secrets", func() {
|
|||
Name: &name2,
|
||||
}
|
||||
_, err = secrets.Create(connText, r2, opts2)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
data, err := secrets.List(connText, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(data)).To(Equal(2))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(data).To(HaveLen(2))
|
||||
})
|
||||
|
||||
It("list no secrets", func() {
|
||||
data, err := secrets.List(connText, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(data)).To(Equal(0))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(data).To(BeEmpty())
|
||||
})
|
||||
|
||||
It("remove secret", func() {
|
||||
|
@ -118,14 +118,14 @@ var _ = Describe("Podman secrets", func() {
|
|||
Name: &name,
|
||||
}
|
||||
_, err := secrets.Create(connText, r, opts)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
err = secrets.Remove(connText, name)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// removing non-existent secret should fail
|
||||
err = secrets.Remove(connText, "nosecret")
|
||||
Expect(err).To(Not(BeNil()))
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusNotFound))
|
||||
})
|
||||
|
|
|
@ -30,7 +30,7 @@ var _ = Describe("Podman system", func() {
|
|||
s = bt.startAPIService()
|
||||
time.Sleep(1 * time.Second)
|
||||
err := bt.NewConnection()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
|
@ -41,7 +41,7 @@ var _ = Describe("Podman system", func() {
|
|||
It("podman events", func() {
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
filters := make(map[string][]string)
|
||||
filters["container"] = []string{name}
|
||||
|
@ -58,7 +58,7 @@ var _ = Describe("Podman system", func() {
|
|||
}()
|
||||
options := new(system.EventsOptions).WithFilters(filters).WithStream(false)
|
||||
err = system.Events(bt.conn, binChan, nil, options)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
done.Lock()
|
||||
Expect(eventCounter).To(BeNumerically(">", 0))
|
||||
})
|
||||
|
@ -66,146 +66,146 @@ var _ = Describe("Podman system", func() {
|
|||
It("podman system prune - pod,container stopped", func() {
|
||||
// Start and stop a pod to enter in exited state.
|
||||
_, err := pods.Start(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = pods.Stop(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Start and stop a container to enter in exited state.
|
||||
var name = "top"
|
||||
_, err = bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Stop(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
options := new(system.PruneOptions).WithAll(true)
|
||||
systemPruneResponse, err := system.Prune(bt.conn, options)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(systemPruneResponse.PodPruneReport)).To(Equal(1))
|
||||
Expect(len(systemPruneResponse.ContainerPruneReports)).To(Equal(1))
|
||||
Expect(len(systemPruneResponse.ImagePruneReports)).
|
||||
To(BeNumerically(">", 0))
|
||||
Expect(len(systemPruneResponse.VolumePruneReports)).To(Equal(0))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(systemPruneResponse.PodPruneReport).To(HaveLen(1))
|
||||
Expect(systemPruneResponse.ContainerPruneReports).To(HaveLen(1))
|
||||
Expect(systemPruneResponse.ImagePruneReports).
|
||||
ToNot(BeEmpty())
|
||||
Expect(systemPruneResponse.VolumePruneReports).To(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman system prune running alpine container", func() {
|
||||
// Start and stop a pod to enter in exited state.
|
||||
_, err := pods.Start(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = pods.Stop(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Start and stop a container to enter in exited state.
|
||||
var name = "top"
|
||||
_, err = bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Stop(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Start container and leave in running
|
||||
var name2 = "top2"
|
||||
_, err = bt.RunTopContainer(&name2, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Adding an unused volume
|
||||
_, err = volumes.Create(bt.conn, entities.VolumeCreateOptions{}, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
options := new(system.PruneOptions).WithAll(true)
|
||||
systemPruneResponse, err := system.Prune(bt.conn, options)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(systemPruneResponse.PodPruneReport)).To(Equal(1))
|
||||
Expect(len(systemPruneResponse.ContainerPruneReports)).To(Equal(1))
|
||||
Expect(len(systemPruneResponse.ImagePruneReports)).
|
||||
To(BeNumerically(">", 0))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(systemPruneResponse.PodPruneReport).To(HaveLen(1))
|
||||
Expect(systemPruneResponse.ContainerPruneReports).To(HaveLen(1))
|
||||
Expect(systemPruneResponse.ImagePruneReports).
|
||||
ToNot(BeEmpty())
|
||||
// Alpine image should not be pruned as used by running container
|
||||
Expect(reports.PruneReportsIds(systemPruneResponse.ImagePruneReports)).
|
||||
ToNot(ContainElement("docker.io/library/alpine:latest"))
|
||||
// Though unused volume is available it should not be pruned as flag set to false.
|
||||
Expect(len(systemPruneResponse.VolumePruneReports)).To(Equal(0))
|
||||
Expect(systemPruneResponse.VolumePruneReports).To(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman system prune running alpine container volume prune", func() {
|
||||
// Start a pod and leave it running
|
||||
_, err := pods.Start(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Start and stop a container to enter in exited state.
|
||||
var name = "top"
|
||||
_, err = bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Stop(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Start second container and leave in running
|
||||
var name2 = "top2"
|
||||
_, err = bt.RunTopContainer(&name2, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Adding an unused volume should work
|
||||
_, err = volumes.Create(bt.conn, entities.VolumeCreateOptions{}, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
options := new(system.PruneOptions).WithAll(true).WithVolumes(true)
|
||||
systemPruneResponse, err := system.Prune(bt.conn, options)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(systemPruneResponse.PodPruneReport)).To(Equal(0))
|
||||
Expect(len(systemPruneResponse.ContainerPruneReports)).To(Equal(1))
|
||||
Expect(len(systemPruneResponse.ImagePruneReports)).
|
||||
To(BeNumerically(">", 0))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(systemPruneResponse.PodPruneReport).To(BeEmpty())
|
||||
Expect(systemPruneResponse.ContainerPruneReports).To(HaveLen(1))
|
||||
Expect(systemPruneResponse.ImagePruneReports).
|
||||
ToNot(BeEmpty())
|
||||
// Alpine image should not be pruned as used by running container
|
||||
Expect(reports.PruneReportsIds(systemPruneResponse.ImagePruneReports)).
|
||||
ToNot(ContainElement("docker.io/library/alpine:latest"))
|
||||
// Volume should be pruned now as flag set true
|
||||
Expect(len(systemPruneResponse.VolumePruneReports)).To(Equal(1))
|
||||
Expect(systemPruneResponse.VolumePruneReports).To(HaveLen(1))
|
||||
})
|
||||
|
||||
It("podman system prune running alpine container volume prune --filter", func() {
|
||||
// Start a pod and leave it running
|
||||
_, err := pods.Start(bt.conn, newpod, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Start and stop a container to enter in exited state.
|
||||
var name = "top"
|
||||
_, err = bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = containers.Stop(bt.conn, name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Start second container and leave in running
|
||||
var name2 = "top2"
|
||||
_, err = bt.RunTopContainer(&name2, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Adding an unused volume should work
|
||||
_, err = volumes.Create(bt.conn, entities.VolumeCreateOptions{}, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Adding an unused volume with label should work
|
||||
_, err = volumes.Create(bt.conn, entities.VolumeCreateOptions{Label: map[string]string{
|
||||
"label1": "value1",
|
||||
}}, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
f := make(map[string][]string)
|
||||
f["label"] = []string{"label1=idontmatch"}
|
||||
|
||||
options := new(system.PruneOptions).WithAll(true).WithVolumes(true).WithFilters(f)
|
||||
systemPruneResponse, err := system.Prune(bt.conn, options)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(systemPruneResponse.PodPruneReport)).To(Equal(0))
|
||||
Expect(len(systemPruneResponse.ContainerPruneReports)).To(Equal(0))
|
||||
Expect(len(systemPruneResponse.ImagePruneReports)).To(Equal(0))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(systemPruneResponse.PodPruneReport).To(BeEmpty())
|
||||
Expect(systemPruneResponse.ContainerPruneReports).To(BeEmpty())
|
||||
Expect(systemPruneResponse.ImagePruneReports).To(BeEmpty())
|
||||
// Alpine image should not be pruned as used by running container
|
||||
Expect(reports.PruneReportsIds(systemPruneResponse.ImagePruneReports)).
|
||||
ToNot(ContainElement("docker.io/library/alpine:latest"))
|
||||
// Volume shouldn't be pruned because the PruneOptions filters doesn't match
|
||||
Expect(len(systemPruneResponse.VolumePruneReports)).To(Equal(0))
|
||||
Expect(systemPruneResponse.VolumePruneReports).To(BeEmpty())
|
||||
|
||||
// Fix filter and re prune
|
||||
f["label"] = []string{"label1=value1"}
|
||||
options = new(system.PruneOptions).WithAll(true).WithVolumes(true).WithFilters(f)
|
||||
systemPruneResponse, err = system.Prune(bt.conn, options)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Volume should be pruned because the PruneOptions filters now match
|
||||
Expect(len(systemPruneResponse.VolumePruneReports)).To(Equal(1))
|
||||
Expect(systemPruneResponse.VolumePruneReports).To(HaveLen(1))
|
||||
})
|
||||
})
|
||||
|
|
|
@ -30,7 +30,7 @@ var _ = Describe("Podman volumes", func() {
|
|||
s = bt.startAPIService()
|
||||
time.Sleep(1 * time.Second)
|
||||
connText, err = bindings.NewConnection(context.Background(), bt.sock)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
|
@ -41,7 +41,7 @@ var _ = Describe("Podman volumes", func() {
|
|||
It("create volume", func() {
|
||||
// create a volume with blank config should work
|
||||
_, err := volumes.Create(connText, entities.VolumeCreateOptions{}, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
vcc := entities.VolumeCreateOptions{
|
||||
Name: "foobar",
|
||||
|
@ -49,21 +49,21 @@ var _ = Describe("Podman volumes", func() {
|
|||
Options: nil,
|
||||
}
|
||||
vol, err := volumes.Create(connText, vcc, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(vol.Name).To(Equal("foobar"))
|
||||
|
||||
// create volume with same name should 500
|
||||
_, err = volumes.Create(connText, vcc, nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
})
|
||||
|
||||
It("inspect volume", func() {
|
||||
vol, err := volumes.Create(connText, entities.VolumeCreateOptions{}, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
data, err := volumes.Inspect(connText, vol.Name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(data.Name).To(Equal(vol.Name))
|
||||
})
|
||||
|
||||
|
@ -71,51 +71,51 @@ var _ = Describe("Podman volumes", func() {
|
|||
// removing a bogus volume should result in 404
|
||||
err := volumes.Remove(connText, "foobar", nil)
|
||||
code, err := bindings.CheckResponseCode(err)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(code).To(BeNumerically("==", http.StatusNotFound))
|
||||
|
||||
// Removing an unused volume should work
|
||||
vol, err := volumes.Create(connText, entities.VolumeCreateOptions{}, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = volumes.Remove(connText, vol.Name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Removing a volume that is being used without force should be 409
|
||||
vol, err = volumes.Create(connText, entities.VolumeCreateOptions{}, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session := bt.runPodman([]string{"run", "-dt", "-v", fmt.Sprintf("%s:/foobar", vol.Name), "--name", "vtest", alpine.name, "top"})
|
||||
session.Wait(45)
|
||||
Expect(session.ExitCode()).To(BeZero())
|
||||
|
||||
err = volumes.Remove(connText, vol.Name, nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, err = bindings.CheckResponseCode(err)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(code).To(BeNumerically("==", http.StatusConflict))
|
||||
|
||||
// Removing with a volume in use with force should work with a stopped container
|
||||
err = containers.Stop(connText, "vtest", new(containers.StopOptions).WithTimeout(0))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
options := new(volumes.RemoveOptions).WithForce(true)
|
||||
err = volumes.Remove(connText, vol.Name, options)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("list volumes", func() {
|
||||
// no volumes should be ok
|
||||
vols, err := volumes.List(connText, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(vols)).To(BeZero())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(vols).To(BeEmpty())
|
||||
|
||||
// create a bunch of named volumes and make verify with list
|
||||
volNames := []string{"homer", "bart", "lisa", "maggie", "marge"}
|
||||
for i := 0; i < 5; i++ {
|
||||
_, err = volumes.Create(connText, entities.VolumeCreateOptions{Name: volNames[i]}, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
}
|
||||
vols, err = volumes.List(connText, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(vols)).To(BeNumerically("==", 5))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(vols).To(HaveLen(5))
|
||||
for _, v := range vols {
|
||||
Expect(StringInSlice(v.Name, volNames)).To(BeTrue())
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ var _ = Describe("Podman volumes", func() {
|
|||
filters["foobar"] = []string{"1234"}
|
||||
options := new(volumes.ListOptions).WithFilters(filters)
|
||||
_, err = volumes.List(connText, options)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
|
||||
|
@ -133,34 +133,34 @@ var _ = Describe("Podman volumes", func() {
|
|||
filters["name"] = []string{"homer"}
|
||||
options = new(volumes.ListOptions).WithFilters(filters)
|
||||
vols, err = volumes.List(connText, options)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(vols)).To(BeNumerically("==", 1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(vols).To(HaveLen(1))
|
||||
Expect(vols[0].Name).To(Equal("homer"))
|
||||
})
|
||||
|
||||
It("prune unused volume", func() {
|
||||
// Pruning when no volumes present should be ok
|
||||
_, err := volumes.Prune(connText, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Removing an unused volume should work
|
||||
_, err = volumes.Create(connText, entities.VolumeCreateOptions{}, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
vols, err := volumes.Prune(connText, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(vols)).To(BeNumerically("==", 1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(vols).To(HaveLen(1))
|
||||
|
||||
_, err = volumes.Create(connText, entities.VolumeCreateOptions{Name: "homer"}, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = volumes.Create(connText, entities.VolumeCreateOptions{}, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session := bt.runPodman([]string{"run", "-dt", "-v", fmt.Sprintf("%s:/homer", "homer"), "--name", "vtest", alpine.name, "top"})
|
||||
session.Wait(45)
|
||||
vols, err = volumes.Prune(connText, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(reports.PruneReportsIds(vols))).To(BeNumerically("==", 1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(reports.PruneReportsIds(vols)).To(HaveLen(1))
|
||||
_, err = volumes.Inspect(connText, "homer", nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Removing volume with non matching filter shouldn't prune any volumes
|
||||
filters := make(map[string][]string)
|
||||
|
@ -168,27 +168,27 @@ var _ = Describe("Podman volumes", func() {
|
|||
_, err = volumes.Create(connText, entities.VolumeCreateOptions{Label: map[string]string{
|
||||
"label1": "value1",
|
||||
}}, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
options := new(volumes.PruneOptions).WithFilters(filters)
|
||||
vols, err = volumes.Prune(connText, options)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(vols)).To(BeNumerically("==", 0))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(vols).To(BeEmpty())
|
||||
vol2, err := volumes.Create(connText, entities.VolumeCreateOptions{Label: map[string]string{
|
||||
"label1": "value2",
|
||||
}}, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = volumes.Create(connText, entities.VolumeCreateOptions{Label: map[string]string{
|
||||
"label1": "value3",
|
||||
}}, nil)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Removing volume with matching filter label and value should remove specific entry
|
||||
filters = make(map[string][]string)
|
||||
filters["label"] = []string{"label1=value2"}
|
||||
options = new(volumes.PruneOptions).WithFilters(filters)
|
||||
vols, err = volumes.Prune(connText, options)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(vols)).To(BeNumerically("==", 1))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(vols).To(HaveLen(1))
|
||||
Expect(vols[0].Id).To(Equal(vol2.Name))
|
||||
|
||||
// Removing volumes with matching filter label should remove all matching volumes
|
||||
|
@ -196,8 +196,8 @@ var _ = Describe("Podman volumes", func() {
|
|||
filters["label"] = []string{"label1"}
|
||||
options = new(volumes.PruneOptions).WithFilters(filters)
|
||||
vols, err = volumes.Prune(connText, options)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(vols)).To(BeNumerically("==", 2))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(vols).To(HaveLen(2))
|
||||
})
|
||||
|
||||
})
|
||||
|
|
|
@ -25,27 +25,27 @@ var _ = Describe("run basic podman commands", func() {
|
|||
name := randomString()
|
||||
i := new(initMachine)
|
||||
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withNow()).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(0))
|
||||
|
||||
bm := basicMachine{}
|
||||
imgs, err := mb.setCmd(bm.withPodmanCommand([]string{"images", "-q"})).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(imgs).To(Exit(0))
|
||||
Expect(len(imgs.outputToStringSlice())).To(Equal(0))
|
||||
Expect(imgs.outputToStringSlice()).To(BeEmpty())
|
||||
|
||||
newImgs, err := mb.setCmd(bm.withPodmanCommand([]string{"pull", "quay.io/libpod/alpine_nginx"})).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(newImgs).To(Exit(0))
|
||||
Expect(len(newImgs.outputToStringSlice())).To(Equal(1))
|
||||
Expect(newImgs.outputToStringSlice()).To(HaveLen(1))
|
||||
|
||||
runAlp, err := mb.setCmd(bm.withPodmanCommand([]string{"run", "quay.io/libpod/alpine_nginx", "cat", "/etc/os-release"})).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(runAlp).To(Exit(0))
|
||||
Expect(runAlp.outputToString()).To(ContainSubstring("Alpine Linux"))
|
||||
|
||||
rmCon, err := mb.setCmd(bm.withPodmanCommand([]string{"rm", "-a"})).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(rmCon).To(Exit(0))
|
||||
})
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ var _ = Describe("podman machine info", func() {
|
|||
// Create a machine and check if info has been updated
|
||||
i := new(initMachine)
|
||||
initSession, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(initSession).To(Exit(0))
|
||||
|
||||
info = new(infoMachine)
|
||||
|
@ -53,6 +53,6 @@ var _ = Describe("podman machine info", func() {
|
|||
|
||||
infoReport := &entities.MachineInfo{}
|
||||
err = jsoniter.Unmarshal(infoSession.Bytes(), infoReport)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
})
|
||||
|
|
|
@ -29,20 +29,20 @@ var _ = Describe("podman machine init", func() {
|
|||
i := initMachine{}
|
||||
reallyLongName := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
session, err := mb.setName(reallyLongName).setCmd(&i).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(125))
|
||||
})
|
||||
It("simple init", func() {
|
||||
i := new(initMachine)
|
||||
session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(0))
|
||||
|
||||
inspectBefore, ec, err := mb.toQemuInspectInfo()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(ec).To(BeZero())
|
||||
|
||||
Expect(len(inspectBefore)).To(BeNumerically(">", 0))
|
||||
Expect(inspectBefore).ToNot(BeEmpty())
|
||||
testMachine := inspectBefore[0]
|
||||
Expect(testMachine.Name).To(Equal(mb.names[0]))
|
||||
Expect(testMachine.Resources.CPUs).To(Equal(uint64(1)))
|
||||
|
@ -53,26 +53,26 @@ var _ = Describe("podman machine init", func() {
|
|||
It("simple init with start", func() {
|
||||
i := initMachine{}
|
||||
session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(0))
|
||||
|
||||
inspectBefore, ec, err := mb.toQemuInspectInfo()
|
||||
Expect(ec).To(BeZero())
|
||||
Expect(len(inspectBefore)).To(BeNumerically(">", 0))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(inspectBefore)).To(BeNumerically(">", 0))
|
||||
Expect(inspectBefore).ToNot(BeEmpty())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(inspectBefore).ToNot(BeEmpty())
|
||||
Expect(inspectBefore[0].Name).To(Equal(mb.names[0]))
|
||||
|
||||
s := startMachine{}
|
||||
ssession, err := mb.setCmd(s).setTimeout(time.Minute * 10).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(ssession).Should(Exit(0))
|
||||
|
||||
inspectAfter, ec, err := mb.toQemuInspectInfo()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(ec).To(BeZero())
|
||||
Expect(len(inspectBefore)).To(BeNumerically(">", 0))
|
||||
Expect(len(inspectAfter)).To(BeNumerically(">", 0))
|
||||
Expect(inspectBefore).ToNot(BeEmpty())
|
||||
Expect(inspectAfter).ToNot(BeEmpty())
|
||||
Expect(inspectAfter[0].State).To(Equal(machine.Running))
|
||||
})
|
||||
|
||||
|
@ -80,14 +80,14 @@ var _ = Describe("podman machine init", func() {
|
|||
i := new(initMachine)
|
||||
remoteUsername := "remoteuser"
|
||||
session, err := mb.setCmd(i.withImagePath(mb.imagePath).withUsername(remoteUsername)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(0))
|
||||
|
||||
inspectBefore, ec, err := mb.toQemuInspectInfo()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(ec).To(BeZero())
|
||||
|
||||
Expect(len(inspectBefore)).To(BeNumerically(">", 0))
|
||||
Expect(inspectBefore).ToNot(BeEmpty())
|
||||
testMachine := inspectBefore[0]
|
||||
Expect(testMachine.Name).To(Equal(mb.names[0]))
|
||||
Expect(testMachine.Resources.CPUs).To(Equal(uint64(1)))
|
||||
|
@ -100,64 +100,64 @@ var _ = Describe("podman machine init", func() {
|
|||
name := randomString()
|
||||
i := new(initMachine)
|
||||
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withCPUs(2).withDiskSize(102).withMemory(4096).withTimezone("Pacific/Honolulu")).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(0))
|
||||
|
||||
s := new(startMachine)
|
||||
startSession, err := mb.setCmd(s).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(startSession).To(Exit(0))
|
||||
|
||||
sshCPU := sshMachine{}
|
||||
CPUsession, err := mb.setName(name).setCmd(sshCPU.withSSHComand([]string{"lscpu", "|", "grep", "\"CPU(s):\"", "|", "head", "-1"})).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(CPUsession).To(Exit(0))
|
||||
Expect(CPUsession.outputToString()).To(ContainSubstring("2"))
|
||||
|
||||
sshDisk := sshMachine{}
|
||||
diskSession, err := mb.setName(name).setCmd(sshDisk.withSSHComand([]string{"sudo", "fdisk", "-l", "|", "grep", "Disk"})).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(diskSession).To(Exit(0))
|
||||
Expect(diskSession.outputToString()).To(ContainSubstring("102 GiB"))
|
||||
|
||||
sshMemory := sshMachine{}
|
||||
memorySession, err := mb.setName(name).setCmd(sshMemory.withSSHComand([]string{"cat", "/proc/meminfo", "|", "grep", "-i", "'memtotal'", "|", "grep", "-o", "'[[:digit:]]*'"})).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(memorySession).To(Exit(0))
|
||||
foundMemory, err := strconv.Atoi(memorySession.outputToString())
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(foundMemory).To(BeNumerically(">", 3800000))
|
||||
Expect(foundMemory).To(BeNumerically("<", 4200000))
|
||||
|
||||
sshTimezone := sshMachine{}
|
||||
timezoneSession, err := mb.setName(name).setCmd(sshTimezone.withSSHComand([]string{"date"})).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(timezoneSession).To(Exit(0))
|
||||
Expect(timezoneSession.outputToString()).To(ContainSubstring("HST"))
|
||||
})
|
||||
|
||||
It("machine init with volume", func() {
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = os.CreateTemp(tmpDir, "example")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
mount := tmpDir + ":/testmountdir"
|
||||
defer func() { _ = machine.GuardedRemoveAll(tmpDir) }()
|
||||
|
||||
name := randomString()
|
||||
i := new(initMachine)
|
||||
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withVolume(mount)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(0))
|
||||
|
||||
s := new(startMachine)
|
||||
startSession, err := mb.setCmd(s).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(startSession).To(Exit(0))
|
||||
|
||||
ssh2 := sshMachine{}
|
||||
sshSession2, err := mb.setName(name).setCmd(ssh2.withSSHComand([]string{"ls /testmountdir"})).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(sshSession2).To(Exit(0))
|
||||
Expect(sshSession2.outputToString()).To(ContainSubstring("example"))
|
||||
})
|
||||
|
|
|
@ -28,25 +28,25 @@ var _ = Describe("podman machine stop", func() {
|
|||
i := inspectMachine{}
|
||||
reallyLongName := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
session, err := mb.setName(reallyLongName).setCmd(&i).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(125))
|
||||
})
|
||||
|
||||
It("inspect two machines", func() {
|
||||
i := new(initMachine)
|
||||
foo1, err := mb.setName("foo1").setCmd(i.withImagePath(mb.imagePath)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(foo1).To(Exit(0))
|
||||
|
||||
ii := new(initMachine)
|
||||
foo2, err := mb.setName("foo2").setCmd(ii.withImagePath(mb.imagePath)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(foo2).To(Exit(0))
|
||||
|
||||
inspect := new(inspectMachine)
|
||||
inspect = inspect.withFormat("{{.Name}}")
|
||||
inspectSession, err := mb.setName("foo1").setCmd(inspect).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(inspectSession).To(Exit(0))
|
||||
Expect(inspectSession.Bytes()).To(ContainSubstring("foo1"))
|
||||
})
|
||||
|
@ -55,24 +55,24 @@ var _ = Describe("podman machine stop", func() {
|
|||
name := randomString()
|
||||
i := new(initMachine)
|
||||
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(0))
|
||||
|
||||
// regular inspect should
|
||||
inspectJSON := new(inspectMachine)
|
||||
inspectSession, err := mb.setName(name).setCmd(inspectJSON).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(inspectSession).To(Exit(0))
|
||||
|
||||
var inspectInfo []machine.InspectInfo
|
||||
err = jsoniter.Unmarshal(inspectSession.Bytes(), &inspectInfo)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(strings.HasSuffix(inspectInfo[0].ConnectionInfo.PodmanSocket.GetPath(), "podman.sock"))
|
||||
|
||||
inspect := new(inspectMachine)
|
||||
inspect = inspect.withFormat("{{.Name}}")
|
||||
inspectSession, err = mb.setName(name).setCmd(inspect).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(inspectSession).To(Exit(0))
|
||||
Expect(inspectSession.Bytes()).To(ContainSubstring(name))
|
||||
|
||||
|
@ -80,7 +80,7 @@ var _ = Describe("podman machine stop", func() {
|
|||
inspect = new(inspectMachine)
|
||||
inspect = inspect.withFormat("{{.Abcde}}")
|
||||
inspectSession, err = mb.setName(name).setCmd(inspect).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(inspectSession).To(Exit(125))
|
||||
Expect(inspectSession.errorToString()).To(ContainSubstring("can't evaluate field Abcde in type machine.InspectInfo"))
|
||||
})
|
||||
|
|
|
@ -34,7 +34,7 @@ var _ = Describe("podman machine list", func() {
|
|||
|
||||
i := new(initMachine)
|
||||
session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(0))
|
||||
|
||||
secondList, err := mb.setCmd(list).run()
|
||||
|
@ -61,11 +61,11 @@ var _ = Describe("podman machine list", func() {
|
|||
|
||||
i := new(initMachine)
|
||||
session, err := mb.setName(name1).setCmd(i.withImagePath(mb.imagePath)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(0))
|
||||
|
||||
session2, err := mb.setName(name2).setCmd(i.withImagePath(mb.imagePath)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session2).To(Exit(0))
|
||||
|
||||
secondList, err := mb.setCmd(list.withQuiet()).run()
|
||||
|
@ -82,16 +82,16 @@ var _ = Describe("podman machine list", func() {
|
|||
It("list machine: check if running while starting", func() {
|
||||
i := new(initMachine)
|
||||
session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(0))
|
||||
s := new(startMachine)
|
||||
startSession, err := mb.setCmd(s).runWithoutWait()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
l := new(listMachine)
|
||||
for i := 0; i < 30; i++ {
|
||||
listSession, err := mb.setCmd(l).run()
|
||||
Expect(listSession).To(Exit(0))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
if startSession.ExitCode() == -1 {
|
||||
Expect(listSession.outputToString()).NotTo(ContainSubstring("Currently running"))
|
||||
} else {
|
||||
|
@ -102,7 +102,7 @@ var _ = Describe("podman machine list", func() {
|
|||
Expect(startSession).To(Exit(0))
|
||||
listSession, err := mb.setCmd(l).run()
|
||||
Expect(listSession).To(Exit(0))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(listSession.outputToString()).To(ContainSubstring("Currently running"))
|
||||
Expect(listSession.outputToString()).NotTo(ContainSubstring("Less than a second ago")) // check to make sure time created is accurate
|
||||
})
|
||||
|
@ -113,7 +113,7 @@ var _ = Describe("podman machine list", func() {
|
|||
|
||||
i := new(initMachine)
|
||||
session, err := mb.setName(name1).setCmd(i.withImagePath(mb.imagePath)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(0))
|
||||
|
||||
// go format
|
||||
|
@ -131,12 +131,12 @@ var _ = Describe("podman machine list", func() {
|
|||
list2 := new(listMachine)
|
||||
list2 = list2.withFormat("json")
|
||||
listSession2, err := mb.setCmd(list2).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(listSession2).To(Exit(0))
|
||||
|
||||
var listResponse []*entities.ListReporter
|
||||
err = jsoniter.Unmarshal(listSession2.Bytes(), &listResponse)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// table format includes the header
|
||||
list = new(listMachine)
|
||||
|
|
|
@ -23,46 +23,46 @@ var _ = Describe("podman machine rm", func() {
|
|||
i := rmMachine{}
|
||||
reallyLongName := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
session, err := mb.setName(reallyLongName).setCmd(&i).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(125))
|
||||
})
|
||||
|
||||
It("Remove machine", func() {
|
||||
i := new(initMachine)
|
||||
session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(0))
|
||||
rm := rmMachine{}
|
||||
_, err = mb.setCmd(rm.withForce()).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Inspecting a non-existent machine should fail
|
||||
// which means it is gone
|
||||
_, ec, err := mb.toQemuInspectInfo()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(ec).To(Equal(125))
|
||||
})
|
||||
|
||||
It("Remove running machine", func() {
|
||||
i := new(initMachine)
|
||||
session, err := mb.setCmd(i.withImagePath(mb.imagePath).withNow()).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(0))
|
||||
rm := new(rmMachine)
|
||||
|
||||
// Removing a running machine should fail
|
||||
stop, err := mb.setCmd(rm).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(stop).To(Exit(125))
|
||||
|
||||
// Removing again with force
|
||||
stopAgain, err := mb.setCmd(rm.withForce()).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(stopAgain).To(Exit(0))
|
||||
|
||||
// Inspect to be dead sure
|
||||
_, ec, err := mb.toQemuInspectInfo()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(ec).To(Equal(125))
|
||||
})
|
||||
})
|
||||
|
|
|
@ -25,48 +25,48 @@ var _ = Describe("podman machine set", func() {
|
|||
name := randomString()
|
||||
i := new(initMachine)
|
||||
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(0))
|
||||
|
||||
set := setMachine{}
|
||||
setSession, err := mb.setName(name).setCmd(set.withCPUs(2).withDiskSize(102).withMemory(4096)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(setSession).To(Exit(0))
|
||||
|
||||
// shrinking disk size is verboten
|
||||
shrink, err := mb.setName(name).setCmd(set.withDiskSize(5)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(shrink).To(Exit(125))
|
||||
|
||||
s := new(startMachine)
|
||||
startSession, err := mb.setCmd(s).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(startSession).To(Exit(0))
|
||||
|
||||
sshCPU := sshMachine{}
|
||||
CPUsession, err := mb.setName(name).setCmd(sshCPU.withSSHComand([]string{"lscpu", "|", "grep", "\"CPU(s):\"", "|", "head", "-1"})).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(CPUsession).To(Exit(0))
|
||||
Expect(CPUsession.outputToString()).To(ContainSubstring("2"))
|
||||
|
||||
sshDisk := sshMachine{}
|
||||
diskSession, err := mb.setName(name).setCmd(sshDisk.withSSHComand([]string{"sudo", "fdisk", "-l", "|", "grep", "Disk"})).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(diskSession).To(Exit(0))
|
||||
Expect(diskSession.outputToString()).To(ContainSubstring("102 GiB"))
|
||||
|
||||
sshMemory := sshMachine{}
|
||||
memorySession, err := mb.setName(name).setCmd(sshMemory.withSSHComand([]string{"cat", "/proc/meminfo", "|", "grep", "-i", "'memtotal'", "|", "grep", "-o", "'[[:digit:]]*'"})).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(memorySession).To(Exit(0))
|
||||
foundMemory, err := strconv.Atoi(memorySession.outputToString())
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(foundMemory).To(BeNumerically(">", 3800000))
|
||||
Expect(foundMemory).To(BeNumerically("<", 4200000))
|
||||
|
||||
// Setting a running machine results in 125
|
||||
runner, err := mb.setName(name).setCmd(set.withCPUs(4)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(runner).To(Exit(125))
|
||||
})
|
||||
|
||||
|
@ -74,28 +74,28 @@ var _ = Describe("podman machine set", func() {
|
|||
name := randomString()
|
||||
i := new(initMachine)
|
||||
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(0))
|
||||
|
||||
set := setMachine{}
|
||||
setSession, err := mb.setName(name).setCmd(&set).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(setSession).To(Exit(0))
|
||||
|
||||
s := new(startMachine)
|
||||
startSession, err := mb.setCmd(s).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(startSession).To(Exit(0))
|
||||
|
||||
ssh2 := sshMachine{}
|
||||
sshSession2, err := mb.setName(name).setCmd(ssh2.withSSHComand([]string{"lscpu", "|", "grep", "\"CPU(s):\"", "|", "head", "-1"})).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(sshSession2).To(Exit(0))
|
||||
Expect(sshSession2.outputToString()).To(ContainSubstring("1"))
|
||||
|
||||
ssh3 := sshMachine{}
|
||||
sshSession3, err := mb.setName(name).setCmd(ssh3.withSSHComand([]string{"sudo", "fdisk", "-l", "|", "grep", "Disk"})).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(sshSession3).To(Exit(0))
|
||||
Expect(sshSession3.outputToString()).To(ContainSubstring("100 GiB"))
|
||||
})
|
||||
|
|
|
@ -23,7 +23,7 @@ var _ = Describe("podman machine ssh", func() {
|
|||
name := randomString()
|
||||
ssh := sshMachine{}
|
||||
session, err := mb.setName(name).setCmd(ssh).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(125))
|
||||
Expect(session.errorToString()).To(ContainSubstring("not exist"))
|
||||
})
|
||||
|
@ -32,12 +32,12 @@ var _ = Describe("podman machine ssh", func() {
|
|||
name := randomString()
|
||||
i := new(initMachine)
|
||||
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(0))
|
||||
|
||||
ssh := sshMachine{}
|
||||
sshSession, err := mb.setName(name).setCmd(ssh).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(sshSession.errorToString()).To(ContainSubstring("is not running"))
|
||||
Expect(sshSession).To(Exit(125))
|
||||
})
|
||||
|
@ -46,18 +46,18 @@ var _ = Describe("podman machine ssh", func() {
|
|||
name := randomString()
|
||||
i := new(initMachine)
|
||||
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withNow()).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(0))
|
||||
|
||||
ssh := sshMachine{}
|
||||
sshSession, err := mb.setName(name).setCmd(ssh.withSSHComand([]string{"cat", "/etc/os-release"})).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(sshSession).To(Exit(0))
|
||||
Expect(sshSession.outputToString()).To(ContainSubstring("Fedora CoreOS"))
|
||||
|
||||
// keep exit code
|
||||
sshSession, err = mb.setName(name).setCmd(ssh.withSSHComand([]string{"false"})).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(sshSession).To(Exit(1))
|
||||
Expect(sshSession.outputToString()).To(Equal(""))
|
||||
Expect(sshSession.errorToString()).To(Equal(""))
|
||||
|
|
|
@ -22,36 +22,36 @@ var _ = Describe("podman machine start", func() {
|
|||
It("start simple machine", func() {
|
||||
i := new(initMachine)
|
||||
session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(0))
|
||||
s := new(startMachine)
|
||||
startSession, err := mb.setCmd(s).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(startSession).To(Exit(0))
|
||||
|
||||
info, ec, err := mb.toQemuInspectInfo()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(ec).To(BeZero())
|
||||
Expect(info[0].State).To(Equal(machine.Running))
|
||||
|
||||
stop := new(stopMachine)
|
||||
stopSession, err := mb.setCmd(stop).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(stopSession).To(Exit(0))
|
||||
|
||||
// suppress output
|
||||
startSession, err = mb.setCmd(s.withNoInfo()).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(startSession).To(Exit(0))
|
||||
Expect(startSession.outputToString()).ToNot(ContainSubstring("API forwarding"))
|
||||
|
||||
stopSession, err = mb.setCmd(stop).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(stopSession).To(Exit(0))
|
||||
|
||||
startSession, err = mb.setCmd(s.withQuiet()).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(startSession).To(Exit(0))
|
||||
Expect(len(startSession.outputToStringSlice())).To(Equal(1))
|
||||
Expect(startSession.outputToStringSlice()).To(HaveLen(1))
|
||||
})
|
||||
})
|
||||
|
|
|
@ -23,24 +23,24 @@ var _ = Describe("podman machine stop", func() {
|
|||
i := stopMachine{}
|
||||
reallyLongName := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
session, err := mb.setName(reallyLongName).setCmd(&i).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(125))
|
||||
})
|
||||
|
||||
It("Stop running machine", func() {
|
||||
i := new(initMachine)
|
||||
session, err := mb.setCmd(i.withImagePath(mb.imagePath).withNow()).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(0))
|
||||
|
||||
stop := new(stopMachine)
|
||||
stopSession, err := mb.setCmd(stop).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(stopSession).To(Exit(0))
|
||||
|
||||
// Stopping it again should not result in an error
|
||||
stopAgain, err := mb.setCmd(stop).run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(stopAgain).To(Exit((0)))
|
||||
})
|
||||
})
|
||||
|
|
|
@ -19,7 +19,7 @@ var _ = Describe("Podman attach", func() {
|
|||
|
||||
BeforeEach(func() {
|
||||
tempdir, err = CreateTempDirInTempDir()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
podmanTest = PodmanTestCreate(tempdir)
|
||||
podmanTest.Setup()
|
||||
})
|
||||
|
|
|
@ -113,7 +113,7 @@ var _ = Describe("Podman build", func() {
|
|||
Expect(data[0]).To(HaveField("Architecture", runtime.GOARCH))
|
||||
|
||||
st, err := os.Stat(logfile)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(st.Size()).To(Not(Equal(int64(0))))
|
||||
|
||||
session = podmanTest.Podman([]string{"rmi", "test"})
|
||||
|
@ -207,8 +207,8 @@ var _ = Describe("Podman build", func() {
|
|||
// Given
|
||||
// Switch to temp dir and restore it afterwards
|
||||
cwd, err := os.Getwd()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(os.Chdir(os.TempDir())).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(os.Chdir(os.TempDir())).To(Succeed())
|
||||
defer Expect(os.Chdir(cwd)).To(BeNil())
|
||||
|
||||
// Write target and fake files
|
||||
|
@ -218,14 +218,14 @@ var _ = Describe("Podman build", func() {
|
|||
}
|
||||
|
||||
fakeFile := filepath.Join(os.TempDir(), "Containerfile")
|
||||
Expect(os.WriteFile(fakeFile, []byte(fmt.Sprintf("FROM %s", ALPINE)), 0755)).To(BeNil())
|
||||
Expect(os.WriteFile(fakeFile, []byte(fmt.Sprintf("FROM %s", ALPINE)), 0755)).To(Succeed())
|
||||
|
||||
targetFile := filepath.Join(targetPath, "Containerfile")
|
||||
Expect(os.WriteFile(targetFile, []byte("FROM scratch"), 0755)).To(BeNil())
|
||||
Expect(os.WriteFile(targetFile, []byte("FROM scratch"), 0755)).To(Succeed())
|
||||
|
||||
defer func() {
|
||||
Expect(os.RemoveAll(fakeFile)).To(BeNil())
|
||||
Expect(os.RemoveAll(targetFile)).To(BeNil())
|
||||
Expect(os.RemoveAll(fakeFile)).To(Succeed())
|
||||
Expect(os.RemoveAll(targetFile)).To(Succeed())
|
||||
}()
|
||||
|
||||
// When
|
||||
|
@ -243,8 +243,8 @@ var _ = Describe("Podman build", func() {
|
|||
It("podman build basic alpine and print id to external file", func() {
|
||||
// Switch to temp dir and restore it afterwards
|
||||
cwd, err := os.Getwd()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(os.Chdir(os.TempDir())).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(os.Chdir(os.TempDir())).To(Succeed())
|
||||
defer Expect(os.Chdir(cwd)).To(BeNil())
|
||||
|
||||
targetPath, err := CreateTempDirInTempDir()
|
||||
|
@ -311,7 +311,7 @@ RUN printenv http_proxy`, ALPINE)
|
|||
|
||||
dockerfilePath := filepath.Join(podmanTest.TempDir, "Dockerfile")
|
||||
err := os.WriteFile(dockerfilePath, []byte(dockerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "--http-proxy", "--file", dockerfilePath, podmanTest.TempDir})
|
||||
session.Wait(120)
|
||||
Expect(session).Should(Exit(0))
|
||||
|
@ -330,7 +330,7 @@ RUN exit 5`, ALPINE)
|
|||
|
||||
dockerfilePath := filepath.Join(podmanTest.TempDir, "Dockerfile")
|
||||
err := os.WriteFile(dockerfilePath, []byte(dockerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session := podmanTest.Podman([]string{"build", "-t", "error-test", "--file", dockerfilePath, podmanTest.TempDir})
|
||||
session.Wait(120)
|
||||
Expect(session).Should(Exit(5))
|
||||
|
@ -376,19 +376,19 @@ RUN exit 5`, ALPINE)
|
|||
// Given
|
||||
// Switch to temp dir and restore it afterwards
|
||||
cwd, err := os.Getwd()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
podmanTest.AddImageToRWStore(ALPINE)
|
||||
|
||||
// Write target and fake files
|
||||
targetPath, err := CreateTempDirInTempDir()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
targetSubPath := filepath.Join(targetPath, "subdir")
|
||||
err = os.Mkdir(targetSubPath, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
dummyFile := filepath.Join(targetSubPath, "dummy")
|
||||
err = os.WriteFile(dummyFile, []byte("dummy"), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
containerfile := fmt.Sprintf(`FROM %s
|
||||
ADD . /test
|
||||
|
@ -396,15 +396,15 @@ RUN find /test`, ALPINE)
|
|||
|
||||
containerfilePath := filepath.Join(targetPath, "Containerfile")
|
||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
defer func() {
|
||||
Expect(os.Chdir(cwd)).To(BeNil())
|
||||
Expect(os.RemoveAll(targetPath)).To(BeNil())
|
||||
Expect(os.Chdir(cwd)).To(Succeed())
|
||||
Expect(os.RemoveAll(targetPath)).To(Succeed())
|
||||
}()
|
||||
|
||||
// make cwd as context root path
|
||||
Expect(os.Chdir(targetPath)).To(BeNil())
|
||||
Expect(os.Chdir(targetPath)).To(Succeed())
|
||||
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "-f", "Containerfile", targetSubPath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -422,30 +422,30 @@ RUN find /test`, ALPINE)
|
|||
// Given
|
||||
// Switch to temp dir and restore it afterwards
|
||||
cwd, err := os.Getwd()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
podmanTest.AddImageToRWStore(ALPINE)
|
||||
|
||||
// Write target and fake files
|
||||
targetPath, err := CreateTempDirInTempDir()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
targetSubPath := filepath.Join(targetPath, "subdir")
|
||||
err = os.Mkdir(targetSubPath, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
containerfile := fmt.Sprintf("FROM %s", ALPINE)
|
||||
|
||||
containerfilePath := filepath.Join(targetSubPath, "Containerfile")
|
||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
defer func() {
|
||||
Expect(os.Chdir(cwd)).To(BeNil())
|
||||
Expect(os.RemoveAll(targetPath)).To(BeNil())
|
||||
Expect(os.Chdir(cwd)).To(Succeed())
|
||||
Expect(os.RemoveAll(targetPath)).To(Succeed())
|
||||
}()
|
||||
|
||||
// make cwd as context root path
|
||||
Expect(os.Chdir(targetPath)).To(BeNil())
|
||||
Expect(os.Chdir(targetPath)).To(Succeed())
|
||||
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "-f", "subdir/Containerfile", "."})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -462,13 +462,13 @@ RUN find /test`, ALPINE)
|
|||
// Given
|
||||
// Switch to temp dir and restore it afterwards
|
||||
cwd, err := os.Getwd()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
podmanTest.AddImageToRWStore(ALPINE)
|
||||
|
||||
// Write target and fake files
|
||||
targetPath, err := CreateTempDirInTempDir()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
containerfile := fmt.Sprintf(`FROM %s
|
||||
ADD . /testfilter/
|
||||
|
@ -476,31 +476,31 @@ RUN find /testfilter/`, ALPINE)
|
|||
|
||||
containerfilePath := filepath.Join(targetPath, "Containerfile")
|
||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
targetSubPath := filepath.Join(targetPath, "subdir")
|
||||
err = os.Mkdir(targetSubPath, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
dummyFile1 := filepath.Join(targetPath, "dummy1")
|
||||
err = os.WriteFile(dummyFile1, []byte("dummy1"), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
dummyFile2 := filepath.Join(targetPath, "dummy2")
|
||||
err = os.WriteFile(dummyFile2, []byte("dummy2"), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
dummyFile3 := filepath.Join(targetSubPath, "dummy3")
|
||||
err = os.WriteFile(dummyFile3, []byte("dummy3"), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
defer func() {
|
||||
Expect(os.Chdir(cwd)).To(BeNil())
|
||||
Expect(os.RemoveAll(targetPath)).To(BeNil())
|
||||
Expect(os.Chdir(cwd)).To(Succeed())
|
||||
Expect(os.RemoveAll(targetPath)).To(Succeed())
|
||||
}()
|
||||
|
||||
// make cwd as context root path
|
||||
Expect(os.Chdir(targetPath)).To(BeNil())
|
||||
Expect(os.Chdir(targetPath)).To(Succeed())
|
||||
|
||||
dockerignoreContent := `dummy1
|
||||
subdir**`
|
||||
|
@ -509,7 +509,7 @@ subdir**`
|
|||
// test .dockerignore
|
||||
By("Test .dockererignore")
|
||||
err = os.WriteFile(dockerignoreFile, []byte(dockerignoreContent), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"build", "-t", "test", "."})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -585,25 +585,25 @@ subdir**`
|
|||
|
||||
// Switch to temp dir and restore it afterwards
|
||||
cwd, err := os.Getwd()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
podmanTest.AddImageToRWStore(ALPINE)
|
||||
|
||||
// Write target and fake files
|
||||
targetPath, err := CreateTempDirInTempDir()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
targetSubPath := filepath.Join(targetPath, "subdir")
|
||||
err = os.Mkdir(targetSubPath, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
dummyFile := filepath.Join(targetSubPath, "dummy")
|
||||
err = os.WriteFile(dummyFile, []byte("dummy"), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
emptyDir := filepath.Join(targetSubPath, "emptyDir")
|
||||
err = os.Mkdir(emptyDir, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(os.Chdir(targetSubPath)).To(BeNil())
|
||||
Expect(os.Symlink("dummy", "dummy-symlink")).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(os.Chdir(targetSubPath)).To(Succeed())
|
||||
Expect(os.Symlink("dummy", "dummy-symlink")).To(Succeed())
|
||||
|
||||
containerfile := fmt.Sprintf(`FROM %s
|
||||
ADD . /test
|
||||
|
@ -612,15 +612,15 @@ RUN [[ -L /test/dummy-symlink ]] && echo SYMLNKOK || echo SYMLNKERR`, ALPINE)
|
|||
|
||||
containerfilePath := filepath.Join(targetSubPath, "Containerfile")
|
||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
defer func() {
|
||||
Expect(os.Chdir(cwd)).To(BeNil())
|
||||
Expect(os.RemoveAll(targetPath)).To(BeNil())
|
||||
Expect(os.Chdir(cwd)).To(Succeed())
|
||||
Expect(os.RemoveAll(targetPath)).To(Succeed())
|
||||
}()
|
||||
|
||||
// make cwd as context root path
|
||||
Expect(os.Chdir(targetPath)).To(BeNil())
|
||||
Expect(os.Chdir(targetPath)).To(Succeed())
|
||||
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", targetSubPath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -633,17 +633,17 @@ RUN [[ -L /test/dummy-symlink ]] && echo SYMLNKOK || echo SYMLNKERR`, ALPINE)
|
|||
|
||||
It("podman build --from, --add-host, --cap-drop, --cap-add", func() {
|
||||
targetPath, err := CreateTempDirInTempDir()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
containerFile := filepath.Join(targetPath, "Containerfile")
|
||||
content := `FROM scratch
|
||||
RUN cat /etc/hosts
|
||||
RUN grep CapEff /proc/self/status`
|
||||
|
||||
Expect(os.WriteFile(containerFile, []byte(content), 0755)).To(BeNil())
|
||||
Expect(os.WriteFile(containerFile, []byte(content), 0755)).To(Succeed())
|
||||
|
||||
defer func() {
|
||||
Expect(os.RemoveAll(containerFile)).To(BeNil())
|
||||
Expect(os.RemoveAll(containerFile)).To(Succeed())
|
||||
}()
|
||||
|
||||
// When
|
||||
|
@ -664,13 +664,13 @@ RUN grep CapEff /proc/self/status`
|
|||
|
||||
It("podman build --isolation && --arch", func() {
|
||||
targetPath, err := CreateTempDirInTempDir()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
containerFile := filepath.Join(targetPath, "Containerfile")
|
||||
Expect(os.WriteFile(containerFile, []byte(fmt.Sprintf("FROM %s", ALPINE)), 0755)).To(BeNil())
|
||||
Expect(os.WriteFile(containerFile, []byte(fmt.Sprintf("FROM %s", ALPINE)), 0755)).To(Succeed())
|
||||
|
||||
defer func() {
|
||||
Expect(os.RemoveAll(containerFile)).To(BeNil())
|
||||
Expect(os.RemoveAll(containerFile)).To(Succeed())
|
||||
}()
|
||||
|
||||
// When
|
||||
|
@ -712,7 +712,7 @@ RUN echo hello`, ALPINE)
|
|||
|
||||
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||
err := os.WriteFile(containerfilePath, []byte(containerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "--timestamp", "0", "--file", containerfilePath, podmanTest.TempDir})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
|
@ -724,12 +724,12 @@ RUN echo hello`, ALPINE)
|
|||
|
||||
It("podman build --log-rusage", func() {
|
||||
targetPath, err := CreateTempDirInTempDir()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
containerFile := filepath.Join(targetPath, "Containerfile")
|
||||
content := `FROM scratch`
|
||||
|
||||
Expect(os.WriteFile(containerFile, []byte(content), 0755)).To(BeNil())
|
||||
Expect(os.WriteFile(containerFile, []byte(content), 0755)).To(Succeed())
|
||||
|
||||
session := podmanTest.Podman([]string{"build", "--log-rusage", "--pull-never", targetPath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -743,7 +743,7 @@ RUN echo hello`, ALPINE)
|
|||
containerfile := `FROM scratch`
|
||||
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||
err := os.WriteFile(containerfilePath, []byte(containerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "--arch", "foo", "--os", "bar", "--file", containerfilePath, podmanTest.TempDir})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
|
@ -762,7 +762,7 @@ RUN echo hello`, ALPINE)
|
|||
containerfile := `FROM scratch`
|
||||
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||
err := os.WriteFile(containerfilePath, []byte(containerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "--os", "windows", "--file", containerfilePath, podmanTest.TempDir})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
|
@ -785,7 +785,7 @@ RUN echo hello`, ALPINE)
|
|||
RUN ls /dev/fuse`, ALPINE)
|
||||
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||
err := os.WriteFile(containerfilePath, []byte(containerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "--file", containerfilePath, podmanTest.TempDir})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(1))
|
||||
|
@ -801,7 +801,7 @@ RUN ls /dev/fuse`, ALPINE)
|
|||
RUN ls /dev/test1`, ALPINE)
|
||||
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||
err := os.WriteFile(containerfilePath, []byte(containerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "--file", containerfilePath, podmanTest.TempDir})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(1))
|
||||
|
@ -818,11 +818,11 @@ RUN ls /dev/test1`, ALPINE)
|
|||
buildRoot := filepath.Join(relativeDir, "build-root")
|
||||
|
||||
err = os.Mkdir(relativeDir, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = os.Mkdir(buildRoot, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = os.WriteFile(containerFilePath, []byte(containerFile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
build := podmanTest.Podman([]string{"build", "-f", containerFilePath, buildRoot})
|
||||
build.WaitWithDefaultTimeout()
|
||||
Expect(build).To(Exit(0))
|
||||
|
|
|
@ -59,7 +59,7 @@ var _ = Describe("Podman checkpoint", func() {
|
|||
SkipIfRootless("checkpoint not supported in rootless mode")
|
||||
SkipIfContainerized("FIXME: #15015. All checkpoint tests hang when containerized.")
|
||||
tempdir, err = CreateTempDirInTempDir()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
podmanTest = PodmanTestCreate(tempdir)
|
||||
podmanTest.Setup()
|
||||
|
@ -389,7 +389,7 @@ var _ = Describe("Podman checkpoint", func() {
|
|||
|
||||
// Open a network connection to the redis server
|
||||
conn, err := net.DialTimeout("tcp4", IP.OutputToString()+":6379", time.Duration(3)*time.Second)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// This should fail as the container has established TCP connections
|
||||
result := podmanTest.Podman([]string{"container", "checkpoint", cid})
|
||||
|
@ -1135,7 +1135,7 @@ var _ = Describe("Podman checkpoint", func() {
|
|||
// Open a network connection to the redis server via initial port mapping
|
||||
// This should fail
|
||||
_, err = net.DialTimeout("tcp4", fmt.Sprintf("localhost:%d", randomPort), time.Duration(3)*time.Second)
|
||||
Expect(err).ToNot(BeNil())
|
||||
Expect(err).To(HaveOccurred())
|
||||
Expect(err.Error()).To(ContainSubstring("connection refused"))
|
||||
// Open a network connection to the redis server via new port mapping
|
||||
fmt.Fprintf(os.Stderr, "Trying to reconnect to redis server at localhost:%d", newRandomPort)
|
||||
|
@ -1396,7 +1396,7 @@ var _ = Describe("Podman checkpoint", func() {
|
|||
_, err = os.Stat(filepath.Join(destinationDirectory, stats.StatsDump))
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
|
||||
Expect(os.RemoveAll(destinationDirectory)).To(BeNil())
|
||||
Expect(os.RemoveAll(destinationDirectory)).To(Succeed())
|
||||
|
||||
// Remove exported checkpoint
|
||||
os.Remove(fileName)
|
||||
|
|
|
@ -20,7 +20,7 @@ var _ = Describe("Podman commit", func() {
|
|||
|
||||
BeforeEach(func() {
|
||||
tempdir, err = CreateTempDirInTempDir()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
podmanTest = PodmanTestCreate(tempdir)
|
||||
podmanTest.Setup()
|
||||
})
|
||||
|
@ -127,7 +127,7 @@ var _ = Describe("Podman commit", func() {
|
|||
break
|
||||
}
|
||||
}
|
||||
Expect(foundBlue).To(Equal(true))
|
||||
Expect(foundBlue).To(BeTrue())
|
||||
})
|
||||
|
||||
It("podman commit container with --squash", func() {
|
||||
|
@ -268,8 +268,8 @@ var _ = Describe("Podman commit", func() {
|
|||
It("podman commit container and print id to external file", func() {
|
||||
// Switch to temp dir and restore it afterwards
|
||||
cwd, err := os.Getwd()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(os.Chdir(os.TempDir())).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(os.Chdir(os.TempDir())).To(Succeed())
|
||||
targetPath, err := CreateTempDirInTempDir()
|
||||
if err != nil {
|
||||
os.Exit(1)
|
||||
|
@ -297,7 +297,7 @@ var _ = Describe("Podman commit", func() {
|
|||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -322,7 +322,7 @@ var _ = Describe("Podman commit", func() {
|
|||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
|
|
@ -382,7 +382,7 @@ func (p *PodmanTestIntegration) createArtifact(image string) {
|
|||
func (s *PodmanSessionIntegration) InspectImageJSON() []inspect.ImageData {
|
||||
var i []inspect.ImageData
|
||||
err := jsoniter.Unmarshal(s.Out.Contents(), &i)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
return i
|
||||
}
|
||||
|
||||
|
@ -582,7 +582,7 @@ func (p *PodmanTestIntegration) CleanupSecrets() {
|
|||
func (s *PodmanSessionIntegration) InspectContainerToJSON() []define.InspectContainerData {
|
||||
var i []define.InspectContainerData
|
||||
err := jsoniter.Unmarshal(s.Out.Contents(), &i)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
return i
|
||||
}
|
||||
|
||||
|
@ -598,7 +598,7 @@ func (s *PodmanSessionIntegration) InspectPodToJSON() define.InspectPodData {
|
|||
func (s *PodmanSessionIntegration) InspectPodArrToJSON() []define.InspectPodData {
|
||||
var i []define.InspectPodData
|
||||
err := jsoniter.Unmarshal(s.Out.Contents(), &i)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
return i
|
||||
}
|
||||
|
||||
|
@ -826,7 +826,7 @@ func (p *PodmanTestIntegration) RestoreArtifactToCache(image string) error {
|
|||
func populateCache(podman *PodmanTestIntegration) {
|
||||
for _, image := range CACHE_IMAGES {
|
||||
err := podman.RestoreArtifactToCache(image)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
}
|
||||
// logformatter uses this to recognize the first test
|
||||
fmt.Printf("-----------------------------\n")
|
||||
|
@ -987,7 +987,7 @@ func (s *PodmanSessionIntegration) jq(jqCommand string) (string, error) {
|
|||
func (p *PodmanTestIntegration) buildImage(dockerfile, imageName string, layers string, label string) string {
|
||||
dockerfilePath := filepath.Join(p.TempDir, "Dockerfile")
|
||||
err := os.WriteFile(dockerfilePath, []byte(dockerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
cmd := []string{"build", "--pull-never", "--layers=" + layers, "--file", dockerfilePath}
|
||||
if label != "" {
|
||||
cmd = append(cmd, "--label="+label)
|
||||
|
|
|
@ -15,7 +15,7 @@ func buildDataVolumeImage(pTest *PodmanTestIntegration, image, data, dest string
|
|||
// Create a dummy file for data volume
|
||||
dummyFile := filepath.Join(pTest.TempDir, data)
|
||||
err := os.WriteFile(dummyFile, []byte(data), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Create a data volume container image but no CMD binary in it
|
||||
containerFile := fmt.Sprintf(`FROM scratch
|
||||
|
@ -29,7 +29,7 @@ func createContainersConfFile(pTest *PodmanTestIntegration) {
|
|||
configPath := filepath.Join(pTest.TempDir, "containers.conf")
|
||||
containersConf := []byte("[containers]\nprepare_volume_on_create = true\n")
|
||||
err := os.WriteFile(configPath, containersConf, os.ModePerm)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Set custom containers.conf file
|
||||
os.Setenv("CONTAINERS_CONF", configPath)
|
||||
|
@ -58,7 +58,7 @@ func checkDataVolumeContainer(pTest *PodmanTestIntegration, image, cont, dest, d
|
|||
|
||||
// Check the mount source directory
|
||||
files, err := os.ReadDir(mntSource)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
if data == "" {
|
||||
Expect(files).To(BeEmpty())
|
||||
|
|
|
@ -43,13 +43,13 @@ var _ = Describe("Podman cp", func() {
|
|||
// that the contents match.
|
||||
It("podman cp file", func() {
|
||||
srcFile, err := os.CreateTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer srcFile.Close()
|
||||
defer os.Remove(srcFile.Name())
|
||||
|
||||
originalContent := []byte("podman cp file test")
|
||||
err = os.WriteFile(srcFile.Name(), originalContent, 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Create a container. NOTE that container mustn't be running for copying.
|
||||
session := podmanTest.Podman([]string{"create", ALPINE})
|
||||
|
@ -72,7 +72,7 @@ var _ = Describe("Podman cp", func() {
|
|||
// Copy FROM the container.
|
||||
|
||||
destFile, err := os.CreateTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer destFile.Close()
|
||||
defer os.Remove(destFile.Name())
|
||||
|
||||
|
@ -86,7 +86,7 @@ var _ = Describe("Podman cp", func() {
|
|||
|
||||
// Now make sure the content matches.
|
||||
roundtripContent, err := os.ReadFile(destFile.Name())
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(roundtripContent).To(Equal(originalContent))
|
||||
})
|
||||
|
||||
|
@ -94,13 +94,13 @@ var _ = Describe("Podman cp", func() {
|
|||
It("podman cp --pid=host file", func() {
|
||||
SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
|
||||
srcFile, err := os.CreateTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer srcFile.Close()
|
||||
defer os.Remove(srcFile.Name())
|
||||
|
||||
originalContent := []byte("podman cp file test")
|
||||
err = os.WriteFile(srcFile.Name(), originalContent, 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Create a container. NOTE that container mustn't be running for copying.
|
||||
session := podmanTest.Podman([]string{"create", "--pid=host", ALPINE, "top"})
|
||||
|
@ -120,7 +120,7 @@ var _ = Describe("Podman cp", func() {
|
|||
// Copy FROM the container.
|
||||
|
||||
destFile, err := os.CreateTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer destFile.Close()
|
||||
defer os.Remove(destFile.Name())
|
||||
|
||||
|
@ -130,7 +130,7 @@ var _ = Describe("Podman cp", func() {
|
|||
|
||||
// Now make sure the content matches.
|
||||
roundtripContent, err := os.ReadFile(destFile.Name())
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(roundtripContent).To(Equal(originalContent))
|
||||
})
|
||||
|
||||
|
@ -139,13 +139,13 @@ var _ = Describe("Podman cp", func() {
|
|||
// give the right content.
|
||||
It("podman cp symlink", func() {
|
||||
srcFile, err := os.CreateTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer srcFile.Close()
|
||||
defer os.Remove(srcFile.Name())
|
||||
|
||||
originalContent := []byte("podman cp symlink test")
|
||||
err = os.WriteFile(srcFile.Name(), originalContent, 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "-d", ALPINE, "top"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -178,13 +178,13 @@ var _ = Describe("Podman cp", func() {
|
|||
// data to the volume and not the container.
|
||||
It("podman cp volume", func() {
|
||||
srcFile, err := os.CreateTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer srcFile.Close()
|
||||
defer os.Remove(srcFile.Name())
|
||||
|
||||
originalContent := []byte("podman cp volume")
|
||||
err = os.WriteFile(srcFile.Name(), originalContent, 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session := podmanTest.Podman([]string{"volume", "create", "data"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
|
@ -205,7 +205,7 @@ var _ = Describe("Podman cp", func() {
|
|||
|
||||
volumeMountPoint := session.OutputToString()
|
||||
copiedContent, err := os.ReadFile(filepath.Join(volumeMountPoint, "file.txt"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(copiedContent).To(Equal(originalContent))
|
||||
})
|
||||
|
||||
|
@ -214,7 +214,7 @@ var _ = Describe("Podman cp", func() {
|
|||
// access it, and (roughly) the right users own it.
|
||||
It("podman cp from ctr chown ", func() {
|
||||
srcFile, err := os.CreateTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer srcFile.Close()
|
||||
defer os.Remove(srcFile.Name())
|
||||
|
||||
|
@ -236,10 +236,10 @@ var _ = Describe("Podman cp", func() {
|
|||
|
||||
// owner of the file copied to local machine is not testuser
|
||||
u, err := user.Current()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
cmd := exec.Command("ls", "-l", srcFile.Name())
|
||||
cmdRet, err := cmd.Output()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(string(cmdRet)).To(ContainSubstring(u.Username))
|
||||
|
||||
session = podmanTest.Podman([]string{"cp", "--pause=false", srcFile.Name(), "testctr:testfile2"})
|
||||
|
@ -265,7 +265,7 @@ var _ = Describe("Podman cp", func() {
|
|||
Expect(session).Should(Exit(0))
|
||||
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session = podmanTest.Podman([]string{"cp", container + ":/", tmpDir})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -274,7 +274,7 @@ var _ = Describe("Podman cp", func() {
|
|||
cmd := exec.Command("ls", "-la", tmpDir)
|
||||
output, err := cmd.Output()
|
||||
lsOutput := string(output)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(lsOutput).To(ContainSubstring("dummy.txt"))
|
||||
Expect(lsOutput).To(ContainSubstring("tmp"))
|
||||
Expect(lsOutput).To(ContainSubstring("etc"))
|
||||
|
|
|
@ -23,7 +23,7 @@ var _ = Describe("Podman create", func() {
|
|||
|
||||
BeforeEach(func() {
|
||||
tempdir, err = CreateTempDirInTempDir()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
podmanTest = PodmanTestCreate(tempdir)
|
||||
podmanTest.Setup()
|
||||
})
|
||||
|
@ -146,10 +146,10 @@ var _ = Describe("Podman create", func() {
|
|||
It("podman create --mount flag with multiple mounts", func() {
|
||||
vol1 := filepath.Join(podmanTest.TempDir, "vol-test1")
|
||||
err := os.MkdirAll(vol1, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
vol2 := filepath.Join(podmanTest.TempDir, "vol-test2")
|
||||
err = os.MkdirAll(vol2, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"create", "--name", "test", "--mount", "type=bind,src=" + vol1 + ",target=/myvol1,z", "--mount", "type=bind,src=" + vol2 + ",target=/myvol2,z", ALPINE, "touch", "/myvol2/foo.txt"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -224,7 +224,7 @@ var _ = Describe("Podman create", func() {
|
|||
Expect(session).Should(Exit(125))
|
||||
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
podName := "rudolph"
|
||||
|
|
|
@ -39,7 +39,7 @@ var _ = Describe("Podman diff", func() {
|
|||
session := podmanTest.Podman([]string{"diff", ALPINE})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
|
||||
Expect(session.OutputToStringArray()).ToNot(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman diff bogus image", func() {
|
||||
|
@ -135,7 +135,7 @@ RUN echo test
|
|||
session := podmanTest.Podman([]string{"image", "diff", BB})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
|
||||
Expect(session.OutputToStringArray()).ToNot(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman image diff bogus image", func() {
|
||||
|
|
|
@ -56,7 +56,7 @@ var _ = Describe("Podman events", func() {
|
|||
result := podmanTest.Podman([]string{"events", "--stream=false", "--filter", "event=start"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(len(result.OutputToStringArray())).To(BeNumerically(">=", 1), "Number of events")
|
||||
Expect(result.OutputToStringArray()).ToNot(BeEmpty(), "Number of events")
|
||||
date := time.Now().Format("2006-01-02")
|
||||
Expect(result.OutputToStringArray()).To(ContainElement(HavePrefix(date)), "event log has correct timestamp")
|
||||
})
|
||||
|
@ -194,7 +194,7 @@ var _ = Describe("Podman events", func() {
|
|||
tEnd := time.Now()
|
||||
outDur := tEnd.Sub(untilT)
|
||||
diff := outDur.Seconds() > 0
|
||||
Expect(diff).To(Equal(true))
|
||||
Expect(diff).To(BeTrue())
|
||||
Expect(result.OutputToString()).To(ContainSubstring(name1))
|
||||
Expect(result.OutputToString()).To(ContainSubstring(name2))
|
||||
Expect(result.OutputToString()).To(ContainSubstring(name3))
|
||||
|
@ -242,7 +242,7 @@ var _ = Describe("Podman events", func() {
|
|||
result := podmanTest.Podman([]string{"events", "--stream=false", "--filter", "event=health_status", "--since", "1m"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(len(result.OutputToStringArray())).To(BeNumerically(">=", 1), "Number of health_status events")
|
||||
Expect(result.OutputToStringArray()).ToNot(BeEmpty(), "Number of health_status events")
|
||||
})
|
||||
|
||||
})
|
||||
|
|
|
@ -453,7 +453,7 @@ var _ = Describe("Podman exec", func() {
|
|||
Expect(setup).Should(Exit(0))
|
||||
|
||||
devNull, err := os.Open("/dev/null")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer devNull.Close()
|
||||
files := []*os.File{
|
||||
devNull,
|
||||
|
@ -545,7 +545,7 @@ RUN useradd -u 1000 auser`, fedoraMinimal)
|
|||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
|
|
@ -42,10 +42,10 @@ var _ = Describe("Podman export", func() {
|
|||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
_, err := os.Stat(outfile)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
err = os.Remove(outfile)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman container export output flag", func() {
|
||||
|
@ -57,10 +57,10 @@ var _ = Describe("Podman export", func() {
|
|||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
_, err := os.Stat(outfile)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
err = os.Remove(outfile)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman export bad filename", func() {
|
||||
|
|
|
@ -64,7 +64,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pod.Spec).To(HaveField("HostNetwork", false))
|
||||
Expect(pod.Spec.SecurityContext).To(BeNil())
|
||||
Expect(pod.Spec.DNSConfig).To(BeNil())
|
||||
|
@ -94,7 +94,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(kube.OutputToString()).To(ContainSubstring("level: s0:c100,c200"))
|
||||
})
|
||||
|
||||
|
@ -109,7 +109,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err = yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(kube.OutputToString()).To(ContainSubstring("type: spc_t"))
|
||||
|
||||
})
|
||||
|
@ -125,7 +125,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err = yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(kube.OutputToString()).To(ContainSubstring("type: foo_bar_t"))
|
||||
})
|
||||
|
||||
|
@ -144,13 +144,13 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
svc := new(v1.Service)
|
||||
err := yaml.Unmarshal([]byte(arr[0]), svc)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(svc.Spec.Ports).To(HaveLen(1))
|
||||
Expect(svc.Spec.Ports[0].TargetPort.IntValue()).To(Equal(3890))
|
||||
|
||||
pod := new(v1.Pod)
|
||||
err = yaml.Unmarshal([]byte(arr[1]), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman generate kube on pod", func() {
|
||||
|
@ -167,7 +167,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pod.Spec).To(HaveField("HostNetwork", false))
|
||||
enableServiceLinks := false
|
||||
Expect(pod.Spec).To(HaveField("EnableServiceLinks", &enableServiceLinks))
|
||||
|
@ -217,7 +217,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pod.Spec).To(HaveField("HostNetwork", false))
|
||||
|
||||
numContainers := len(pod.Spec.Containers) + len(pod.Spec.InitContainers)
|
||||
|
@ -238,7 +238,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod = new(v1.Pod)
|
||||
err = yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pod.Spec).To(HaveField("HostNetwork", false))
|
||||
|
||||
numContainers = len(pod.Spec.Containers) + len(pod.Spec.InitContainers)
|
||||
|
@ -263,7 +263,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod = new(v1.Pod)
|
||||
err = yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pod.Spec).To(HaveField("HostNetwork", false))
|
||||
|
||||
numContainers = len(pod.Spec.Containers) + len(pod.Spec.InitContainers)
|
||||
|
@ -272,7 +272,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
It("podman generate kube on pod with user namespace", func() {
|
||||
u, err := user.Current()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
name := u.Name
|
||||
if name == "root" {
|
||||
name = "containers"
|
||||
|
@ -298,7 +298,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err = yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
expected := false
|
||||
Expect(pod.Spec).To(HaveField("HostUsers", &expected))
|
||||
})
|
||||
|
@ -318,7 +318,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pod.Spec).To(HaveField("HostNetwork", true))
|
||||
})
|
||||
|
||||
|
@ -333,7 +333,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pod.Spec).To(HaveField("HostNetwork", true))
|
||||
})
|
||||
|
||||
|
@ -363,7 +363,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pod.Spec.HostAliases).To(HaveLen(2))
|
||||
Expect(pod.Spec.HostAliases[0]).To(HaveField("IP", testIP))
|
||||
Expect(pod.Spec.HostAliases[1]).To(HaveField("IP", testIP))
|
||||
|
@ -402,7 +402,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pod.Spec.Containers).To(HaveLen(2))
|
||||
Expect(pod.Spec.Containers[0].Ports[0].ContainerPort).To(Equal(int32(8000)))
|
||||
Expect(pod.Spec.Containers[1].Ports[0].ContainerPort).To(Equal(int32(5000)))
|
||||
|
@ -445,7 +445,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pod.Spec.Containers).To(HaveLen(2))
|
||||
Expect(pod.Spec.Hostname).To(Equal(ctr1HostName))
|
||||
|
||||
|
@ -467,7 +467,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod = new(v1.Pod)
|
||||
err = yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pod.Spec.Containers).To(HaveLen(1))
|
||||
Expect(pod.Spec.Hostname).To(BeEmpty())
|
||||
})
|
||||
|
@ -487,14 +487,14 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
svc := new(v1.Service)
|
||||
err := yaml.Unmarshal([]byte(arr[0]), svc)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(svc.Spec.Ports).To(HaveLen(1))
|
||||
Expect(svc.Spec.Ports[0].TargetPort.IntValue()).To(Equal(4000))
|
||||
Expect(svc.Spec.Ports[0]).To(HaveField("Protocol", v1.ProtocolUDP))
|
||||
|
||||
pod := new(v1.Pod)
|
||||
err = yaml.Unmarshal([]byte(arr[1]), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman generate kube on pod with restartPolicy", func() {
|
||||
|
@ -524,7 +524,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(string(pod.Spec.RestartPolicy)).To(Equal(v[2]))
|
||||
}
|
||||
|
@ -548,7 +548,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
for _, ctr := range pod.Spec.Containers {
|
||||
memoryLimit, _ := ctr.Resources.Limits.Memory().AsInt64()
|
||||
|
@ -581,7 +581,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
for _, ctr := range pod.Spec.Containers {
|
||||
cpuLimit := ctr.Resources.Limits.Cpu().MilliValue()
|
||||
|
@ -616,7 +616,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
foundPort4000 := 0
|
||||
foundPort5000 := 0
|
||||
|
@ -651,7 +651,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod = new(v1.Pod)
|
||||
err = yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
containers := pod.Spec.Containers
|
||||
Expect(containers).To(HaveLen(1))
|
||||
|
@ -736,7 +736,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
It("podman generate kube with volume", func() {
|
||||
vol1 := filepath.Join(podmanTest.TempDir, "vol-test1")
|
||||
err := os.MkdirAll(vol1, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// we need a container name because IDs don't persist after rm/play
|
||||
ctrName := "test-ctr"
|
||||
|
@ -755,7 +755,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
Expect(err).ShouldNot(HaveOccurred())
|
||||
pod := new(v1.Pod)
|
||||
err = yaml.Unmarshal(b, pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pod.Annotations).To(HaveKeyWithValue(define.BindMountPrefix, vol1+":"+"z"))
|
||||
|
||||
rm := podmanTest.Podman([]string{"pod", "rm", "-t", "0", "-f", "test1"})
|
||||
|
@ -789,7 +789,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(pod.Spec.Volumes).To(HaveLen(2))
|
||||
|
||||
|
@ -921,11 +921,11 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(pod.Spec.DNSConfig.Nameservers).To(ContainElement("8.8.8.8"))
|
||||
Expect(pod.Spec.DNSConfig.Searches).To(ContainElement("foobar.com"))
|
||||
Expect(len(pod.Spec.DNSConfig.Options)).To(BeNumerically(">", 0))
|
||||
Expect(pod.Spec.DNSConfig.Options).ToNot(BeEmpty())
|
||||
Expect(pod.Spec.DNSConfig.Options[0]).To(HaveField("Name", "color"))
|
||||
s := "blue"
|
||||
Expect(pod.Spec.DNSConfig.Options[0]).To(HaveField("Value", &s))
|
||||
|
@ -946,7 +946,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(pod.Spec.DNSConfig.Nameservers).To(ContainElement("8.8.8.8"))
|
||||
Expect(pod.Spec.DNSConfig.Nameservers).To(ContainElement("8.7.7.7"))
|
||||
|
@ -965,11 +965,11 @@ var _ = Describe("Podman generate kube", func() {
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(pod.Spec.DNSConfig.Nameservers).To(ContainElement("8.8.8.8"))
|
||||
Expect(pod.Spec.DNSConfig.Searches).To(ContainElement("foobar.com"))
|
||||
Expect(len(pod.Spec.DNSConfig.Options)).To(BeNumerically(">", 0))
|
||||
Expect(pod.Spec.DNSConfig.Options).ToNot(BeEmpty())
|
||||
Expect(pod.Spec.DNSConfig.Options[0]).To(HaveField("Name", "color"))
|
||||
s := "blue"
|
||||
Expect(pod.Spec.DNSConfig.Options[0]).To(HaveField("Value", &s))
|
||||
|
@ -988,7 +988,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
// entrypoint and it's arguments to "10s".
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
containers := pod.Spec.Containers
|
||||
Expect(containers).To(HaveLen(1))
|
||||
|
@ -1010,7 +1010,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
// image command.
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
containers := pod.Spec.Containers
|
||||
Expect(containers).To(HaveLen(1))
|
||||
|
@ -1029,7 +1029,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||
// command passed via the cli to podman create.
|
||||
pod = new(v1.Pod)
|
||||
err = yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
containers = pod.Spec.Containers
|
||||
Expect(containers).To(HaveLen(1))
|
||||
|
@ -1042,10 +1042,10 @@ var _ = Describe("Podman generate kube", func() {
|
|||
ENTRYPOINT ["sleep"]`
|
||||
|
||||
targetPath, err := CreateTempDirInTempDir()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
containerfilePath := filepath.Join(targetPath, "Containerfile")
|
||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
image := "generatekube:test"
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "-f", containerfilePath, "-t", image})
|
||||
|
@ -1064,7 +1064,7 @@ ENTRYPOINT ["sleep"]`
|
|||
// entrypoint but the arguments should be set to "10s".
|
||||
pod := new(v1.Pod)
|
||||
err = yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
containers := pod.Spec.Containers
|
||||
Expect(containers).To(HaveLen(1))
|
||||
|
@ -1082,7 +1082,7 @@ ENTRYPOINT ["sleep"]`
|
|||
// entrypoint defined by the --entrypoint flag and the arguments should be set to "hello".
|
||||
pod = new(v1.Pod)
|
||||
err = yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
containers = pod.Spec.Containers
|
||||
Expect(containers).To(HaveLen(1))
|
||||
|
@ -1102,7 +1102,7 @@ ENTRYPOINT ["sleep"]`
|
|||
// Now make sure that the capabilities aren't set.
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
containers := pod.Spec.Containers
|
||||
Expect(containers).To(HaveLen(1))
|
||||
|
@ -1132,10 +1132,10 @@ RUN adduser -u 10001 -S test1
|
|||
USER test1`
|
||||
|
||||
targetPath, err := CreateTempDirInTempDir()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
containerfilePath := filepath.Join(targetPath, "Containerfile")
|
||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
image := "generatekube:test"
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "-f", containerfilePath, "-t", image})
|
||||
|
@ -1152,7 +1152,7 @@ USER test1`
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err = yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pod.Spec.Containers[0].SecurityContext.RunAsUser).To(BeNil())
|
||||
})
|
||||
|
||||
|
@ -1169,7 +1169,7 @@ USER test1`
|
|||
|
||||
pvc := new(v1.PersistentVolumeClaim)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pvc)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pvc).To(HaveField("Name", vol))
|
||||
Expect(pvc.Spec.AccessModes[0]).To(Equal(v1.ReadWriteOnce))
|
||||
Expect(pvc.Spec.Resources.Requests.Storage().String()).To(Equal("1Gi"))
|
||||
|
@ -1191,7 +1191,7 @@ USER test1`
|
|||
|
||||
pvc := new(v1.PersistentVolumeClaim)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pvc)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pvc).To(HaveField("Name", vol))
|
||||
Expect(pvc.Spec.AccessModes[0]).To(Equal(v1.ReadWriteOnce))
|
||||
Expect(pvc.Spec.Resources.Requests.Storage().String()).To(Equal("1Gi"))
|
||||
|
@ -1219,7 +1219,7 @@ USER test1`
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(pod.Annotations).To(HaveKeyWithValue("io.containers.autoupdate/top", "local"))
|
||||
})
|
||||
|
@ -1243,7 +1243,7 @@ USER test1`
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pod.Spec.Containers[0]).To(HaveField("WorkingDir", ""))
|
||||
Expect(pod.Spec.Containers[1]).To(HaveField("WorkingDir", "/root"))
|
||||
|
||||
|
@ -1272,14 +1272,14 @@ USER test1`
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(pod.Spec.Containers[0].Env).To(HaveLen(2))
|
||||
})
|
||||
|
||||
It("podman generate kube omit secret if empty", func() {
|
||||
dir, err := os.MkdirTemp(tempdir, "podman")
|
||||
Expect(err).Should(BeNil())
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
|
@ -1295,7 +1295,7 @@ USER test1`
|
|||
|
||||
pod := new(v1.Pod)
|
||||
err = yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(pod.Spec.Volumes[0].Secret).To(BeNil())
|
||||
})
|
||||
|
|
|
@ -550,7 +550,7 @@ var _ = Describe("Podman generate systemd", func() {
|
|||
|
||||
It("podman generate systemd pod with containers --new", func() {
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
tmpFile := tmpDir + "podID"
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
|
|
|
@ -293,24 +293,24 @@ var _ = Describe("Podman healthcheck run", func() {
|
|||
|
||||
It("Verify default time is used and no utf-8 escapes", func() {
|
||||
cwd, err := os.Getwd()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
podmanTest.AddImageToRWStore(ALPINE)
|
||||
// Write target and fake files
|
||||
targetPath, err := CreateTempDirInTempDir()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
containerfile := fmt.Sprintf(`FROM %s
|
||||
HEALTHCHECK CMD ls -l / 2>&1`, ALPINE)
|
||||
containerfilePath := filepath.Join(targetPath, "Containerfile")
|
||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer func() {
|
||||
Expect(os.Chdir(cwd)).To(BeNil())
|
||||
Expect(os.RemoveAll(targetPath)).To(BeNil())
|
||||
Expect(os.Chdir(cwd)).To(Succeed())
|
||||
Expect(os.RemoveAll(targetPath)).To(Succeed())
|
||||
}()
|
||||
|
||||
// make cwd as context root path
|
||||
Expect(os.Chdir(targetPath)).To(BeNil())
|
||||
Expect(os.Chdir(targetPath)).To(Succeed())
|
||||
|
||||
session := podmanTest.Podman([]string{"build", "--format", "docker", "-t", "test", "."})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
|
|
@ -36,41 +36,41 @@ var _ = Describe("Podman history", func() {
|
|||
session := podmanTest.Podman([]string{"history", ALPINE})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
|
||||
Expect(session.OutputToStringArray()).ToNot(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman history with GO template", func() {
|
||||
session := podmanTest.Podman([]string{"history", "--format", "{{.ID}} {{.Created}}", ALPINE})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
|
||||
Expect(session.OutputToStringArray()).ToNot(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman history with human flag", func() {
|
||||
session := podmanTest.Podman([]string{"history", "--human=false", ALPINE})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
|
||||
Expect(session.OutputToStringArray()).ToNot(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman history with quiet flag", func() {
|
||||
session := podmanTest.Podman([]string{"history", "-qH", ALPINE})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
|
||||
Expect(session.OutputToStringArray()).ToNot(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman history with no-trunc flag", func() {
|
||||
session := podmanTest.Podman([]string{"history", "--no-trunc", ALPINE})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
|
||||
Expect(session.OutputToStringArray()).ToNot(BeEmpty())
|
||||
|
||||
session = podmanTest.Podman([]string{"history", "--no-trunc", "--format", "{{.ID}}", ALPINE})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
lines := session.OutputToStringArray()
|
||||
Expect(len(lines)).To(BeNumerically(">", 0))
|
||||
Expect(lines).ToNot(BeEmpty())
|
||||
// the image id must be 64 chars long
|
||||
Expect(lines[0]).To(HaveLen(64))
|
||||
|
||||
|
@ -78,7 +78,7 @@ var _ = Describe("Podman history", func() {
|
|||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
lines = session.OutputToStringArray()
|
||||
Expect(len(lines)).To(BeNumerically(">", 0))
|
||||
Expect(lines).ToNot(BeEmpty())
|
||||
Expect(session.OutputToString()).ToNot(ContainSubstring("..."))
|
||||
// the second line in the alpine history contains a command longer than 45 chars
|
||||
Expect(len(lines[1])).To(BeNumerically(">", 45))
|
||||
|
|
|
@ -29,11 +29,11 @@ var _ = Describe("Podman image sign", func() {
|
|||
podmanTest.Setup()
|
||||
tempGNUPGHOME := filepath.Join(podmanTest.TempDir, "tmpGPG")
|
||||
err := os.Mkdir(tempGNUPGHOME, os.ModePerm)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
origGNUPGHOME = os.Getenv("GNUPGHOME")
|
||||
err = os.Setenv("GNUPGHOME", tempGNUPGHOME)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
})
|
||||
|
||||
|
@ -47,29 +47,29 @@ var _ = Describe("Podman image sign", func() {
|
|||
It("podman sign image", func() {
|
||||
cmd := exec.Command("gpg", "--import", "sign/secret-key.asc")
|
||||
err := cmd.Run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
sigDir := filepath.Join(podmanTest.TempDir, "test-sign")
|
||||
err = os.MkdirAll(sigDir, os.ModePerm)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session := podmanTest.Podman([]string{"image", "sign", "--directory", sigDir, "--sign-by", "foo@bar.com", "docker://library/alpine"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
_, err = os.Stat(filepath.Join(sigDir, "library"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman sign --all multi-arch image", func() {
|
||||
cmd := exec.Command("gpg", "--import", "sign/secret-key.asc")
|
||||
err := cmd.Run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
sigDir := filepath.Join(podmanTest.TempDir, "test-sign-multi")
|
||||
err = os.MkdirAll(sigDir, os.ModePerm)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session := podmanTest.Podman([]string{"image", "sign", "--all", "--directory", sigDir, "--sign-by", "foo@bar.com", "docker://library/alpine"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
fInfos, err := os.ReadDir(filepath.Join(sigDir, "library"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(fInfos)).To(BeNumerically(">", 1), "len(fInfos)")
|
||||
})
|
||||
})
|
||||
|
|
|
@ -171,7 +171,7 @@ RUN echo hello > /hello
|
|||
result := podmanTest.Podman([]string{"images", "-q", "-f", "before=foobar.com/before:latest"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(len(result.OutputToStringArray())).To(BeNumerically(">=", 1))
|
||||
Expect(result.OutputToStringArray()).ToNot(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman images workingdir from image", func() {
|
||||
|
|
|
@ -94,27 +94,27 @@ var _ = Describe("Podman Info", func() {
|
|||
os.Unsetenv("CONTAINERS_STORAGE_CONF")
|
||||
}()
|
||||
err := os.RemoveAll(filepath.Dir(configPath))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
err = os.MkdirAll(filepath.Dir(configPath), os.ModePerm)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
rootlessStoragePath := `"/tmp/$HOME/$USER/$UID/storage"`
|
||||
driver := `"overlay"`
|
||||
storageOpt := `"/usr/bin/fuse-overlayfs"`
|
||||
storageConf := []byte(fmt.Sprintf("[storage]\ndriver=%s\nrootless_storage_path=%s\n[storage.options]\nmount_program=%s", driver, rootlessStoragePath, storageOpt))
|
||||
err = os.WriteFile(configPath, storageConf, os.ModePerm)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
u, err := user.Current()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Cannot use podmanTest.Podman() and test for storage path
|
||||
expect := filepath.Join("/tmp", os.Getenv("HOME"), u.Username, u.Uid, "storage")
|
||||
podmanPath := podmanTest.PodmanTest.PodmanBinary
|
||||
cmd := exec.Command(podmanPath, "info", "--format", "{{.Store.GraphRoot -}}")
|
||||
out, err := cmd.CombinedOutput()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(string(out)).To(Equal(expect))
|
||||
})
|
||||
|
||||
|
|
|
@ -500,7 +500,7 @@ var _ = Describe("Podman inspect", func() {
|
|||
|
||||
data := inspect.InspectContainerToJSON()
|
||||
ulimits := data[0].HostConfig.Ulimits
|
||||
Expect(len(ulimits)).To(BeNumerically(">", 0))
|
||||
Expect(ulimits).ToNot(BeEmpty())
|
||||
found := false
|
||||
for _, ulimit := range ulimits {
|
||||
if ulimit.Name == "RLIMIT_CORE" {
|
||||
|
|
|
@ -150,7 +150,7 @@ var _ = Describe("Podman kill", func() {
|
|||
|
||||
It("podman kill --cidfile", func() {
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
tmpFile := tmpDir + "cid"
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
|
@ -170,12 +170,12 @@ var _ = Describe("Podman kill", func() {
|
|||
|
||||
It("podman kill multiple --cidfile", func() {
|
||||
tmpDir1, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
tmpFile1 := tmpDir1 + "cid"
|
||||
defer os.RemoveAll(tmpDir1)
|
||||
|
||||
tmpDir2, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
tmpFile2 := tmpDir2 + "cid"
|
||||
defer os.RemoveAll(tmpDir2)
|
||||
|
||||
|
|
|
@ -101,11 +101,11 @@ var _ = Describe("Podman login and logout", func() {
|
|||
|
||||
readAuthInfo := func(filePath string) map[string]interface{} {
|
||||
authBytes, err := os.ReadFile(filePath)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
var authInfo map[string]interface{}
|
||||
err = json.Unmarshal(authBytes, &authInfo)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
fmt.Println(authInfo)
|
||||
|
||||
const authsKey = "auths"
|
||||
|
@ -137,12 +137,12 @@ var _ = Describe("Podman login and logout", func() {
|
|||
|
||||
It("podman login and logout without registry parameter", func() {
|
||||
registriesConf, err := os.CreateTemp("", "TestLoginWithoutParameter")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer registriesConf.Close()
|
||||
defer os.Remove(registriesConf.Name())
|
||||
|
||||
err = os.WriteFile(registriesConf.Name(), registriesConfWithSearch, os.ModePerm)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Environment is per-process, so this looks very unsafe; actually it seems fine because tests are not
|
||||
// run in parallel unless they opt in by calling t.Parallel(). So don’t do that.
|
||||
|
@ -451,7 +451,7 @@ var _ = Describe("Podman login and logout", func() {
|
|||
"%s/podmantest": { "auth": "cG9kbWFudGVzdDp3cm9uZw==" },
|
||||
"%s": { "auth": "cG9kbWFudGVzdDp0ZXN0" }
|
||||
}}`, server, server)), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{
|
||||
"push",
|
||||
|
@ -498,7 +498,7 @@ var _ = Describe("Podman login and logout", func() {
|
|||
"%s/podmantest": { "auth": "cG9kbWFudGVzdDp0ZXN0" },
|
||||
"%s": { "auth": "cG9kbWFudGVzdDp0ZXN0" }
|
||||
}}`, server, server, server)), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session = podmanTest.Podman([]string{
|
||||
"pull",
|
||||
|
|
|
@ -482,7 +482,7 @@ var _ = Describe("Podman logs", func() {
|
|||
|
||||
cmd := exec.Command("journalctl", "--no-pager", "-o", "json", "--output-fields=CONTAINER_TAG", fmt.Sprintf("CONTAINER_ID_FULL=%s", cid))
|
||||
out, err := cmd.CombinedOutput()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(string(out)).To(ContainSubstring("alpine"))
|
||||
})
|
||||
|
||||
|
@ -500,7 +500,7 @@ var _ = Describe("Podman logs", func() {
|
|||
|
||||
cmd := exec.Command("journalctl", "--no-pager", "-o", "json", "--output-fields=CONTAINER_NAME", fmt.Sprintf("CONTAINER_ID_FULL=%s", cid))
|
||||
out, err := cmd.CombinedOutput()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(string(out)).To(ContainSubstring(containerName))
|
||||
})
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ var _ = Describe("Podman manifest", func() {
|
|||
|
||||
var inspect libimage.ManifestListData
|
||||
err := json.Unmarshal(session.Out.Contents(), &inspect)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(inspect.Manifests[0].Annotations).To(Equal(map[string]string{"hoge": "fuga"}))
|
||||
})
|
||||
|
||||
|
@ -274,7 +274,7 @@ var _ = Describe("Podman manifest", func() {
|
|||
Expect(session).Should(Exit(0))
|
||||
dest := filepath.Join(podmanTest.TempDir, "pushed")
|
||||
err := os.MkdirAll(dest, os.ModePerm)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer func() {
|
||||
os.RemoveAll(dest)
|
||||
}()
|
||||
|
@ -308,7 +308,7 @@ var _ = Describe("Podman manifest", func() {
|
|||
Expect(session).Should(Exit(0))
|
||||
dest := filepath.Join(podmanTest.TempDir, "pushed")
|
||||
err := os.MkdirAll(dest, os.ModePerm)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer func() {
|
||||
os.RemoveAll(dest)
|
||||
}()
|
||||
|
@ -316,7 +316,7 @@ var _ = Describe("Podman manifest", func() {
|
|||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
files, err := filepath.Glob(dest + string(os.PathSeparator) + "*")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
check := SystemExec("sha256sum", files)
|
||||
check.WaitWithDefaultTimeout()
|
||||
Expect(check).Should(Exit(0))
|
||||
|
@ -342,7 +342,7 @@ var _ = Describe("Podman manifest", func() {
|
|||
Expect(session).Should(Exit(0))
|
||||
dest := filepath.Join(podmanTest.TempDir, "pushed")
|
||||
err := os.MkdirAll(dest, os.ModePerm)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer func() {
|
||||
os.RemoveAll(dest)
|
||||
}()
|
||||
|
@ -355,13 +355,13 @@ var _ = Describe("Podman manifest", func() {
|
|||
blobsDir := filepath.Join(dest, "blobs", "sha256")
|
||||
|
||||
blobs, err := os.ReadDir(blobsDir)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
for _, f := range blobs {
|
||||
blobPath := filepath.Join(blobsDir, f.Name())
|
||||
|
||||
sourceFile, err := os.ReadFile(blobPath)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
compressionType := archive.DetectCompression(sourceFile)
|
||||
if compressionType == archive.Zstd {
|
||||
|
@ -381,7 +381,7 @@ var _ = Describe("Podman manifest", func() {
|
|||
|
||||
dest := filepath.Join(podmanTest.TempDir, "pushed")
|
||||
err := os.MkdirAll(dest, os.ModePerm)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer func() {
|
||||
os.RemoveAll(dest)
|
||||
}()
|
||||
|
@ -412,10 +412,10 @@ var _ = Describe("Podman manifest", func() {
|
|||
}
|
||||
os.Setenv("PODMAN", podmanTest.PodmanBinary+" "+opts)
|
||||
registry, err := podmanRegistry.StartWithOptions(registryOptions)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer func() {
|
||||
err := registry.Stop()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
os.Unsetenv("PODMAN")
|
||||
}()
|
||||
|
||||
|
@ -480,7 +480,7 @@ var _ = Describe("Podman manifest", func() {
|
|||
Expect(session).Should(Exit(0))
|
||||
dest := filepath.Join(podmanTest.TempDir, "pushed")
|
||||
err := os.MkdirAll(dest, os.ModePerm)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer func() {
|
||||
os.RemoveAll(dest)
|
||||
}()
|
||||
|
|
|
@ -55,7 +55,7 @@ var _ = Describe("Podman network create", func() {
|
|||
// JSON the network configuration into something usable
|
||||
var results []types.Network
|
||||
err := json.Unmarshal([]byte(inspect.OutputToString()), &results)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(results).To(HaveLen(1))
|
||||
result := results[0]
|
||||
Expect(result).To(HaveField("Name", netName))
|
||||
|
@ -75,10 +75,10 @@ var _ = Describe("Podman network create", func() {
|
|||
Expect(try).To(Exit(0))
|
||||
|
||||
_, subnet, err := net.ParseCIDR("10.11.12.0/24")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Note this is an IPv4 test only!
|
||||
containerIP, _, err := net.ParseCIDR(try.OutputToString())
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Ensure that the IP the container got is within the subnet the user asked for
|
||||
Expect(subnet.Contains(containerIP)).To(BeTrue())
|
||||
})
|
||||
|
@ -98,7 +98,7 @@ var _ = Describe("Podman network create", func() {
|
|||
// JSON the network configuration into something usable
|
||||
var results []types.Network
|
||||
err := json.Unmarshal([]byte(inspect.OutputToString()), &results)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(results).To(HaveLen(1))
|
||||
result := results[0]
|
||||
Expect(result).To(HaveField("Name", netName))
|
||||
|
@ -115,9 +115,9 @@ var _ = Describe("Podman network create", func() {
|
|||
Expect(try).To(Exit(0))
|
||||
|
||||
_, subnet, err := net.ParseCIDR("fd00:1:2:3:4::/64")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
containerIP, _, err := net.ParseCIDR(try.OutputToString())
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Ensure that the IP the container got is within the subnet the user asked for
|
||||
Expect(subnet.Contains(containerIP)).To(BeTrue())
|
||||
})
|
||||
|
@ -137,7 +137,7 @@ var _ = Describe("Podman network create", func() {
|
|||
// JSON the network configuration into something usable
|
||||
var results []types.Network
|
||||
err := json.Unmarshal([]byte(inspect.OutputToString()), &results)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(results).To(HaveLen(1))
|
||||
result := results[0]
|
||||
Expect(result).To(HaveField("Name", netName))
|
||||
|
@ -146,9 +146,9 @@ var _ = Describe("Podman network create", func() {
|
|||
Expect(result.Subnets[1].Subnet.IP).ToNot(BeNil())
|
||||
|
||||
_, subnet11, err := net.ParseCIDR(result.Subnets[0].Subnet.String())
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, subnet12, err := net.ParseCIDR(result.Subnets[1].Subnet.String())
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Once a container executes a new network, the nic will be created. We should clean those up
|
||||
// best we can
|
||||
|
@ -169,7 +169,7 @@ var _ = Describe("Podman network create", func() {
|
|||
|
||||
// JSON the network configuration into something usable
|
||||
err = json.Unmarshal([]byte(inspect.OutputToString()), &results)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(results).To(HaveLen(1))
|
||||
result = results[0]
|
||||
Expect(result).To(HaveField("Name", netName2))
|
||||
|
@ -178,9 +178,9 @@ var _ = Describe("Podman network create", func() {
|
|||
Expect(result.Subnets[1].Subnet.IP).ToNot(BeNil())
|
||||
|
||||
_, subnet21, err := net.ParseCIDR(result.Subnets[0].Subnet.String())
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, subnet22, err := net.ParseCIDR(result.Subnets[1].Subnet.String())
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// check that the subnets do not overlap
|
||||
Expect(subnet11.Contains(subnet21.IP)).To(BeFalse())
|
||||
|
@ -190,16 +190,16 @@ var _ = Describe("Podman network create", func() {
|
|||
try.WaitWithDefaultTimeout()
|
||||
|
||||
_, subnet, err := net.ParseCIDR("fd00:4:3:2:1::/64")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
containerIP, _, err := net.ParseCIDR(try.OutputToString())
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Ensure that the IP the container got is within the subnet the user asked for
|
||||
Expect(subnet.Contains(containerIP)).To(BeTrue())
|
||||
// verify the container has an IPv4 address too (the IPv4 subnet is autogenerated)
|
||||
try = podmanTest.Podman([]string{"run", "-it", "--rm", "--network", netName, ALPINE, "sh", "-c", "ip addr show eth0 | awk ' /inet / {print $2}'"})
|
||||
try.WaitWithDefaultTimeout()
|
||||
containerIP, _, err = net.ParseCIDR(try.OutputToString())
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(containerIP.To4()).To(Not(BeNil()))
|
||||
})
|
||||
|
||||
|
|
|
@ -618,7 +618,7 @@ var _ = Describe("Podman network", func() {
|
|||
// JSON the network configuration into something usable
|
||||
var results []types.Network
|
||||
err := json.Unmarshal([]byte(inspect.OutputToString()), &results)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(results).To(HaveLen(1))
|
||||
result := results[0]
|
||||
Expect(result).To(HaveField("NetworkInterface", ""))
|
||||
|
@ -644,7 +644,7 @@ var _ = Describe("Podman network", func() {
|
|||
|
||||
var results []types.Network
|
||||
err := json.Unmarshal([]byte(inspect.OutputToString()), &results)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(results).To(HaveLen(1))
|
||||
result := results[0]
|
||||
|
||||
|
@ -687,7 +687,7 @@ var _ = Describe("Podman network", func() {
|
|||
|
||||
var results []types.Network
|
||||
err := json.Unmarshal([]byte(inspect.OutputToString()), &results)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(results).To(HaveLen(1))
|
||||
result := results[0]
|
||||
|
||||
|
|
|
@ -336,7 +336,7 @@ var _ = Describe("Podman pause", func() {
|
|||
|
||||
It("podman pause --cidfile", func() {
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
tmpFile := tmpDir + "cid"
|
||||
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
@ -365,7 +365,7 @@ var _ = Describe("Podman pause", func() {
|
|||
|
||||
It("podman pause multiple --cidfile", func() {
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
tmpFile1 := tmpDir + "cid-1"
|
||||
tmpFile2 := tmpDir + "cid-2"
|
||||
|
||||
|
|
|
@ -93,21 +93,21 @@ LABEL marge=mom
|
|||
// Setup
|
||||
yamlDir := filepath.Join(tempdir, RandomString(12))
|
||||
err := os.Mkdir(yamlDir, 0755)
|
||||
Expect(err).To(BeNil(), "mkdir "+yamlDir)
|
||||
Expect(err).ToNot(HaveOccurred(), "mkdir "+yamlDir)
|
||||
err = writeYaml(testYAML, filepath.Join(yamlDir, "top.yaml"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
app1Dir := filepath.Join(yamlDir, "foobar")
|
||||
err = os.Mkdir(app1Dir, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = writeYaml(playBuildFile, filepath.Join(app1Dir, "Dockerfile"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Write a file to be copied
|
||||
err = writeYaml(copyFile, filepath.Join(app1Dir, "copyfile"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Switch to temp dir and restore it afterwards
|
||||
cwd, err := os.Getwd()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(os.Chdir(yamlDir)).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(os.Chdir(yamlDir)).To(Succeed())
|
||||
defer func() { (Expect(os.Chdir(cwd)).To(BeNil())) }()
|
||||
|
||||
session := podmanTest.Podman([]string{"play", "kube", "top.yaml"})
|
||||
|
@ -122,7 +122,7 @@ LABEL marge=mom
|
|||
inspect.WaitWithDefaultTimeout()
|
||||
Expect(inspect).Should(Exit(0))
|
||||
inspectData := inspect.InspectContainerToJSON()
|
||||
Expect(len(inspectData)).To(BeNumerically(">", 0))
|
||||
Expect(inspectData).ToNot(BeEmpty())
|
||||
Expect(inspectData[0].Config.Labels).To(HaveKeyWithValue("homer", "dad"))
|
||||
})
|
||||
|
||||
|
@ -130,21 +130,21 @@ LABEL marge=mom
|
|||
// Setup
|
||||
yamlDir := filepath.Join(tempdir, RandomString(12))
|
||||
err := os.Mkdir(yamlDir, 0755)
|
||||
Expect(err).To(BeNil(), "mkdir "+yamlDir)
|
||||
Expect(err).ToNot(HaveOccurred(), "mkdir "+yamlDir)
|
||||
err = writeYaml(testYAML, filepath.Join(yamlDir, "top.yaml"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
app1Dir := filepath.Join(yamlDir, "foobar")
|
||||
err = os.Mkdir(app1Dir, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = writeYaml(playBuildFile, filepath.Join(app1Dir, "Containerfile"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Write a file to be copied
|
||||
err = writeYaml(copyFile, filepath.Join(app1Dir, "copyfile"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Switch to temp dir and restore it afterwards
|
||||
cwd, err := os.Getwd()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(os.Chdir(yamlDir)).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(os.Chdir(yamlDir)).To(Succeed())
|
||||
defer func() { (Expect(os.Chdir(cwd)).To(BeNil())) }()
|
||||
|
||||
session := podmanTest.Podman([]string{"play", "kube", "top.yaml"})
|
||||
|
@ -159,7 +159,7 @@ LABEL marge=mom
|
|||
inspect.WaitWithDefaultTimeout()
|
||||
Expect(inspect).Should(Exit(0))
|
||||
inspectData := inspect.InspectContainerToJSON()
|
||||
Expect(len(inspectData)).To(BeNumerically(">", 0))
|
||||
Expect(inspectData).ToNot(BeEmpty())
|
||||
Expect(inspectData[0].Config.Labels).To(HaveKeyWithValue("homer", "dad"))
|
||||
})
|
||||
|
||||
|
@ -167,29 +167,29 @@ LABEL marge=mom
|
|||
// Setup
|
||||
yamlDir := filepath.Join(tempdir, RandomString(12))
|
||||
err := os.Mkdir(yamlDir, 0755)
|
||||
Expect(err).To(BeNil(), "mkdir "+yamlDir)
|
||||
Expect(err).ToNot(HaveOccurred(), "mkdir "+yamlDir)
|
||||
err = writeYaml(testYAML, filepath.Join(yamlDir, "top.yaml"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// build an image called foobar but make sure it doesn't have
|
||||
// the same label as the yaml buildfile, so we can check that
|
||||
// the image is NOT rebuilt.
|
||||
err = writeYaml(prebuiltImage, filepath.Join(yamlDir, "Containerfile"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
app1Dir := filepath.Join(yamlDir, "foobar")
|
||||
err = os.Mkdir(app1Dir, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = writeYaml(playBuildFile, filepath.Join(app1Dir, "Containerfile"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Write a file to be copied
|
||||
err = writeYaml(copyFile, filepath.Join(app1Dir, "copyfile"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Switch to temp dir and restore it afterwards
|
||||
cwd, err := os.Getwd()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(os.Chdir(yamlDir)).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(os.Chdir(yamlDir)).To(Succeed())
|
||||
defer func() { (Expect(os.Chdir(cwd)).To(BeNil())) }()
|
||||
|
||||
// Build the image into the local store
|
||||
|
@ -205,7 +205,7 @@ LABEL marge=mom
|
|||
inspect.WaitWithDefaultTimeout()
|
||||
Expect(inspect).Should(Exit(0))
|
||||
inspectData := inspect.InspectContainerToJSON()
|
||||
Expect(len(inspectData)).To(BeNumerically(">", 0))
|
||||
Expect(inspectData).ToNot(BeEmpty())
|
||||
Expect(inspectData[0].Config.Labels).To(Not(HaveKey("homer")))
|
||||
Expect(inspectData[0].Config.Labels).To(HaveKeyWithValue("marge", "mom"))
|
||||
})
|
||||
|
@ -214,29 +214,29 @@ LABEL marge=mom
|
|||
// Setup
|
||||
yamlDir := filepath.Join(tempdir, RandomString(12))
|
||||
err := os.Mkdir(yamlDir, 0755)
|
||||
Expect(err).To(BeNil(), "mkdir "+yamlDir)
|
||||
Expect(err).ToNot(HaveOccurred(), "mkdir "+yamlDir)
|
||||
err = writeYaml(testYAML, filepath.Join(yamlDir, "top.yaml"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// build an image called foobar but make sure it doesn't have
|
||||
// the same label as the yaml buildfile, so we can check that
|
||||
// the image is NOT rebuilt.
|
||||
err = writeYaml(prebuiltImage, filepath.Join(yamlDir, "Containerfile"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
app1Dir := filepath.Join(yamlDir, "foobar")
|
||||
err = os.Mkdir(app1Dir, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = writeYaml(playBuildFile, filepath.Join(app1Dir, "Containerfile"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Write a file to be copied
|
||||
err = writeYaml(copyFile, filepath.Join(app1Dir, "copyfile"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Switch to temp dir and restore it afterwards
|
||||
cwd, err := os.Getwd()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(os.Chdir(yamlDir)).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(os.Chdir(yamlDir)).To(Succeed())
|
||||
defer func() { (Expect(os.Chdir(cwd)).To(BeNil())) }()
|
||||
|
||||
// Build the image into the local store
|
||||
|
@ -252,7 +252,7 @@ LABEL marge=mom
|
|||
inspect.WaitWithDefaultTimeout()
|
||||
Expect(inspect).Should(Exit(0))
|
||||
inspectData := inspect.InspectContainerToJSON()
|
||||
Expect(len(inspectData)).To(BeNumerically(">", 0))
|
||||
Expect(inspectData).ToNot(BeEmpty())
|
||||
Expect(inspectData[0].Config.Labels).To(Not(HaveKey("homer")))
|
||||
Expect(inspectData[0].Config.Labels).To(HaveKeyWithValue("marge", "mom"))
|
||||
})
|
||||
|
@ -261,29 +261,29 @@ LABEL marge=mom
|
|||
// Setup
|
||||
yamlDir := filepath.Join(tempdir, RandomString(12))
|
||||
err := os.Mkdir(yamlDir, 0755)
|
||||
Expect(err).To(BeNil(), "os.Mkdir "+yamlDir)
|
||||
Expect(err).ToNot(HaveOccurred(), "os.Mkdir "+yamlDir)
|
||||
err = writeYaml(testYAML, filepath.Join(yamlDir, "top.yaml"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// build an image called foobar but make sure it doesn't have
|
||||
// the same label as the yaml buildfile, so we can check that
|
||||
// the image is NOT rebuilt.
|
||||
err = writeYaml(prebuiltImage, filepath.Join(yamlDir, "Containerfile"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
app1Dir := filepath.Join(yamlDir, "foobar")
|
||||
err = os.Mkdir(app1Dir, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = writeYaml(playBuildFile, filepath.Join(app1Dir, "Containerfile"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// Write a file to be copied
|
||||
err = writeYaml(copyFile, filepath.Join(app1Dir, "copyfile"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Switch to temp dir and restore it afterwards
|
||||
cwd, err := os.Getwd()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(os.Chdir(yamlDir)).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(os.Chdir(yamlDir)).To(Succeed())
|
||||
defer func() { (Expect(os.Chdir(cwd)).To(BeNil())) }()
|
||||
|
||||
// Build the image into the local store
|
||||
|
@ -299,7 +299,7 @@ LABEL marge=mom
|
|||
inspect.WaitWithDefaultTimeout()
|
||||
Expect(inspect).Should(Exit(0))
|
||||
inspectData := inspect.InspectContainerToJSON()
|
||||
Expect(len(inspectData)).To(BeNumerically(">", 0))
|
||||
Expect(inspectData).ToNot(BeEmpty())
|
||||
Expect(inspectData[0].Config.Labels).To(HaveKeyWithValue("homer", "dad"))
|
||||
Expect(inspectData[0].Config.Labels).To(Not(HaveKey("marge")))
|
||||
})
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -317,8 +317,8 @@ var _ = Describe("Podman pod create", func() {
|
|||
It("podman create pod and print id to external file", func() {
|
||||
// Switch to temp dir and restore it afterwards
|
||||
cwd, err := os.Getwd()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(os.Chdir(os.TempDir())).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(os.Chdir(os.TempDir())).To(Succeed())
|
||||
targetPath, err := CreateTempDirInTempDir()
|
||||
if err != nil {
|
||||
os.Exit(1)
|
||||
|
@ -682,7 +682,7 @@ ENTRYPOINT ["sleep","99999"]
|
|||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
u, err := user.Current()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session.OutputToString()).To(ContainSubstring(u.Name))
|
||||
|
||||
// root owns /usr
|
||||
|
@ -731,7 +731,7 @@ ENTRYPOINT ["sleep","99999"]
|
|||
|
||||
It("podman pod create with --userns=auto", func() {
|
||||
u, err := user.Current()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
name := u.Name
|
||||
if name == "root" {
|
||||
name = "containers"
|
||||
|
@ -765,7 +765,7 @@ ENTRYPOINT ["sleep","99999"]
|
|||
|
||||
It("podman pod create --userns=auto:size=%d", func() {
|
||||
u, err := user.Current()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
name := u.Name
|
||||
if name == "root" {
|
||||
|
@ -801,7 +801,7 @@ ENTRYPOINT ["sleep","99999"]
|
|||
|
||||
It("podman pod create --userns=auto:uidmapping=", func() {
|
||||
u, err := user.Current()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
name := u.Name
|
||||
if name == "root" {
|
||||
|
@ -838,7 +838,7 @@ ENTRYPOINT ["sleep","99999"]
|
|||
|
||||
It("podman pod create --userns=auto:gidmapping=", func() {
|
||||
u, err := user.Current()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
name := u.Name
|
||||
if name == "root" {
|
||||
|
@ -912,7 +912,7 @@ ENTRYPOINT ["sleep","99999"]
|
|||
|
||||
It("podman pod create --device", func() {
|
||||
SkipIfRootless("Cannot create devices in /dev in rootless mode")
|
||||
Expect(os.MkdirAll("/dev/foodevdir", os.ModePerm)).To(BeNil())
|
||||
Expect(os.MkdirAll("/dev/foodevdir", os.ModePerm)).To(Succeed())
|
||||
defer os.RemoveAll("/dev/foodevdir")
|
||||
|
||||
mknod := SystemExec("mknod", []string{"/dev/foodevdir/null", "c", "1", "3"})
|
||||
|
|
|
@ -366,7 +366,7 @@ var _ = Describe("Podman pod create", func() {
|
|||
result = podmanTest.Podman([]string{"ps", "-aq"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
|
||||
Expect(result.OutputToStringArray()).ShouldNot(BeEmpty())
|
||||
|
||||
Expect(result.OutputToString()).To(ContainSubstring(infraID))
|
||||
})
|
||||
|
@ -394,7 +394,7 @@ var _ = Describe("Podman pod create", func() {
|
|||
result = podmanTest.Podman([]string{"ps", "-aq"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
|
||||
Expect(result.OutputToStringArray()).ShouldNot(BeEmpty())
|
||||
|
||||
Expect(result.OutputToString()).To(ContainSubstring(infraID))
|
||||
})
|
||||
|
|
|
@ -94,7 +94,7 @@ var _ = Describe("Podman pod inspect", func() {
|
|||
|
||||
inspectJSON := new(define.InspectPodData)
|
||||
err := json.Unmarshal(inspectOut.Out.Contents(), inspectJSON)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(inspectJSON.InfraConfig).To(Not(BeNil()))
|
||||
Expect(inspectJSON.InfraConfig.PortBindings["80/tcp"]).To(HaveLen(1))
|
||||
Expect(inspectJSON.InfraConfig.PortBindings["80/tcp"][0]).To(HaveField("HostPort", "8383"))
|
||||
|
|
|
@ -52,7 +52,7 @@ var _ = Describe("Podman ps", func() {
|
|||
result := podmanTest.Podman([]string{"pod", "ps"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
|
||||
Expect(result.OutputToStringArray()).ShouldNot(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman pod ps quiet flag", func() {
|
||||
|
@ -65,7 +65,7 @@ var _ = Describe("Podman ps", func() {
|
|||
result := podmanTest.Podman([]string{"pod", "ps", "-q"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).To(Exit(0))
|
||||
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
|
||||
Expect(result.OutputToStringArray()).ShouldNot(BeEmpty())
|
||||
Expect(podid).To(ContainSubstring(result.OutputToStringArray()[0]))
|
||||
})
|
||||
|
||||
|
@ -79,7 +79,7 @@ var _ = Describe("Podman ps", func() {
|
|||
result := podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
|
||||
Expect(result.OutputToStringArray()).ShouldNot(BeEmpty())
|
||||
Expect(podid).To(Equal(result.OutputToStringArray()[0]))
|
||||
})
|
||||
|
||||
|
|
|
@ -50,14 +50,14 @@ var _ = Describe("Podman pod rm", func() {
|
|||
return err
|
||||
}
|
||||
if !d.IsDir() {
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
}
|
||||
if strings.Contains(d.Name(), podid) {
|
||||
return fmt.Errorf("leaking cgroup path %s", path)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman pod rm latest pod", func() {
|
||||
|
@ -142,7 +142,7 @@ var _ = Describe("Podman pod rm", func() {
|
|||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).To(ExitWithError())
|
||||
foundExpectedError, _ := result.ErrorGrepString("cannot be removed")
|
||||
Expect(foundExpectedError).To(Equal(true))
|
||||
Expect(foundExpectedError).To(BeTrue())
|
||||
|
||||
numPods = podmanTest.NumberOfPods()
|
||||
ps = podmanTest.Podman([]string{"pod", "ps"})
|
||||
|
@ -235,7 +235,7 @@ var _ = Describe("Podman pod rm", func() {
|
|||
|
||||
It("podman pod start/remove single pod via --pod-id-file", func() {
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
tmpFile := tmpDir + "podID"
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
|
@ -264,7 +264,7 @@ var _ = Describe("Podman pod rm", func() {
|
|||
|
||||
It("podman pod start/remove multiple pods via --pod-id-file", func() {
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
podIDFiles := []string{}
|
||||
|
|
|
@ -175,7 +175,7 @@ var _ = Describe("Podman pod start", func() {
|
|||
|
||||
It("podman pod start single pod via --pod-id-file", func() {
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
tmpFile := tmpDir + "podID"
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
|
@ -199,7 +199,7 @@ var _ = Describe("Podman pod start", func() {
|
|||
|
||||
It("podman pod start multiple pods via --pod-id-file", func() {
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
podIDFiles := []string{}
|
||||
|
@ -231,7 +231,7 @@ var _ = Describe("Podman pod start", func() {
|
|||
|
||||
It("podman pod create --infra-conmon-pod create + start", func() {
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
tmpFile := tmpDir + "podID"
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
|
@ -248,7 +248,7 @@ var _ = Describe("Podman pod start", func() {
|
|||
|
||||
readFirstLine := func(path string) string {
|
||||
content, err := os.ReadFile(path)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
return strings.Split(string(content), "\n")[0]
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ var _ = Describe("Podman pod start", func() {
|
|||
// on the pid.
|
||||
infraConmonPID := readFirstLine(tmpFile)
|
||||
_, err = strconv.Atoi(infraConmonPID) // Make sure it's a proper integer
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
cmdline := readFirstLine(fmt.Sprintf("/proc/%s/cmdline", infraConmonPID))
|
||||
Expect(cmdline).To(ContainSubstring("/conmon"))
|
||||
|
|
|
@ -181,7 +181,7 @@ var _ = Describe("Podman pod stop", func() {
|
|||
|
||||
It("podman pod start/stop single pod via --pod-id-file", func() {
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
tmpFile := tmpDir + "podID"
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
|
@ -210,7 +210,7 @@ var _ = Describe("Podman pod stop", func() {
|
|||
|
||||
It("podman pod start/stop multiple pods via --pod-id-file", func() {
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
podIDFiles := []string{}
|
||||
|
|
|
@ -190,7 +190,7 @@ var _ = Describe("Podman prune", func() {
|
|||
hasNoneAfter, result := after.GrepString("<none>")
|
||||
Expect(hasNoneAfter).To(BeTrue())
|
||||
Expect(len(after.OutputToStringArray())).To(BeNumerically(">", 1))
|
||||
Expect(len(result)).To(BeNumerically(">", 0))
|
||||
Expect(result).ToNot(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman image prune unused images", func() {
|
||||
|
|
|
@ -58,7 +58,7 @@ var _ = Describe("Podman ps", func() {
|
|||
result := podmanTest.Podman([]string{"ps"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
|
||||
Expect(result.OutputToStringArray()).ShouldNot(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman ps all", func() {
|
||||
|
@ -68,7 +68,7 @@ var _ = Describe("Podman ps", func() {
|
|||
result := podmanTest.Podman([]string{"ps", "-a"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
|
||||
Expect(result.OutputToStringArray()).ShouldNot(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman container list all", func() {
|
||||
|
@ -78,12 +78,12 @@ var _ = Describe("Podman ps", func() {
|
|||
result := podmanTest.Podman([]string{"container", "list", "-a"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
|
||||
Expect(result.OutputToStringArray()).ShouldNot(BeEmpty())
|
||||
|
||||
result = podmanTest.Podman([]string{"container", "ls", "-a"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
|
||||
Expect(result.OutputToStringArray()).ShouldNot(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman ps size flag", func() {
|
||||
|
@ -93,7 +93,7 @@ var _ = Describe("Podman ps", func() {
|
|||
result := podmanTest.Podman([]string{"ps", "-a", "--size"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
|
||||
Expect(result.OutputToStringArray()).ShouldNot(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman ps quiet flag", func() {
|
||||
|
@ -103,7 +103,7 @@ var _ = Describe("Podman ps", func() {
|
|||
result := podmanTest.Podman([]string{"ps", "-a", "-q"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
|
||||
Expect(result.OutputToStringArray()).ShouldNot(BeEmpty())
|
||||
Expect(fullCid).To(ContainSubstring(result.OutputToStringArray()[0]))
|
||||
})
|
||||
|
||||
|
@ -166,7 +166,7 @@ var _ = Describe("Podman ps", func() {
|
|||
result := podmanTest.Podman([]string{"ps", "-aq", "--no-trunc"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
|
||||
Expect(result.OutputToStringArray()).ShouldNot(BeEmpty())
|
||||
Expect(fullCid).To(Equal(result.OutputToStringArray()[0]))
|
||||
})
|
||||
|
||||
|
@ -219,7 +219,7 @@ var _ = Describe("Podman ps", func() {
|
|||
result := podmanTest.Podman([]string{"ps", "-a", "--namespace"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
|
||||
Expect(result.OutputToStringArray()).ShouldNot(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman ps namespace flag even for remote", func() {
|
||||
|
@ -264,9 +264,9 @@ var _ = Describe("Podman ps", func() {
|
|||
|
||||
// Make sure Created field is an int64
|
||||
created, err := result.jq(".[0].Created")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = strconv.ParseInt(created, 10, 64)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman ps print a human-readable `Status` with json format", func() {
|
||||
|
|
|
@ -45,7 +45,7 @@ var _ = Describe("Podman pull", func() {
|
|||
Expect(session).Should(Exit(125))
|
||||
expectedError := "initializing source docker://ibetthisdoesnotexistfr:random"
|
||||
found, _ := session.ErrorGrepString(expectedError)
|
||||
Expect(found).To(Equal(true))
|
||||
Expect(found).To(BeTrue())
|
||||
|
||||
session = podmanTest.Podman([]string{"rmi", "busybox:musl", "alpine", "quay.io/libpod/cirros", "testdigest_v2s2@sha256:755f4d90b3716e2bf57060d249e2cd61c9ac089b1233465c5c2cb2d7ee550fdb"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -289,7 +289,7 @@ var _ = Describe("Podman pull", func() {
|
|||
Expect(session).Should(Exit(125))
|
||||
expectedError := "Unexpected tar manifest.json: expected 1 item, got 2"
|
||||
found, _ := session.ErrorGrepString(expectedError)
|
||||
Expect(found).To(Equal(true))
|
||||
Expect(found).To(BeTrue())
|
||||
|
||||
// Now pull _one_ image from a multi-image archive via the name
|
||||
// and index syntax.
|
||||
|
@ -315,14 +315,14 @@ var _ = Describe("Podman pull", func() {
|
|||
Expect(session).Should(Exit(125))
|
||||
expectedError = "Tag \"foo.com/does/not/exist:latest\" not found"
|
||||
found, _ = session.ErrorGrepString(expectedError)
|
||||
Expect(found).To(Equal(true))
|
||||
Expect(found).To(BeTrue())
|
||||
|
||||
session = podmanTest.Podman([]string{"pull", "docker-archive:./testdata/docker-two-images.tar.xz:@2"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(125))
|
||||
expectedError = "Invalid source index @2, only 2 manifest items available"
|
||||
found, _ = session.ErrorGrepString(expectedError)
|
||||
Expect(found).To(Equal(true))
|
||||
Expect(found).To(BeTrue())
|
||||
})
|
||||
|
||||
It("podman pull from oci-archive", func() {
|
||||
|
|
|
@ -78,13 +78,13 @@ var _ = Describe("Podman push", func() {
|
|||
blobsDir := filepath.Join(bbdir, "blobs/sha256")
|
||||
|
||||
blobs, err := os.ReadDir(blobsDir)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
for _, f := range blobs {
|
||||
blobPath := filepath.Join(blobsDir, f.Name())
|
||||
|
||||
sourceFile, err := os.ReadFile(blobPath)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
compressionType := archive.DetectCompression(sourceFile)
|
||||
if compressionType == archive.Zstd {
|
||||
|
@ -116,7 +116,7 @@ var _ = Describe("Podman push", func() {
|
|||
push := podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"})
|
||||
push.WaitWithDefaultTimeout()
|
||||
Expect(push).Should(Exit(0))
|
||||
Expect(len(push.ErrorToString())).To(Equal(0))
|
||||
Expect(push.ErrorToString()).To(BeEmpty())
|
||||
|
||||
push = podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"})
|
||||
push.WaitWithDefaultTimeout()
|
||||
|
@ -132,7 +132,7 @@ var _ = Describe("Podman push", func() {
|
|||
push2 := podmanTest.Podman([]string{"push", "--tls-verify=false", "--digestfile=/tmp/digestfile.txt", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"})
|
||||
push2.WaitWithDefaultTimeout()
|
||||
fi, err := os.Lstat("/tmp/digestfile.txt")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(fi.Name()).To(Equal("digestfile.txt"))
|
||||
Expect(push2).Should(Exit(0))
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ var _ = Describe("Podman push", func() {
|
|||
push := podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:5000/sigstore-signed"})
|
||||
push.WaitWithDefaultTimeout()
|
||||
Expect(push).Should(Exit(0))
|
||||
Expect(len(push.ErrorToString())).To(Equal(0))
|
||||
Expect(push.ErrorToString()).To(BeEmpty())
|
||||
|
||||
pull := podmanTest.Podman([]string{"pull", "-q", "--tls-verify=false", "--signature-policy", "sign/policy.json", "localhost:5000/sigstore-signed"})
|
||||
pull.WaitWithDefaultTimeout()
|
||||
|
@ -168,7 +168,7 @@ var _ = Describe("Podman push", func() {
|
|||
push = podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--remove-signatures", "--sign-by-sigstore-private-key", "testdata/sigstore-key.key", "--sign-passphrase-file", "testdata/sigstore-key.key.pass", ALPINE, "localhost:5000/sigstore-signed"})
|
||||
push.WaitWithDefaultTimeout()
|
||||
Expect(push).Should(Exit(0))
|
||||
Expect(len(push.ErrorToString())).To(Equal(0))
|
||||
Expect(push.ErrorToString()).To(BeEmpty())
|
||||
|
||||
pull = podmanTest.Podman([]string{"pull", "-q", "--tls-verify=false", "--signature-policy", "sign/policy.json", "localhost:5000/sigstore-signed"})
|
||||
pull.WaitWithDefaultTimeout()
|
||||
|
|
|
@ -24,7 +24,7 @@ type quadletTestcase struct {
|
|||
|
||||
func loadQuadletTestcase(path string) *quadletTestcase {
|
||||
data, err := os.ReadFile(path)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
base := filepath.Base(path)
|
||||
ext := filepath.Ext(base)
|
||||
|
@ -39,7 +39,7 @@ func loadQuadletTestcase(path string) *quadletTestcase {
|
|||
for _, line := range strings.Split(string(data), "\n") {
|
||||
if strings.HasPrefix(line, "##") {
|
||||
words, err := shellwords.Parse(line[2:])
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
checks = append(checks, words)
|
||||
}
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ func (t *quadletTestcase) check(generateDir string, session *PodmanSessionIntegr
|
|||
var unit *parser.UnitFile
|
||||
if !expectFail {
|
||||
unit, err = parser.ParseUnitFile(file)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
}
|
||||
|
||||
for _, check := range t.checks {
|
||||
|
@ -250,11 +250,11 @@ var _ = Describe("quadlet system generator", func() {
|
|||
|
||||
generatedDir = filepath.Join(podmanTest.TempDir, "generated")
|
||||
err = os.Mkdir(generatedDir, os.ModePerm)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
quadletDir = filepath.Join(podmanTest.TempDir, "quadlet")
|
||||
err = os.Mkdir(quadletDir, os.ModePerm)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
|
@ -270,7 +270,7 @@ var _ = Describe("quadlet system generator", func() {
|
|||
|
||||
// Write the tested file to the quadlet dir
|
||||
err = os.WriteFile(filepath.Join(quadletDir, fileName), testcase.data, 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Run quadlet to convert the file
|
||||
session := podmanTest.Quadlet([]string{"-no-kmsg-log", generatedDir}, quadletDir)
|
||||
|
|
|
@ -251,7 +251,7 @@ var _ = Describe("Podman restart", func() {
|
|||
|
||||
It("podman restart --cidfile", func() {
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
tmpFile := tmpDir + "cid"
|
||||
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
@ -274,7 +274,7 @@ var _ = Describe("Podman restart", func() {
|
|||
|
||||
It("podman restart multiple --cidfile", func() {
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
tmpFile1 := tmpDir + "cid-1"
|
||||
tmpFile2 := tmpDir + "cid-2"
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ var _ = Describe("Podman rm", func() {
|
|||
|
||||
It("podman rm --cidfile", func() {
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
tmpFile := tmpDir + "cid"
|
||||
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
@ -166,7 +166,7 @@ var _ = Describe("Podman rm", func() {
|
|||
|
||||
It("podman rm multiple --cidfile", func() {
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
tmpFile1 := tmpDir + "cid-1"
|
||||
tmpFile2 := tmpDir + "cid-2"
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
|
|||
}
|
||||
`
|
||||
aaFile := filepath.Join(os.TempDir(), "aaFile")
|
||||
Expect(os.WriteFile(aaFile, []byte(aaProfile), 0755)).To(BeNil())
|
||||
Expect(os.WriteFile(aaFile, []byte(aaProfile), 0755)).To(Succeed())
|
||||
parse := SystemExec("apparmor_parser", []string{"-Kr", aaFile})
|
||||
Expect(parse).Should(Exit(0))
|
||||
|
||||
|
|
|
@ -86,16 +86,16 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
|
|||
|
||||
// Move the container process to a sub cgroup
|
||||
content, err := os.ReadFile(filepath.Join(cgroupRoot, containerCgroup, "cgroup.procs"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
oldSubCgroupPath := filepath.Join(cgroupRoot, containerCgroup, "old-container")
|
||||
err = os.MkdirAll(oldSubCgroupPath, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = os.WriteFile(filepath.Join(oldSubCgroupPath, "cgroup.procs"), content, 0644)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
newCgroup := fmt.Sprintf("%s/new-container", containerCgroup)
|
||||
err = os.MkdirAll(filepath.Join(cgroupRoot, newCgroup), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
run = podmanTest.Podman([]string{"--cgroup-manager=cgroupfs", "run", "--rm", "--cgroupns=host", fmt.Sprintf("--cgroup-parent=%s", newCgroup), fedoraMinimal, "cat", "/proc/self/cgroup"})
|
||||
run.WaitWithDefaultTimeout()
|
||||
|
|
|
@ -78,7 +78,7 @@ var _ = Describe("Podman run device", func() {
|
|||
|
||||
It("podman run device host device and container device parameter are directories", func() {
|
||||
SkipIfRootless("Cannot create devices in /dev in rootless mode")
|
||||
Expect(os.MkdirAll("/dev/foodevdir", os.ModePerm)).To(BeNil())
|
||||
Expect(os.MkdirAll("/dev/foodevdir", os.ModePerm)).To(Succeed())
|
||||
defer os.RemoveAll("/dev/foodevdir")
|
||||
|
||||
mknod := SystemExec("mknod", []string{"/dev/foodevdir/null", "c", "1", "3"})
|
||||
|
@ -105,13 +105,13 @@ var _ = Describe("Podman run device", func() {
|
|||
SkipIfRootless("Rootless will not be able to create files/folders in /etc")
|
||||
cdiDir := "/etc/cdi"
|
||||
if _, err := os.Stat(cdiDir); os.IsNotExist(err) {
|
||||
Expect(os.MkdirAll(cdiDir, os.ModePerm)).To(BeNil())
|
||||
Expect(os.MkdirAll(cdiDir, os.ModePerm)).To(Succeed())
|
||||
}
|
||||
defer os.RemoveAll(cdiDir)
|
||||
|
||||
cmd := exec.Command("cp", "cdi/device.json", cdiDir)
|
||||
err = cmd.Run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "-q", "--security-opt", "label=disable", "--device", "vendor.com/device=myKmsg", ALPINE, "test", "-c", "/dev/kmsg1"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
|
|
@ -488,7 +488,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
|
|||
|
||||
It("podman run network bind to HostIP", func() {
|
||||
ip, err := utils.HostIP()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
port := GetPort()
|
||||
|
||||
slirp4netnsHelp := SystemExec("slirp4netns", []string{"--help"})
|
||||
|
@ -711,7 +711,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
|
|||
|
||||
addAddr := func(cidr string, containerInterface netlink.Link) error {
|
||||
_, ipnet, err := net.ParseCIDR(cidr)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
addr := &netlink.Addr{IPNet: ipnet, Label: ""}
|
||||
if err := netlink.AddrAdd(containerInterface, addr); err != nil && err != syscall.EEXIST {
|
||||
return err
|
||||
|
@ -721,25 +721,25 @@ EXPOSE 2004-2005/tcp`, ALPINE)
|
|||
|
||||
loopbackup := func() {
|
||||
lo, err := netlink.LinkByName("lo")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = netlink.LinkSetUp(lo)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
}
|
||||
|
||||
linkup := func(name string, mac string, addresses []string) {
|
||||
linkAttr := netlink.NewLinkAttrs()
|
||||
linkAttr.Name = name
|
||||
m, err := net.ParseMAC(mac)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
linkAttr.HardwareAddr = m
|
||||
eth := &netlink.Dummy{LinkAttrs: linkAttr}
|
||||
err = netlink.LinkAdd(eth)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = netlink.LinkSetUp(eth)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
for _, address := range addresses {
|
||||
err := addAddr(address, eth)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -765,14 +765,14 @@ EXPOSE 2004-2005/tcp`, ALPINE)
|
|||
inspectOut := podmanTest.InspectContainer(name)
|
||||
Expect(inspectOut[0].NetworkSettings).To(HaveField("IPAddress", "10.25.40.0"))
|
||||
Expect(inspectOut[0].NetworkSettings).To(HaveField("IPPrefixLen", 24))
|
||||
Expect(len(inspectOut[0].NetworkSettings.SecondaryIPAddresses)).To(Equal(1))
|
||||
Expect(inspectOut[0].NetworkSettings.SecondaryIPAddresses).To(HaveLen(1))
|
||||
Expect(inspectOut[0].NetworkSettings.SecondaryIPAddresses[0]).To(HaveField("Addr", "10.88.0.0"))
|
||||
Expect(inspectOut[0].NetworkSettings.SecondaryIPAddresses[0]).To(HaveField("PrefixLength", 16))
|
||||
Expect(inspectOut[0].NetworkSettings).To(HaveField("GlobalIPv6Address", "fd04:3e42:4a4e:3381::"))
|
||||
Expect(inspectOut[0].NetworkSettings).To(HaveField("GlobalIPv6PrefixLen", 64))
|
||||
Expect(len(inspectOut[0].NetworkSettings.SecondaryIPv6Addresses)).To(Equal(0))
|
||||
Expect(inspectOut[0].NetworkSettings.SecondaryIPv6Addresses).To(BeEmpty())
|
||||
Expect(inspectOut[0].NetworkSettings).To(HaveField("MacAddress", "46:7f:45:6e:4f:c8"))
|
||||
Expect(len(inspectOut[0].NetworkSettings.AdditionalMacAddresses)).To(Equal(1))
|
||||
Expect(inspectOut[0].NetworkSettings.AdditionalMacAddresses).To(HaveLen(1))
|
||||
Expect(inspectOut[0].NetworkSettings.AdditionalMacAddresses[0]).To(Equal("56:6e:35:5d:3e:a8"))
|
||||
Expect(inspectOut[0].NetworkSettings).To(HaveField("Gateway", "10.25.40.0"))
|
||||
|
||||
|
@ -797,7 +797,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
|
|||
|
||||
inspectOut := podmanTest.InspectContainer(name)
|
||||
Expect(inspectOut[0].NetworkSettings).To(HaveField("IPAddress", ""))
|
||||
Expect(len(inspectOut[0].NetworkSettings.Networks)).To(Equal(0))
|
||||
Expect(inspectOut[0].NetworkSettings.Networks).To(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman inspect can handle joined network ns with multiple interfaces", func() {
|
||||
|
|
|
@ -117,13 +117,13 @@ var _ = Describe("Podman run ns", func() {
|
|||
SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
|
||||
cmd := exec.Command("ls", "-l", "/proc/self/ns/pid")
|
||||
res, err := cmd.Output()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
fields := strings.Split(string(res), " ")
|
||||
hostPidNS := strings.TrimSuffix(fields[len(fields)-1], "\n")
|
||||
|
||||
cmd = exec.Command("ls", "-l", "/proc/self/ns/ipc")
|
||||
res, err = cmd.Output()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
fields = strings.Split(string(res), " ")
|
||||
hostIpcNS := strings.TrimSuffix(fields[len(fields)-1], "\n")
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ var _ = Describe("Podman privileged container tests", func() {
|
|||
It("podman privileged should restart after host devices change", func() {
|
||||
containerName := "privileged-restart-test"
|
||||
SkipIfRootless("Cannot create devices in /dev in rootless mode")
|
||||
Expect(os.MkdirAll("/dev/foodevdir", os.ModePerm)).To(BeNil())
|
||||
Expect(os.MkdirAll("/dev/foodevdir", os.ModePerm)).To(Succeed())
|
||||
|
||||
mknod := SystemExec("mknod", []string{"/dev/foodevdir/null", "c", "1", "3"})
|
||||
mknod.WaitWithDefaultTimeout()
|
||||
|
@ -158,7 +158,7 @@ var _ = Describe("Podman privileged container tests", func() {
|
|||
It("run no-new-privileges test", func() {
|
||||
// Check if our kernel is new enough
|
||||
k, err := IsKernelNewerThan("4.14")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
if !k {
|
||||
Skip("Kernel is not new enough to test this feature")
|
||||
}
|
||||
|
|
|
@ -298,7 +298,7 @@ var _ = Describe("Podman run", func() {
|
|||
runtime := podmanTest.OCIRuntime
|
||||
podmanTest.OCIRuntime = filepath.Join(podmanTest.TempDir, "kata-runtime")
|
||||
err := os.Symlink("/bin/true", podmanTest.OCIRuntime)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
if IsRemote() {
|
||||
podmanTest.StopRemoteService()
|
||||
podmanTest.StartRemoteService()
|
||||
|
|
|
@ -226,7 +226,7 @@ var _ = Describe("Podman run", func() {
|
|||
tarball := filepath.Join(tempdir, "rootfs.tar")
|
||||
|
||||
err := os.Mkdir(rootfs, 0770)
|
||||
Expect(err).Should(BeNil())
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
|
||||
// Change image in predictable way to validate export
|
||||
csession := podmanTest.Podman([]string{"run", "--name", uniqueString, ALPINE,
|
||||
|
@ -638,7 +638,7 @@ USER bin`, BB)
|
|||
Expect(session.OutputToString()).To(Equal("111"))
|
||||
|
||||
currentOOMScoreAdj, err := os.ReadFile("/proc/self/oom_score_adj")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session = podmanTest.Podman([]string{"run", "--rm", fedoraMinimal, "cat", "/proc/self/oom_score_adj"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
|
@ -651,7 +651,7 @@ USER bin`, BB)
|
|||
var l syscall.Rlimit
|
||||
|
||||
err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &l)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "--rm", "--ulimit", "host", fedoraMinimal, "ulimit", "-Hn"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -659,7 +659,7 @@ USER bin`, BB)
|
|||
|
||||
ulimitCtrStr := strings.TrimSpace(session.OutputToString())
|
||||
ulimitCtr, err := strconv.ParseUint(ulimitCtrStr, 10, 0)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(ulimitCtr).Should(BeNumerically(">=", l.Max))
|
||||
})
|
||||
|
@ -669,7 +669,7 @@ USER bin`, BB)
|
|||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
err := os.Remove(tempdir + "cidfile")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman run sysctl test", func() {
|
||||
|
@ -795,7 +795,7 @@ USER bin`, BB)
|
|||
Net: "unixgram",
|
||||
}
|
||||
socket, err := net.ListenUnixgram("unixgram", &addr)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer os.Remove(sock)
|
||||
defer socket.Close()
|
||||
|
||||
|
@ -805,7 +805,7 @@ USER bin`, BB)
|
|||
session := podmanTest.Podman([]string{"run", ALPINE, "printenv", "NOTIFY_SOCKET"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
|
||||
Expect(session.OutputToStringArray()).ToNot(BeEmpty())
|
||||
})
|
||||
|
||||
It("podman run log-opt", func() {
|
||||
|
@ -814,7 +814,7 @@ USER bin`, BB)
|
|||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
_, err := os.Stat(log)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_ = os.Remove(log)
|
||||
})
|
||||
|
||||
|
@ -868,28 +868,28 @@ echo -n %s >%s
|
|||
SkipIfRemote("--default-mount-file option is not supported in podman-remote")
|
||||
containersDir := filepath.Join(podmanTest.TempDir, "containers")
|
||||
err := os.MkdirAll(containersDir, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
secretsDir := filepath.Join(podmanTest.TempDir, "rhel", "secrets")
|
||||
err = os.MkdirAll(secretsDir, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
mountsFile := filepath.Join(containersDir, "mounts.conf")
|
||||
mountString := secretsDir + ":/run/secrets"
|
||||
err = os.WriteFile(mountsFile, []byte(mountString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
secretsFile := filepath.Join(secretsDir, "test.txt")
|
||||
secretsString := "Testing secrets mount. I am mounted!"
|
||||
err = os.WriteFile(secretsFile, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
targetDir := tempdir + "/symlink/target"
|
||||
err = os.MkdirAll(targetDir, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
keyFile := filepath.Join(targetDir, "key.pem")
|
||||
err = os.WriteFile(keyFile, []byte(mountString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
execSession := SystemExec("ln", []string{"-s", targetDir, filepath.Join(secretsDir, "mysymlink")})
|
||||
Expect(execSession).Should(Exit(0))
|
||||
|
||||
|
@ -908,7 +908,7 @@ echo -n %s >%s
|
|||
SkipIfRootless("rootless can not manipulate system-fips file")
|
||||
fipsFile := "/etc/system-fips"
|
||||
err = os.WriteFile(fipsFile, []byte{}, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "ls", "/run/secrets"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -916,7 +916,7 @@ echo -n %s >%s
|
|||
Expect(session.OutputToString()).To(ContainSubstring("system-fips"))
|
||||
|
||||
err = os.Remove(fipsFile)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman run without group-add", func() {
|
||||
|
@ -1064,13 +1064,13 @@ USER mail`, BB)
|
|||
It("podman run --volumes-from flag", func() {
|
||||
vol := filepath.Join(podmanTest.TempDir, "vol-test")
|
||||
err := os.MkdirAll(vol, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
filename := "test.txt"
|
||||
volFile := filepath.Join(vol, filename)
|
||||
data := "Testing --volumes-from!!!"
|
||||
err = os.WriteFile(volFile, []byte(data), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
mountpoint := "/myvol/"
|
||||
|
||||
session := podmanTest.Podman([]string{"create", "--volume", vol + ":" + mountpoint + ":z", ALPINE, "cat", mountpoint + filename})
|
||||
|
@ -1096,13 +1096,13 @@ USER mail`, BB)
|
|||
It("podman run --volumes-from flag options", func() {
|
||||
vol := filepath.Join(podmanTest.TempDir, "vol-test")
|
||||
err := os.MkdirAll(vol, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
filename := "test.txt"
|
||||
volFile := filepath.Join(vol, filename)
|
||||
data := "Testing --volumes-from!!!"
|
||||
err = os.WriteFile(volFile, []byte(data), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
mountpoint := "/myvol/"
|
||||
|
||||
session := podmanTest.Podman([]string{"create", "--volume", vol + ":" + mountpoint, ALPINE, "cat", mountpoint + filename})
|
||||
|
@ -1162,10 +1162,10 @@ USER mail`, BB)
|
|||
It("podman run --volumes flag with multiple volumes", func() {
|
||||
vol1 := filepath.Join(podmanTest.TempDir, "vol-test1")
|
||||
err := os.MkdirAll(vol1, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
vol2 := filepath.Join(podmanTest.TempDir, "vol-test2")
|
||||
err = os.MkdirAll(vol2, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "--volume", vol1 + ":/myvol1:z", "--volume", vol2 + ":/myvol2:z", ALPINE, "touch", "/myvol2/foo.txt"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -1175,7 +1175,7 @@ USER mail`, BB)
|
|||
It("podman run --volumes flag with empty host dir", func() {
|
||||
vol1 := filepath.Join(podmanTest.TempDir, "vol-test1")
|
||||
err := os.MkdirAll(vol1, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "--volume", ":/myvol1:z", ALPINE, "touch", "/myvol2/foo.txt"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -1190,10 +1190,10 @@ USER mail`, BB)
|
|||
It("podman run --mount flag with multiple mounts", func() {
|
||||
vol1 := filepath.Join(podmanTest.TempDir, "vol-test1")
|
||||
err := os.MkdirAll(vol1, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
vol2 := filepath.Join(podmanTest.TempDir, "vol-test2")
|
||||
err = os.MkdirAll(vol2, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "--mount", "type=bind,src=" + vol1 + ",target=/myvol1,z", "--mount", "type=bind,src=" + vol2 + ",target=/myvol2,z", ALPINE, "touch", "/myvol2/foo.txt"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -1203,10 +1203,10 @@ USER mail`, BB)
|
|||
It("podman run findmnt nothing shared", func() {
|
||||
vol1 := filepath.Join(podmanTest.TempDir, "vol-test1")
|
||||
err := os.MkdirAll(vol1, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
vol2 := filepath.Join(podmanTest.TempDir, "vol-test2")
|
||||
err = os.MkdirAll(vol2, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "--volume", vol1 + ":/myvol1:z", "--volume", vol2 + ":/myvol2:z", fedoraMinimal, "findmnt", "-o", "TARGET,PROPAGATION"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -1217,10 +1217,10 @@ USER mail`, BB)
|
|||
It("podman run findmnt shared", func() {
|
||||
vol1 := filepath.Join(podmanTest.TempDir, "vol-test1")
|
||||
err := os.MkdirAll(vol1, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
vol2 := filepath.Join(podmanTest.TempDir, "vol-test2")
|
||||
err = os.MkdirAll(vol2, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "--volume", vol1 + ":/myvol1:z", "--volume", vol2 + ":/myvol2:shared,z", fedoraMinimal, "findmnt", "-o", "TARGET,PROPAGATION"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -1368,11 +1368,11 @@ USER mail`, BB)
|
|||
It("podman run with restart-policy always restarts containers", func() {
|
||||
testDir := filepath.Join(podmanTest.RunRoot, "restart-test")
|
||||
err := os.MkdirAll(testDir, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
aliveFile := filepath.Join(testDir, "running")
|
||||
file, err := os.Create(aliveFile)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
file.Close()
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "-dt", "--restart", "always", "-v", fmt.Sprintf("%s:/tmp/runroot:Z", testDir), ALPINE, "sh", "-c", "touch /tmp/runroot/ran && while test -r /tmp/runroot/running; do sleep 0.1s; done"})
|
||||
|
@ -1384,14 +1384,14 @@ USER mail`, BB)
|
|||
if _, err := os.Stat(testFile); err == nil {
|
||||
found = true
|
||||
err = os.Remove(testFile)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
break
|
||||
}
|
||||
}
|
||||
Expect(found).To(BeTrue())
|
||||
|
||||
err = os.Remove(aliveFile)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
||||
|
@ -1492,7 +1492,7 @@ USER mail`, BB)
|
|||
}
|
||||
|
||||
curCgroupsBytes, err := os.ReadFile("/proc/self/cgroup")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
var curCgroups string = string(curCgroupsBytes)
|
||||
fmt.Printf("Output:\n%s\n", curCgroups)
|
||||
Expect(curCgroups).To(Not(Equal("")))
|
||||
|
@ -1509,7 +1509,7 @@ USER mail`, BB)
|
|||
Expect(pid).To(Not(Equal(0)))
|
||||
|
||||
ctrCgroupsBytes, err := os.ReadFile(fmt.Sprintf("/proc/%d/cgroup", pid))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
var ctrCgroups string = string(ctrCgroupsBytes)
|
||||
fmt.Printf("Output\n:%s\n", ctrCgroups)
|
||||
Expect(curCgroups).To(Not(Equal(ctrCgroups)))
|
||||
|
@ -1555,7 +1555,7 @@ USER mail`, BB)
|
|||
|
||||
It("podman run --preserve-fds", func() {
|
||||
devNull, err := os.Open("/dev/null")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer devNull.Close()
|
||||
files := []*os.File{
|
||||
devNull,
|
||||
|
@ -1583,14 +1583,14 @@ USER mail`, BB)
|
|||
It("podman run --tz", func() {
|
||||
testDir := filepath.Join(podmanTest.RunRoot, "tz-test")
|
||||
err := os.MkdirAll(testDir, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
tzFile := filepath.Join(testDir, "tzfile.txt")
|
||||
file, err := os.Create(tzFile)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
_, err = file.WriteString("Hello")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
file.Close()
|
||||
|
||||
badTZFile := fmt.Sprintf("../../../%s", tzFile)
|
||||
|
@ -1600,7 +1600,7 @@ USER mail`, BB)
|
|||
Expect(session.ErrorToString()).To(ContainSubstring("finding timezone for container"))
|
||||
|
||||
err = os.Remove(tzFile)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--tz", "foo", "--rm", ALPINE, "date"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -1740,7 +1740,7 @@ WORKDIR /madethis`, BB)
|
|||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -1762,7 +1762,7 @@ WORKDIR /madethis`, BB)
|
|||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -1784,7 +1784,7 @@ WORKDIR /madethis`, BB)
|
|||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret_target", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -1806,7 +1806,7 @@ WORKDIR /madethis`, BB)
|
|||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret_target2", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -1828,7 +1828,7 @@ WORKDIR /madethis`, BB)
|
|||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -1844,7 +1844,7 @@ WORKDIR /madethis`, BB)
|
|||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -1860,7 +1860,7 @@ WORKDIR /madethis`, BB)
|
|||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -1887,7 +1887,7 @@ WORKDIR /madethis`, BB)
|
|||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -1903,7 +1903,7 @@ WORKDIR /madethis`, BB)
|
|||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -1968,12 +1968,12 @@ WORKDIR /madethis`, BB)
|
|||
Expect(session).Should(Exit(0))
|
||||
readFirstLine := func(path string) string {
|
||||
content, err := os.ReadFile(path)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
return strings.Split(string(content), "\n")[0]
|
||||
}
|
||||
containerPID := readFirstLine(pidfile)
|
||||
_, err = strconv.Atoi(containerPID) // Make sure it's a proper integer
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman run check personality support", func() {
|
||||
|
|
|
@ -18,7 +18,7 @@ func createContainersConfFileWithCustomUserns(pTest *PodmanTestIntegration, user
|
|||
configPath := filepath.Join(pTest.TempDir, "containers.conf")
|
||||
containersConf := []byte(fmt.Sprintf("[containers]\nuserns = \"%s\"\n", userns))
|
||||
err := os.WriteFile(configPath, containersConf, os.ModePerm)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Set custom containers.conf file
|
||||
os.Setenv("CONTAINERS_CONF", configPath)
|
||||
|
@ -63,7 +63,7 @@ var _ = Describe("Podman UserNS support", func() {
|
|||
// we don't break this feature for podman-remote.
|
||||
It("podman build with --userns=auto", func() {
|
||||
u, err := user.Current()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
name := u.Name
|
||||
if name == "root" {
|
||||
name = "containers"
|
||||
|
@ -154,7 +154,7 @@ var _ = Describe("Podman UserNS support", func() {
|
|||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
u, err := user.Current()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session.OutputToString()).To(ContainSubstring(u.Name))
|
||||
})
|
||||
|
||||
|
@ -198,7 +198,7 @@ var _ = Describe("Podman UserNS support", func() {
|
|||
|
||||
It("podman --userns=auto", func() {
|
||||
u, err := user.Current()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
name := u.Name
|
||||
if name == "root" {
|
||||
name = "containers"
|
||||
|
@ -235,7 +235,7 @@ var _ = Describe("Podman UserNS support", func() {
|
|||
|
||||
It("podman --userns=auto:size=%d", func() {
|
||||
u, err := user.Current()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
name := u.Name
|
||||
if name == "root" {
|
||||
|
@ -273,7 +273,7 @@ var _ = Describe("Podman UserNS support", func() {
|
|||
|
||||
It("podman --userns=auto:uidmapping=", func() {
|
||||
u, err := user.Current()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
name := u.Name
|
||||
if name == "root" {
|
||||
|
@ -302,7 +302,7 @@ var _ = Describe("Podman UserNS support", func() {
|
|||
|
||||
It("podman --userns=auto:gidmapping=", func() {
|
||||
u, err := user.Current()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
name := u.Name
|
||||
if name == "root" {
|
||||
|
|
|
@ -153,12 +153,12 @@ var _ = Describe("Podman run with volumes", func() {
|
|||
Expect(err).ToNot(HaveOccurred())
|
||||
mountPath := filepath.Join(podmanTest.TempDir, "secrets")
|
||||
err := os.Mkdir(mountPath, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
testFile := filepath.Join(mountPath, "test1")
|
||||
f, err := os.Create(testFile)
|
||||
Expect(err).To(BeNil(), "os.Create(testfile)")
|
||||
Expect(err).ToNot(HaveOccurred(), "os.Create(testfile)")
|
||||
f.Close()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session := podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:/data", mountPath), REDIS_IMAGE, "ls", "/data/test1"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
|
@ -284,12 +284,12 @@ var _ = Describe("Podman run with volumes", func() {
|
|||
// create persistent upperdir on host
|
||||
upperDir := filepath.Join(tempdir, "upper")
|
||||
err := os.Mkdir(upperDir, 0755)
|
||||
Expect(err).To(BeNil(), "mkdir "+upperDir)
|
||||
Expect(err).ToNot(HaveOccurred(), "mkdir "+upperDir)
|
||||
|
||||
// create persistent workdir on host
|
||||
workDir := filepath.Join(tempdir, "work")
|
||||
err = os.Mkdir(workDir, 0755)
|
||||
Expect(err).To(BeNil(), "mkdir "+workDir)
|
||||
Expect(err).ToNot(HaveOccurred(), "mkdir "+workDir)
|
||||
|
||||
overlayOpts := fmt.Sprintf("upperdir=%s,workdir=%s", upperDir, workDir)
|
||||
|
||||
|
@ -338,17 +338,17 @@ var _ = Describe("Podman run with volumes", func() {
|
|||
// Use bindsource instead of named volume
|
||||
bindSource := filepath.Join(tempdir, "bindsource")
|
||||
err := os.Mkdir(bindSource, 0755)
|
||||
Expect(err).To(BeNil(), "mkdir "+bindSource)
|
||||
Expect(err).ToNot(HaveOccurred(), "mkdir "+bindSource)
|
||||
|
||||
// create persistent upperdir on host
|
||||
upperDir := filepath.Join(tempdir, "upper")
|
||||
err = os.Mkdir(upperDir, 0755)
|
||||
Expect(err).To(BeNil(), "mkdir "+upperDir)
|
||||
Expect(err).ToNot(HaveOccurred(), "mkdir "+upperDir)
|
||||
|
||||
// create persistent workdir on host
|
||||
workDir := filepath.Join(tempdir, "work")
|
||||
err = os.Mkdir(workDir, 0755)
|
||||
Expect(err).To(BeNil(), "mkdir "+workDir)
|
||||
Expect(err).ToNot(HaveOccurred(), "mkdir "+workDir)
|
||||
|
||||
overlayOpts := fmt.Sprintf("upperdir=%s,workdir=%s", upperDir, workDir)
|
||||
|
||||
|
@ -385,7 +385,7 @@ var _ = Describe("Podman run with volumes", func() {
|
|||
|
||||
// Volume not mounted on create
|
||||
mountCmd1, err := Start(exec.Command("mount"), GinkgoWriter, GinkgoWriter)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
mountCmd1.Wait(90)
|
||||
Expect(mountCmd1).Should(Exit(0))
|
||||
os.Stdout.Sync()
|
||||
|
@ -401,7 +401,7 @@ var _ = Describe("Podman run with volumes", func() {
|
|||
|
||||
// Volume now mounted as container is running
|
||||
mountCmd2, err := Start(exec.Command("mount"), GinkgoWriter, GinkgoWriter)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
mountCmd2.Wait(90)
|
||||
Expect(mountCmd2).Should(Exit(0))
|
||||
os.Stdout.Sync()
|
||||
|
@ -422,7 +422,7 @@ var _ = Describe("Podman run with volumes", func() {
|
|||
|
||||
// Ensure volume is unmounted
|
||||
mountCmd3, err := Start(exec.Command("mount"), GinkgoWriter, GinkgoWriter)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
mountCmd3.Wait(90)
|
||||
Expect(mountCmd3).Should(Exit(0))
|
||||
os.Stdout.Sync()
|
||||
|
@ -621,7 +621,7 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
|
|||
|
||||
fileName := "thisIsATestFile"
|
||||
file, err := os.Create(filepath.Join(path, fileName))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer file.Close()
|
||||
|
||||
runLs := podmanTest.Podman([]string{"run", "-t", "-i", "--rm", "-v", fmt.Sprintf("%v:/etc/ssl", volName), ALPINE, "ls", "-1", "/etc/ssl"})
|
||||
|
@ -665,7 +665,7 @@ VOLUME /test/`, ALPINE)
|
|||
Expect(err).ToNot(HaveOccurred())
|
||||
testFile := filepath.Join(mountPath, "test1")
|
||||
f, err := os.Create(testFile)
|
||||
Expect(err).To(BeNil(), "os.Create "+testFile)
|
||||
Expect(err).ToNot(HaveOccurred(), "os.Create "+testFile)
|
||||
f.Close()
|
||||
|
||||
// Make sure host directory gets mounted in to container as overlay
|
||||
|
@ -679,7 +679,7 @@ VOLUME /test/`, ALPINE)
|
|||
|
||||
// Test overlay mount when lowerdir is relative path.
|
||||
f, err = os.Create("hello")
|
||||
Expect(err).To(BeNil(), "os.Create")
|
||||
Expect(err).ToNot(HaveOccurred(), "os.Create")
|
||||
f.Close()
|
||||
session = podmanTest.Podman([]string{"run", "--rm", "-v", ".:/app:O", ALPINE, "ls", "/app"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -691,7 +691,7 @@ VOLUME /test/`, ALPINE)
|
|||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
_, err = os.Stat(filepath.Join(mountPath, "container"))
|
||||
Expect(err).To(Not(BeNil()))
|
||||
Expect(err).To(HaveOccurred())
|
||||
|
||||
// Make sure modifications in container disappear when container is stopped
|
||||
session = podmanTest.Podman([]string{"create", "-v", fmt.Sprintf("%s:/run/test:O", mountPath), ALPINE, "top"})
|
||||
|
@ -723,11 +723,11 @@ VOLUME /test/`, ALPINE)
|
|||
Expect(err).ToNot(HaveOccurred())
|
||||
testFile := filepath.Join(mountPath, "test1")
|
||||
f, err := os.Create(testFile)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
f.Close()
|
||||
mountSrc := filepath.Join(podmanTest.TempDir, "vol-test1")
|
||||
err = os.MkdirAll(mountSrc, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
mountDest := "/run/test"
|
||||
volName := "myvol"
|
||||
|
||||
|
@ -761,7 +761,7 @@ VOLUME /test/`, ALPINE)
|
|||
SkipIfRemote("Overlay volumes only work locally")
|
||||
|
||||
u, err := user.Current()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
name := u.Username
|
||||
if name == "root" {
|
||||
name = "containers"
|
||||
|
@ -808,7 +808,7 @@ VOLUME /test/`, ALPINE)
|
|||
|
||||
It("podman run with --mount and U flag", func() {
|
||||
u, err := user.Current()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
name := u.Username
|
||||
if name == "root" {
|
||||
name = "containers"
|
||||
|
@ -927,7 +927,7 @@ USER testuser`, fedoraMinimal)
|
|||
It("podman run with -v $SRC:/run does not create /run/.containerenv", func() {
|
||||
mountSrc := filepath.Join(podmanTest.TempDir, "vol-test1")
|
||||
err := os.MkdirAll(mountSrc, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "-v", mountSrc + ":/run", ALPINE, "true"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -935,7 +935,7 @@ USER testuser`, fedoraMinimal)
|
|||
|
||||
// the file should not have been created
|
||||
_, err = os.Stat(filepath.Join(mountSrc, ".containerenv"))
|
||||
Expect(err).To(Not(BeNil()))
|
||||
Expect(err).To(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman volume with uid and gid works", func() {
|
||||
|
|
|
@ -48,7 +48,7 @@ var _ = Describe("Podman run", func() {
|
|||
|
||||
It("podman run a container using a --workdir under a bind mount", func() {
|
||||
volume, err := CreateTempDirInTempDir()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "--volume", fmt.Sprintf("%s:/var_ovl/:O", volume), "--workdir", "/var_ovl/log", ALPINE, "true"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
|
|
@ -154,10 +154,10 @@ var _ = Describe("Podman save", func() {
|
|||
}
|
||||
tempGNUPGHOME := filepath.Join(podmanTest.TempDir, "tmpGPG")
|
||||
err := os.Mkdir(tempGNUPGHOME, os.ModePerm)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
origGNUPGHOME := os.Getenv("GNUPGHOME")
|
||||
err = os.Setenv("GNUPGHOME", tempGNUPGHOME)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer os.Setenv("GNUPGHOME", origGNUPGHOME)
|
||||
|
||||
port := 5000
|
||||
|
@ -173,7 +173,7 @@ var _ = Describe("Podman save", func() {
|
|||
|
||||
cmd := exec.Command("gpg", "--import", "sign/secret-key.asc")
|
||||
err = cmd.Run()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
defaultYaml := filepath.Join(podmanTest.TempDir, "default.yaml")
|
||||
cmd = exec.Command("cp", "/etc/containers/registries.d/default.yaml", defaultYaml)
|
||||
|
@ -187,13 +187,13 @@ var _ = Describe("Podman save", func() {
|
|||
}()
|
||||
|
||||
cmd = exec.Command("cp", "sign/key.gpg", "/tmp/key.gpg")
|
||||
Expect(cmd.Run()).To(BeNil())
|
||||
Expect(cmd.Run()).To(Succeed())
|
||||
sigstore := `
|
||||
default-docker:
|
||||
sigstore: file:///var/lib/containers/sigstore
|
||||
sigstore-staging: file:///var/lib/containers/sigstore
|
||||
`
|
||||
Expect(os.WriteFile("/etc/containers/registries.d/default.yaml", []byte(sigstore), 0755)).To(BeNil())
|
||||
Expect(os.WriteFile("/etc/containers/registries.d/default.yaml", []byte(sigstore), 0755)).To(Succeed())
|
||||
|
||||
session = podmanTest.Podman([]string{"tag", ALPINE, "localhost:5000/alpine"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
|
|
@ -122,7 +122,7 @@ registries = ['{{.Host}}:{{.Port}}']`
|
|||
contents := make([]entities.ImageSearchReport, 0)
|
||||
err := json.Unmarshal(search.Out.Contents(), &contents)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(len(contents)).To(BeNumerically(">", 0), "No results from image search")
|
||||
Expect(contents).ToNot(BeEmpty(), "No results from image search")
|
||||
for _, element := range contents {
|
||||
Expect(element.Description).ToNot(HaveSuffix("..."))
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ registries = ['{{.Host}}:{{.Port}}']`
|
|||
searchEmpty := podmanTest.Podman([]string{"search", fmt.Sprintf("%s/", ep.Address()), "--tls-verify=false"})
|
||||
searchEmpty.WaitWithDefaultTimeout()
|
||||
Expect(searchEmpty).Should(Exit(0))
|
||||
Expect(len(searchEmpty.OutputToStringArray())).To(BeNumerically(">=", 1))
|
||||
Expect(searchEmpty.OutputToStringArray()).ToNot(BeEmpty())
|
||||
Expect(search.OutputToString()).To(ContainSubstring("my-alpine"))
|
||||
})
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ var _ = Describe("Podman secret", func() {
|
|||
It("podman secret create", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "-d", "file", "--driver-opts", "opt1=val", "a", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -57,7 +57,7 @@ var _ = Describe("Podman secret", func() {
|
|||
It("podman secret create bad name should fail", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "?!", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -67,7 +67,7 @@ var _ = Describe("Podman secret", func() {
|
|||
It("podman secret inspect", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -83,7 +83,7 @@ var _ = Describe("Podman secret", func() {
|
|||
It("podman secret inspect with --format", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -99,7 +99,7 @@ var _ = Describe("Podman secret", func() {
|
|||
It("podman secret inspect with --pretty", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -116,7 +116,7 @@ var _ = Describe("Podman secret", func() {
|
|||
It("podman secret inspect multiple secrets", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -137,7 +137,7 @@ var _ = Describe("Podman secret", func() {
|
|||
It("podman secret inspect bogus", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
inspect := podmanTest.Podman([]string{"secret", "inspect", "bogus"})
|
||||
inspect.WaitWithDefaultTimeout()
|
||||
|
@ -147,7 +147,7 @@ var _ = Describe("Podman secret", func() {
|
|||
It("podman secret ls", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -163,7 +163,7 @@ var _ = Describe("Podman secret", func() {
|
|||
It("podman secret ls --quiet", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
secretName := "a"
|
||||
|
||||
|
@ -193,7 +193,7 @@ var _ = Describe("Podman secret", func() {
|
|||
It("podman secret ls with filters", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
secret1 := "Secret1"
|
||||
secret2 := "Secret2"
|
||||
|
@ -247,7 +247,7 @@ var _ = Describe("Podman secret", func() {
|
|||
It("podman secret ls with Go template", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -263,7 +263,7 @@ var _ = Describe("Podman secret", func() {
|
|||
It("podman secret rm", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -284,7 +284,7 @@ var _ = Describe("Podman secret", func() {
|
|||
It("podman secret rm --all", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -328,7 +328,7 @@ var _ = Describe("Podman secret", func() {
|
|||
It("podman secret with labels", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "--label", "foo=bar", "a", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
|
|
@ -204,12 +204,12 @@ var _ = Describe("Podman start", func() {
|
|||
Expect(session).Should(Exit(0))
|
||||
readFirstLine := func(path string) string {
|
||||
content, err := os.ReadFile(path)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
return strings.Split(string(content), "\n")[0]
|
||||
}
|
||||
containerPID := readFirstLine(pidfile)
|
||||
_, err = strconv.Atoi(containerPID) // Make sure it's a proper integer
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman start container --filter", func() {
|
||||
|
|
|
@ -231,9 +231,9 @@ var _ = Describe("Podman stats", func() {
|
|||
Expect(limits[0]).ToNot(Equal(limits[2]))
|
||||
|
||||
defaultLimit, err := strconv.Atoi(limits[0])
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
customLimit, err := strconv.Atoi(limits[2])
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(customLimit).To(BeNumerically("<", defaultLimit))
|
||||
})
|
||||
|
|
|
@ -276,7 +276,7 @@ var _ = Describe("Podman stop", func() {
|
|||
It("podman stop --cidfile", func() {
|
||||
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
tmpFile := tmpDir + "cid"
|
||||
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
@ -300,7 +300,7 @@ var _ = Describe("Podman stop", func() {
|
|||
It("podman stop multiple --cidfile", func() {
|
||||
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
tmpFile1 := tmpDir + "cid-1"
|
||||
tmpFile2 := tmpDir + "cid-2"
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ WantedBy=default.target
|
|||
SkipIfContainerized("test does not have systemd as pid 1")
|
||||
|
||||
sysFile := os.WriteFile("/etc/systemd/system/redis.service", []byte(systemdUnitFile), 0644)
|
||||
Expect(sysFile).To(BeNil())
|
||||
Expect(sysFile).ToNot(HaveOccurred())
|
||||
defer func() {
|
||||
stop := SystemExec("bash", []string{"-c", "systemctl stop redis"})
|
||||
os.Remove("/etc/systemd/system/redis.service")
|
||||
|
@ -137,7 +137,7 @@ CMD /usr/lib/systemd/systemd`, ALPINE)
|
|||
|
||||
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||
err := os.WriteFile(containerfilePath, []byte(containerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session := podmanTest.Podman([]string{"build", "-t", "systemd", "--file", containerfilePath, podmanTest.TempDir})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
|
@ -167,7 +167,7 @@ CMD /usr/lib/systemd/systemd`, ALPINE)
|
|||
|
||||
pidFile := strings.TrimSuffix(session.OutputToString(), "\n")
|
||||
_, err := os.ReadFile(pidFile)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("podman create container with systemd=always triggers systemd mode", func() {
|
||||
|
|
|
@ -90,7 +90,7 @@ var _ = Describe("Toolbox-specific testing", func() {
|
|||
var err error
|
||||
|
||||
err = syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlimit)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
fmt.Printf("Expected value: %d", rlimit.Max)
|
||||
|
||||
session = podmanTest.Podman([]string{"create", "--name", "test", "--ulimit", "host", ALPINE,
|
||||
|
@ -107,7 +107,7 @@ var _ = Describe("Toolbox-specific testing", func() {
|
|||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
containerHardLimit, err = strconv.Atoi(strings.Trim(session.OutputToString(), "\n"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(containerHardLimit).To(BeNumerically(">=", rlimit.Max))
|
||||
})
|
||||
|
||||
|
@ -128,11 +128,11 @@ var _ = Describe("Toolbox-specific testing", func() {
|
|||
// ('1K-blocks') needs to be extracted manually.
|
||||
cmd = exec.Command("df", "/dev/shm")
|
||||
res, err := cmd.Output()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
lines := strings.SplitN(string(res), "\n", 2)
|
||||
fields := strings.Fields(lines[len(lines)-1])
|
||||
hostShmSize, err = strconv.Atoi(fields[1])
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session = podmanTest.Podman([]string{"create", "--name", "test", "--ipc=host", "--pid=host", ALPINE,
|
||||
"sleep", "1000"})
|
||||
|
@ -150,7 +150,7 @@ var _ = Describe("Toolbox-specific testing", func() {
|
|||
lines = session.OutputToStringArray()
|
||||
fields = strings.Fields(lines[len(lines)-1])
|
||||
containerShmSize, err = strconv.Atoi(fields[1])
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// In some cases it may happen that the size of /dev/shm is not exactly
|
||||
// equal. Therefore it's fine if there's a slight tolerance between the
|
||||
|
@ -173,16 +173,16 @@ var _ = Describe("Toolbox-specific testing", func() {
|
|||
var err error
|
||||
|
||||
currentUser, err := user.Current()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
currentGroup, err := user.LookupGroupId(currentUser.Gid)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session = podmanTest.Podman([]string{"create", "--name", "test", "--userns=keep-id", ALPINE,
|
||||
"sleep", "1000"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session = podmanTest.Podman([]string{"start", "test"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -374,7 +374,7 @@ var _ = Describe("Toolbox-specific testing", func() {
|
|||
SkipIfNotRootless("only meaningful when run rootless")
|
||||
var session *PodmanSessionIntegration
|
||||
currentUser, err := user.Current()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:%s", currentUser.HomeDir, currentUser.HomeDir), "--userns=keep-id", fedoraToolbox, "sh", "-c", "echo $HOME"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
|
|
@ -17,7 +17,7 @@ var _ = Describe("Podman update", func() {
|
|||
|
||||
BeforeEach(func() {
|
||||
tempdir, err = CreateTempDirInTempDir()
|
||||
Expect(err).To(BeNil())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
podmanTest = PodmanTestCreate(tempdir)
|
||||
podmanTest.Setup()
|
||||
})
|
||||
|
|
|
@ -52,7 +52,7 @@ var _ = Describe("Common functions test", func() {
|
|||
if !empty {
|
||||
f, _ := os.Create(path)
|
||||
_, err := f.WriteString(txt)
|
||||
Expect(err).To(BeNil(), "Failed to write data.")
|
||||
Expect(err).ToNot(HaveOccurred(), "Failed to write data.")
|
||||
f.Close()
|
||||
}
|
||||
|
||||
|
@ -104,13 +104,13 @@ var _ = Describe("Common functions test", func() {
|
|||
}
|
||||
|
||||
testByte, err := json.Marshal(testData)
|
||||
Expect(err).To(BeNil(), "Failed to marshal data.")
|
||||
Expect(err).ToNot(HaveOccurred(), "Failed to marshal data.")
|
||||
|
||||
err = WriteJSONFile(testByte, "/tmp/testJSON")
|
||||
Expect(err).To(BeNil(), "Failed to write JSON to file.")
|
||||
Expect(err).ToNot(HaveOccurred(), "Failed to write JSON to file.")
|
||||
|
||||
read, err := os.Open("/tmp/testJSON")
|
||||
Expect(err).To(BeNil(), "Can not find the JSON file after we write it.")
|
||||
Expect(err).ToNot(HaveOccurred(), "Can not find the JSON file after we write it.")
|
||||
defer read.Close()
|
||||
|
||||
bytes, err := io.ReadAll(read)
|
||||
|
@ -139,7 +139,7 @@ var _ = Describe("Common functions test", func() {
|
|||
if createFile {
|
||||
f, _ := os.Create(path)
|
||||
_, err := f.WriteString(txt)
|
||||
Expect(err).To(BeNil(), "Failed to write data.")
|
||||
Expect(err).ToNot(HaveOccurred(), "Failed to write data.")
|
||||
f.Close()
|
||||
}
|
||||
ProcessOneCgroupPath = path
|
||||
|
|
Loading…
Reference in New Issue