Merge pull request #6236 from jwhonce/wip/boxed

Make convenience boxed true/false easier to use
This commit is contained in:
OpenShift Merge Robot
2020-05-14 15:13:47 -07:00
committed by GitHub
11 changed files with 81 additions and 78 deletions

View File

@ -11,8 +11,10 @@ package bindings
var ( var (
// PTrue is a convenience variable that can be used in bindings where // PTrue is a convenience variable that can be used in bindings where
// a pointer to a bool (optional parameter) is required. // a pointer to a bool (optional parameter) is required.
PTrue bool = true pTrue = true
PTrue = &pTrue
// PFalse is a convenience variable that can be used in bindings where // PFalse is a convenience variable that can be used in bindings where
// a pointer to a bool (optional parameter) is required. // a pointer to a bool (optional parameter) is required.
PFalse bool = false pFalse = false
PFalse = &pFalse
) )

View File

@ -349,7 +349,7 @@ func Attach(ctx context.Context, nameOrId string, detachKeys *string, logs, stre
} }
// Do we need to wire in stdin? // Do we need to wire in stdin?
ctnr, err := Inspect(ctx, nameOrId, &bindings.PFalse) ctnr, err := Inspect(ctx, nameOrId, bindings.PFalse)
if err != nil { if err != nil {
return err return err
} }

View File

@ -54,11 +54,12 @@ var _ = Describe("Podman containers attach", func() {
go func() { go func() {
defer GinkgoRecover() defer GinkgoRecover()
err := containers.Attach(bt.conn, id, nil, &bindings.PTrue, &bindings.PTrue, nil, stdout, stderr) err := containers.Attach(bt.conn, id, nil, bindings.PTrue, bindings.PTrue, nil, stdout, stderr)
Expect(err).ShouldNot(HaveOccurred()) Expect(err).ShouldNot(HaveOccurred())
}() }()
time.Sleep(5 * time.Second) time.Sleep(5 * time.Second)
// First character/First line of top output // First character/First line of top output
Expect(stdout.String()).Should(ContainSubstring("Mem: ")) Expect(stdout.String()).Should(ContainSubstring("Mem: "))
}) })
@ -97,7 +98,7 @@ var _ = Describe("Podman containers attach", func() {
go func() { go func() {
defer GinkgoRecover() defer GinkgoRecover()
err := containers.Attach(bt.conn, ctnr.ID, nil, &bindings.PFalse, &bindings.PTrue, stdin, stdout, stderr) err := containers.Attach(bt.conn, ctnr.ID, nil, bindings.PFalse, bindings.PTrue, stdin, stdout, stderr)
Expect(err).ShouldNot(HaveOccurred()) Expect(err).ShouldNot(HaveOccurred())
}() }()

View File

@ -56,7 +56,7 @@ var _ = Describe("Podman containers ", func() {
It("podman pause a running container by name", func() { It("podman pause a running container by name", func() {
// Pausing by name should work // Pausing by name should work
var name = "top" var name = "top"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Pause(bt.conn, name) err = containers.Pause(bt.conn, name)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -70,7 +70,7 @@ var _ = Describe("Podman containers ", func() {
It("podman pause a running container by id", func() { It("podman pause a running container by id", func() {
// Pausing by id should work // Pausing by id should work
var name = "top" var name = "top"
cid, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Pause(bt.conn, cid) err = containers.Pause(bt.conn, cid)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -84,7 +84,7 @@ var _ = Describe("Podman containers ", func() {
It("podman unpause a running container by name", func() { It("podman unpause a running container by name", func() {
// Unpausing by name should work // Unpausing by name should work
var name = "top" var name = "top"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Pause(bt.conn, name) err = containers.Pause(bt.conn, name)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -100,7 +100,7 @@ var _ = Describe("Podman containers ", func() {
It("podman unpause a running container by ID", func() { It("podman unpause a running container by ID", func() {
// Unpausing by ID should work // Unpausing by ID should work
var name = "top" var name = "top"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// Pause by name // Pause by name
err = containers.Pause(bt.conn, name) err = containers.Pause(bt.conn, name)
@ -119,7 +119,7 @@ var _ = Describe("Podman containers ", func() {
It("podman pause a paused container by name", func() { It("podman pause a paused container by name", func() {
// Pausing a paused container by name should fail // Pausing a paused container by name should fail
var name = "top" var name = "top"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Pause(bt.conn, name) err = containers.Pause(bt.conn, name)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -132,7 +132,7 @@ var _ = Describe("Podman containers ", func() {
It("podman pause a paused container by id", func() { It("podman pause a paused container by id", func() {
// Pausing a paused container by id should fail // Pausing a paused container by id should fail
var name = "top" var name = "top"
cid, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Pause(bt.conn, cid) err = containers.Pause(bt.conn, cid)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -145,7 +145,7 @@ var _ = Describe("Podman containers ", func() {
It("podman pause a stopped container by name", func() { It("podman pause a stopped container by name", func() {
// Pausing a stopped container by name should fail // Pausing a stopped container by name should fail
var name = "top" var name = "top"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Stop(bt.conn, name, nil) err = containers.Stop(bt.conn, name, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -158,7 +158,7 @@ var _ = Describe("Podman containers ", func() {
It("podman pause a stopped container by id", func() { It("podman pause a stopped container by id", func() {
// Pausing a stopped container by id should fail // Pausing a stopped container by id should fail
var name = "top" var name = "top"
cid, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Stop(bt.conn, cid, nil) err = containers.Stop(bt.conn, cid, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -171,11 +171,11 @@ var _ = Describe("Podman containers ", func() {
It("podman remove a paused container by id without force", func() { It("podman remove a paused container by id without force", func() {
// Removing a paused container without force should fail // Removing a paused container without force should fail
var name = "top" var name = "top"
cid, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Pause(bt.conn, cid) err = containers.Pause(bt.conn, cid)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Remove(bt.conn, cid, &bindings.PFalse, &bindings.PFalse) err = containers.Remove(bt.conn, cid, bindings.PFalse, bindings.PFalse)
Expect(err).ToNot(BeNil()) Expect(err).ToNot(BeNil())
code, _ := bindings.CheckResponseCode(err) code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusInternalServerError)) Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@ -192,18 +192,18 @@ var _ = Describe("Podman containers ", func() {
// Removing a paused container with force should work // Removing a paused container with force should work
var name = "top" var name = "top"
cid, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Pause(bt.conn, cid) err = containers.Pause(bt.conn, cid)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Remove(bt.conn, cid, &bindings.PTrue, &bindings.PFalse) err = containers.Remove(bt.conn, cid, bindings.PTrue, bindings.PFalse)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
}) })
It("podman stop a paused container by name", func() { It("podman stop a paused container by name", func() {
// Stopping a paused container by name should fail // Stopping a paused container by name should fail
var name = "top" var name = "top"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Pause(bt.conn, name) err = containers.Pause(bt.conn, name)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -216,7 +216,7 @@ var _ = Describe("Podman containers ", func() {
It("podman stop a paused container by id", func() { It("podman stop a paused container by id", func() {
// Stopping a paused container by id should fail // Stopping a paused container by id should fail
var name = "top" var name = "top"
cid, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Pause(bt.conn, cid) err = containers.Pause(bt.conn, cid)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -229,7 +229,7 @@ var _ = Describe("Podman containers ", func() {
It("podman stop a running container by name", func() { It("podman stop a running container by name", func() {
// Stopping a running container by name should work // Stopping a running container by name should work
var name = "top" var name = "top"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Stop(bt.conn, name, nil) err = containers.Stop(bt.conn, name, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -243,7 +243,7 @@ var _ = Describe("Podman containers ", func() {
It("podman stop a running container by ID", func() { It("podman stop a running container by ID", func() {
// Stopping a running container by ID should work // Stopping a running container by ID should work
var name = "top" var name = "top"
cid, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Stop(bt.conn, cid, nil) err = containers.Stop(bt.conn, cid, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -326,7 +326,7 @@ var _ = Describe("Podman containers ", func() {
// a container that has no healthcheck should be a 409 // a container that has no healthcheck should be a 409
var name = "top" var name = "top"
bt.RunTopContainer(&name, &bindings.PFalse, nil) bt.RunTopContainer(&name, bindings.PFalse, nil)
_, err = containers.RunHealthCheck(bt.conn, name) _, err = containers.RunHealthCheck(bt.conn, name)
Expect(err).ToNot(BeNil()) Expect(err).ToNot(BeNil())
code, _ = bindings.CheckResponseCode(err) code, _ = bindings.CheckResponseCode(err)
@ -373,7 +373,7 @@ var _ = Describe("Podman containers ", func() {
_, err = containers.Wait(bt.conn, r.ID, nil) _, err = containers.Wait(bt.conn, r.ID, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
opts := containers.LogOptions{Stdout: &bindings.PTrue, Follow: &bindings.PTrue} opts := containers.LogOptions{Stdout: bindings.PTrue, Follow: bindings.PTrue}
go func() { go func() {
containers.Logs(bt.conn, r.ID, opts, stdoutChan, nil) containers.Logs(bt.conn, r.ID, opts, stdoutChan, nil)
}() }()
@ -385,7 +385,7 @@ var _ = Describe("Podman containers ", func() {
It("podman top", func() { It("podman top", func() {
var name = "top" var name = "top"
cid, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// By name // By name
@ -423,7 +423,7 @@ var _ = Describe("Podman containers ", func() {
It("podman container exists in local storage by name", func() { It("podman container exists in local storage by name", func() {
// Container existence check by name should work // Container existence check by name should work
var name = "top" var name = "top"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
containerExists, err := containers.Exists(bt.conn, name) containerExists, err := containers.Exists(bt.conn, name)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -433,7 +433,7 @@ var _ = Describe("Podman containers ", func() {
It("podman container exists in local storage by ID", func() { It("podman container exists in local storage by ID", func() {
// Container existence check by ID should work // Container existence check by ID should work
var name = "top" var name = "top"
cid, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
containerExists, err := containers.Exists(bt.conn, cid) containerExists, err := containers.Exists(bt.conn, cid)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -443,7 +443,7 @@ var _ = Describe("Podman containers ", func() {
It("podman container exists in local storage by short ID", func() { It("podman container exists in local storage by short ID", func() {
// Container existence check by short ID should work // Container existence check by short ID should work
var name = "top" var name = "top"
cid, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
containerExists, err := containers.Exists(bt.conn, cid[0:12]) containerExists, err := containers.Exists(bt.conn, cid[0:12])
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -461,7 +461,7 @@ var _ = Describe("Podman containers ", func() {
It("podman kill a running container by name with SIGINT", func() { It("podman kill a running container by name with SIGINT", func() {
// Killing a running container should work // Killing a running container should work
var name = "top" var name = "top"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Kill(bt.conn, name, "SIGINT") err = containers.Kill(bt.conn, name, "SIGINT")
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -472,7 +472,7 @@ var _ = Describe("Podman containers ", func() {
It("podman kill a running container by ID with SIGTERM", func() { It("podman kill a running container by ID with SIGTERM", func() {
// Killing a running container by ID should work // Killing a running container by ID should work
var name = "top" var name = "top"
cid, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Kill(bt.conn, cid, "SIGTERM") err = containers.Kill(bt.conn, cid, "SIGTERM")
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -483,7 +483,7 @@ var _ = Describe("Podman containers ", func() {
It("podman kill a running container by ID with SIGKILL", func() { It("podman kill a running container by ID with SIGKILL", func() {
// Killing a running container by ID with TERM should work // Killing a running container by ID with TERM should work
var name = "top" var name = "top"
cid, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Kill(bt.conn, cid, "SIGKILL") err = containers.Kill(bt.conn, cid, "SIGKILL")
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -492,7 +492,7 @@ var _ = Describe("Podman containers ", func() {
It("podman kill a running container by bogus signal", func() { It("podman kill a running container by bogus signal", func() {
//Killing a running container by bogus signal should fail //Killing a running container by bogus signal should fail
var name = "top" var name = "top"
cid, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Kill(bt.conn, cid, "foobar") err = containers.Kill(bt.conn, cid, "foobar")
Expect(err).ToNot(BeNil()) Expect(err).ToNot(BeNil())
@ -505,9 +505,9 @@ var _ = Describe("Podman containers ", func() {
var name1 = "first" var name1 = "first"
var name2 = "second" var name2 = "second"
var latestContainers = 1 var latestContainers = 1
_, err := bt.RunTopContainer(&name1, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name1, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
_, err = bt.RunTopContainer(&name2, &bindings.PFalse, nil) _, err = bt.RunTopContainer(&name2, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
containerLatestList, err := containers.List(bt.conn, nil, nil, &latestContainers, nil, nil, nil) containerLatestList, err := containers.List(bt.conn, nil, nil, &latestContainers, nil, nil, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -536,7 +536,7 @@ var _ = Describe("Podman containers ", func() {
It("podman prune stopped containers", func() { It("podman prune stopped containers", func() {
// Start and stop a container to enter in exited state. // Start and stop a container to enter in exited state.
var name = "top" var name = "top"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Stop(bt.conn, name, nil) err = containers.Stop(bt.conn, name, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -551,7 +551,7 @@ var _ = Describe("Podman containers ", func() {
It("podman prune stopped containers with filters", func() { It("podman prune stopped containers with filters", func() {
// Start and stop a container to enter in exited state. // Start and stop a container to enter in exited state.
var name = "top" var name = "top"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Stop(bt.conn, name, nil) err = containers.Stop(bt.conn, name, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -585,7 +585,7 @@ var _ = Describe("Podman containers ", func() {
It("podman prune running containers", func() { It("podman prune running containers", func() {
// Start the container. // Start the container.
var name = "top" var name = "top"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// Check if the container is running. // Check if the container is running.
@ -608,7 +608,7 @@ var _ = Describe("Podman containers ", func() {
It("podman inspect running container", func() { It("podman inspect running container", func() {
var name = "top" var name = "top"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// Inspecting running container should succeed // Inspecting running container should succeed
_, err = containers.Inspect(bt.conn, name, nil) _, err = containers.Inspect(bt.conn, name, nil)
@ -617,7 +617,7 @@ var _ = Describe("Podman containers ", func() {
It("podman inspect stopped container", func() { It("podman inspect stopped container", func() {
var name = "top" var name = "top"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Stop(bt.conn, name, nil) err = containers.Stop(bt.conn, name, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
@ -628,20 +628,20 @@ var _ = Describe("Podman containers ", func() {
It("podman inspect running container with size", func() { It("podman inspect running container with size", func() {
var name = "top" var name = "top"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
_, err = containers.Inspect(bt.conn, name, &bindings.PTrue) _, err = containers.Inspect(bt.conn, name, bindings.PTrue)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
}) })
It("podman inspect stopped container with size", func() { It("podman inspect stopped container with size", func() {
var name = "top" var name = "top"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Stop(bt.conn, name, nil) err = containers.Stop(bt.conn, name, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// Inspecting stopped container with size should succeed // Inspecting stopped container with size should succeed
_, err = containers.Inspect(bt.conn, name, &bindings.PTrue) _, err = containers.Inspect(bt.conn, name, bindings.PTrue)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
}) })
@ -653,7 +653,7 @@ var _ = Describe("Podman containers ", func() {
It("podman remove running container by name", func() { It("podman remove running container by name", func() {
var name = "top" var name = "top"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// Removing running container should fail // Removing running container should fail
err = containers.Remove(bt.conn, name, nil, nil) err = containers.Remove(bt.conn, name, nil, nil)
@ -664,7 +664,7 @@ var _ = Describe("Podman containers ", func() {
It("podman remove running container by ID", func() { It("podman remove running container by ID", func() {
var name = "top" var name = "top"
cid, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// Removing running container should fail // Removing running container should fail
err = containers.Remove(bt.conn, cid, nil, nil) err = containers.Remove(bt.conn, cid, nil, nil)
@ -675,10 +675,10 @@ var _ = Describe("Podman containers ", func() {
It("podman forcibly remove running container by name", func() { It("podman forcibly remove running container by name", func() {
var name = "top" var name = "top"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// Removing running container should fail // Removing running container should fail
err = containers.Remove(bt.conn, name, &bindings.PTrue, nil) err = containers.Remove(bt.conn, name, bindings.PTrue, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
//code, _ := bindings.CheckResponseCode(err) //code, _ := bindings.CheckResponseCode(err)
//Expect(code).To(BeNumerically("==", http.StatusInternalServerError)) //Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@ -686,10 +686,10 @@ var _ = Describe("Podman containers ", func() {
It("podman forcibly remove running container by ID", func() { It("podman forcibly remove running container by ID", func() {
var name = "top" var name = "top"
cid, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// Removing running container should fail // Removing running container should fail
err = containers.Remove(bt.conn, cid, &bindings.PTrue, nil) err = containers.Remove(bt.conn, cid, bindings.PTrue, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
//code, _ := bindings.CheckResponseCode(err) //code, _ := bindings.CheckResponseCode(err)
//Expect(code).To(BeNumerically("==", http.StatusInternalServerError)) //Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@ -697,10 +697,10 @@ var _ = Describe("Podman containers ", func() {
It("podman remove running container and volume by name", func() { It("podman remove running container and volume by name", func() {
var name = "top" var name = "top"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// Removing running container should fail // Removing running container should fail
err = containers.Remove(bt.conn, name, nil, &bindings.PTrue) err = containers.Remove(bt.conn, name, nil, bindings.PTrue)
Expect(err).ToNot(BeNil()) Expect(err).ToNot(BeNil())
code, _ := bindings.CheckResponseCode(err) code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusInternalServerError)) Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@ -708,10 +708,10 @@ var _ = Describe("Podman containers ", func() {
It("podman remove running container and volume by ID", func() { It("podman remove running container and volume by ID", func() {
var name = "top" var name = "top"
cid, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// Removing running container should fail // Removing running container should fail
err = containers.Remove(bt.conn, cid, nil, &bindings.PTrue) err = containers.Remove(bt.conn, cid, nil, bindings.PTrue)
Expect(err).ToNot(BeNil()) Expect(err).ToNot(BeNil())
code, _ := bindings.CheckResponseCode(err) code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusInternalServerError)) Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@ -719,10 +719,10 @@ var _ = Describe("Podman containers ", func() {
It("podman forcibly remove running container and volume by name", func() { It("podman forcibly remove running container and volume by name", func() {
var name = "top" var name = "top"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// Removing running container should fail // Removing running container should fail
err = containers.Remove(bt.conn, name, &bindings.PTrue, &bindings.PTrue) err = containers.Remove(bt.conn, name, bindings.PTrue, bindings.PTrue)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
//code, _ := bindings.CheckResponseCode(err) //code, _ := bindings.CheckResponseCode(err)
//Expect(code).To(BeNumerically("==", http.StatusInternalServerError)) //Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@ -730,10 +730,10 @@ var _ = Describe("Podman containers ", func() {
It("podman forcibly remove running container and volume by ID", func() { It("podman forcibly remove running container and volume by ID", func() {
var name = "top" var name = "top"
cid, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// Removing running container should fail // Removing running container should fail
err = containers.Remove(bt.conn, cid, &bindings.PTrue, &bindings.PTrue) err = containers.Remove(bt.conn, cid, bindings.PTrue, bindings.PTrue)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
//code, _ := bindings.CheckResponseCode(err) //code, _ := bindings.CheckResponseCode(err)
//Expect(code).To(BeNumerically("==", http.StatusInternalServerError)) //Expect(code).To(BeNumerically("==", http.StatusInternalServerError))

View File

@ -33,7 +33,7 @@ var _ = Describe("Podman containers exec", func() {
It("Podman exec create makes an exec session", func() { It("Podman exec create makes an exec session", func() {
name := "testCtr" name := "testCtr"
cid, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) cid, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
execConfig := new(handlers.ExecCreateConfig) execConfig := new(handlers.ExecCreateConfig)
@ -53,7 +53,7 @@ var _ = Describe("Podman containers exec", func() {
It("Podman exec create with bad command fails", func() { It("Podman exec create with bad command fails", func() {
name := "testCtr" name := "testCtr"
_, err := bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err := bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
execConfig := new(handlers.ExecCreateConfig) execConfig := new(handlers.ExecCreateConfig)

View File

@ -76,7 +76,7 @@ var _ = Describe("Podman images", func() {
// Expect(data.Size).To(BeZero()) // Expect(data.Size).To(BeZero())
// Enabling the size parameter should result in size being populated // Enabling the size parameter should result in size being populated
data, err = images.GetImage(bt.conn, alpine.name, &bindings.PTrue) data, err = images.GetImage(bt.conn, alpine.name, bindings.PTrue)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
Expect(data.Size).To(BeNumerically(">", 0)) Expect(data.Size).To(BeNumerically(">", 0))
}) })
@ -104,7 +104,7 @@ var _ = Describe("Podman images", func() {
// Start a container with alpine image // Start a container with alpine image
var top string = "top" var top string = "top"
_, err = bt.RunTopContainer(&top, &bindings.PFalse, nil) _, err = bt.RunTopContainer(&top, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// we should now have a container called "top" running // we should now have a container called "top" running
containerResponse, err := containers.Inspect(bt.conn, "top", nil) containerResponse, err := containers.Inspect(bt.conn, "top", nil)
@ -122,7 +122,7 @@ var _ = Describe("Podman images", func() {
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// To be extra sure, check if the previously created container // To be extra sure, check if the previously created container
// is gone as well. // is gone as well.
_, err = containers.Inspect(bt.conn, "top", &bindings.PFalse) _, err = containers.Inspect(bt.conn, "top", bindings.PFalse)
code, _ = bindings.CheckResponseCode(err) code, _ = bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusNotFound)) Expect(code).To(BeNumerically("==", http.StatusNotFound))
@ -182,13 +182,13 @@ var _ = Describe("Podman images", func() {
// List images with a filter // List images with a filter
filters := make(map[string][]string) filters := make(map[string][]string)
filters["reference"] = []string{alpine.name} filters["reference"] = []string{alpine.name}
filteredImages, err := images.List(bt.conn, &bindings.PFalse, filters) filteredImages, err := images.List(bt.conn, bindings.PFalse, filters)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
Expect(len(filteredImages)).To(BeNumerically("==", 1)) Expect(len(filteredImages)).To(BeNumerically("==", 1))
// List images with a bad filter // List images with a bad filter
filters["name"] = []string{alpine.name} filters["name"] = []string{alpine.name}
_, err = images.List(bt.conn, &bindings.PFalse, filters) _, err = images.List(bt.conn, bindings.PFalse, filters)
Expect(err).ToNot(BeNil()) Expect(err).ToNot(BeNil())
code, _ := bindings.CheckResponseCode(err) code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusInternalServerError)) Expect(code).To(BeNumerically("==", http.StatusInternalServerError))

View File

@ -63,7 +63,7 @@ var _ = Describe("Podman pods", func() {
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// Adding an alpine container to the existing pod // Adding an alpine container to the existing pod
_, err = bt.RunTopContainer(nil, &bindings.PTrue, &newpod) _, err = bt.RunTopContainer(nil, bindings.PTrue, &newpod)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
podSummary, err = pods.List(bt.conn, nil) podSummary, err = pods.List(bt.conn, nil)
// Verify no errors. // Verify no errors.
@ -93,7 +93,7 @@ var _ = Describe("Podman pods", func() {
_, err = pods.Start(bt.conn, newpod) _, err = pods.Start(bt.conn, newpod)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
_, err = bt.RunTopContainer(nil, &bindings.PTrue, &newpod) _, err = bt.RunTopContainer(nil, bindings.PTrue, &newpod)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// Expected err with invalid filter params // Expected err with invalid filter params
@ -174,7 +174,7 @@ var _ = Describe("Podman pods", func() {
Expect(code).To(BeNumerically("==", http.StatusNotFound)) Expect(code).To(BeNumerically("==", http.StatusNotFound))
// Adding an alpine container to the existing pod // Adding an alpine container to the existing pod
_, err = bt.RunTopContainer(nil, &bindings.PTrue, &newpod) _, err = bt.RunTopContainer(nil, bindings.PTrue, &newpod)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// Binding needs to be modified to inspect the pod state. // Binding needs to be modified to inspect the pod state.

View File

@ -65,12 +65,12 @@ var _ = Describe("Podman system", func() {
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// Start and stop a container to enter in exited state. // Start and stop a container to enter in exited state.
var name = "top" var name = "top"
_, err = bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err = bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Stop(bt.conn, name, nil) err = containers.Stop(bt.conn, name, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
systemPruneResponse, err := system.Prune(bt.conn, &bindings.PTrue, &bindings.PFalse) systemPruneResponse, err := system.Prune(bt.conn, bindings.PTrue, bindings.PFalse)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
Expect(len(systemPruneResponse.PodPruneReport)).To(Equal(1)) Expect(len(systemPruneResponse.PodPruneReport)).To(Equal(1))
Expect(len(systemPruneResponse.ContainerPruneReport.ID)).To(Equal(1)) Expect(len(systemPruneResponse.ContainerPruneReport.ID)).To(Equal(1))
@ -90,21 +90,21 @@ var _ = Describe("Podman system", func() {
// Start and stop a container to enter in exited state. // Start and stop a container to enter in exited state.
var name = "top" var name = "top"
_, err = bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err = bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Stop(bt.conn, name, nil) err = containers.Stop(bt.conn, name, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// Start container and leave in running // Start container and leave in running
var name2 = "top2" var name2 = "top2"
_, err = bt.RunTopContainer(&name2, &bindings.PFalse, nil) _, err = bt.RunTopContainer(&name2, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// Adding an unused volume // Adding an unused volume
_, err = volumes.Create(bt.conn, entities.VolumeCreateOptions{}) _, err = volumes.Create(bt.conn, entities.VolumeCreateOptions{})
Expect(err).To(BeNil()) Expect(err).To(BeNil())
systemPruneResponse, err := system.Prune(bt.conn, &bindings.PTrue, &bindings.PFalse) systemPruneResponse, err := system.Prune(bt.conn, bindings.PTrue, bindings.PFalse)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
Expect(len(systemPruneResponse.PodPruneReport)).To(Equal(1)) Expect(len(systemPruneResponse.PodPruneReport)).To(Equal(1))
Expect(len(systemPruneResponse.ContainerPruneReport.ID)).To(Equal(1)) Expect(len(systemPruneResponse.ContainerPruneReport.ID)).To(Equal(1))
@ -124,21 +124,21 @@ var _ = Describe("Podman system", func() {
// Start and stop a container to enter in exited state. // Start and stop a container to enter in exited state.
var name = "top" var name = "top"
_, err = bt.RunTopContainer(&name, &bindings.PFalse, nil) _, err = bt.RunTopContainer(&name, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = containers.Stop(bt.conn, name, nil) err = containers.Stop(bt.conn, name, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// Start second container and leave in running // Start second container and leave in running
var name2 = "top2" var name2 = "top2"
_, err = bt.RunTopContainer(&name2, &bindings.PFalse, nil) _, err = bt.RunTopContainer(&name2, bindings.PFalse, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
// Adding an unused volume should work // Adding an unused volume should work
_, err = volumes.Create(bt.conn, entities.VolumeCreateOptions{}) _, err = volumes.Create(bt.conn, entities.VolumeCreateOptions{})
Expect(err).To(BeNil()) Expect(err).To(BeNil())
systemPruneResponse, err := system.Prune(bt.conn, &bindings.PTrue, &bindings.PTrue) systemPruneResponse, err := system.Prune(bt.conn, bindings.PTrue, bindings.PTrue)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
Expect(len(systemPruneResponse.PodPruneReport)).To(Equal(0)) Expect(len(systemPruneResponse.PodPruneReport)).To(Equal(0))
Expect(len(systemPruneResponse.ContainerPruneReport.ID)).To(Equal(1)) Expect(len(systemPruneResponse.ContainerPruneReport.ID)).To(Equal(1))
@ -182,7 +182,7 @@ var _ = Describe("Podman system", func() {
Expect(len(podSummary)).To(Equal(0)) Expect(len(podSummary)).To(Equal(0))
// No images // No images
imageSummary, err = images.List(bt.conn, &bindings.PTrue, nil) imageSummary, err = images.List(bt.conn, bindings.PTrue, nil)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
Expect(len(imageSummary)).To(Equal(0)) Expect(len(imageSummary)).To(Equal(0))

View File

@ -105,7 +105,7 @@ var _ = Describe("Podman volumes", func() {
zero := uint(0) zero := uint(0)
err = containers.Stop(connText, "vtest", &zero) err = containers.Stop(connText, "vtest", &zero)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = volumes.Remove(connText, vol.Name, &bindings.PTrue) err = volumes.Remove(connText, vol.Name, bindings.PTrue)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
}) })

View File

@ -20,7 +20,7 @@ func getContainersByContext(contextWithConnection context.Context, all bool, nam
if all && len(namesOrIds) > 0 { if all && len(namesOrIds) > 0 {
return nil, errors.New("cannot lookup containers and all") return nil, errors.New("cannot lookup containers and all")
} }
c, err := containers.List(contextWithConnection, nil, &bindings.PTrue, nil, nil, nil, &bindings.PTrue) c, err := containers.List(contextWithConnection, nil, bindings.PTrue, nil, nil, nil, bindings.PTrue)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -112,7 +112,7 @@ func (ir *ImageEngine) Tag(ctx context.Context, nameOrId string, tags []string,
func (ir *ImageEngine) Untag(ctx context.Context, nameOrId string, tags []string, options entities.ImageUntagOptions) error { func (ir *ImageEngine) Untag(ctx context.Context, nameOrId string, tags []string, options entities.ImageUntagOptions) error {
// Remove all tags if none are provided // Remove all tags if none are provided
if len(tags) == 0 { if len(tags) == 0 {
newImage, err := images.GetImage(ir.ClientCxt, nameOrId, &bindings.PFalse) newImage, err := images.GetImage(ir.ClientCxt, nameOrId, bindings.PFalse)
if err != nil { if err != nil {
return err return err
} }