mirror of
https://github.com/containers/podman.git
synced 2025-11-30 18:18:18 +08:00
Add podman rm --depend
This option causes Podman to not only remove the specified containers but all of the containers that depend on the specified containers. Fixes: https://github.com/containers/podman/issues/10360 Also ran codespell on the code Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@@ -175,7 +175,7 @@ var _ = Describe("Podman containers ", func() {
|
||||
Expect(err).To(BeNil())
|
||||
err = containers.Pause(bt.conn, cid, nil)
|
||||
Expect(err).To(BeNil())
|
||||
err = containers.Remove(bt.conn, cid, nil)
|
||||
_, err = containers.Remove(bt.conn, cid, nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
@@ -188,8 +188,10 @@ var _ = Describe("Podman containers ", func() {
|
||||
Expect(err).To(BeNil())
|
||||
err = containers.Pause(bt.conn, cid, nil)
|
||||
Expect(err).To(BeNil())
|
||||
err = containers.Remove(bt.conn, cid, new(containers.RemoveOptions).WithForce(true))
|
||||
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))
|
||||
})
|
||||
|
||||
It("podman stop a paused container by name", func() {
|
||||
@@ -669,7 +671,8 @@ var _ = Describe("Podman containers ", func() {
|
||||
})
|
||||
|
||||
It("podman remove bogus container", func() {
|
||||
err = containers.Remove(bt.conn, "foobar", nil)
|
||||
_, err := containers.Remove(bt.conn, "foobar", nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusNotFound))
|
||||
})
|
||||
@@ -679,7 +682,7 @@ var _ = Describe("Podman containers ", func() {
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
// Removing running container should fail
|
||||
err = containers.Remove(bt.conn, name, nil)
|
||||
_, err = containers.Remove(bt.conn, name, nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
@@ -690,7 +693,7 @@ var _ = Describe("Podman containers ", func() {
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
// Removing running container should fail
|
||||
err = containers.Remove(bt.conn, cid, nil)
|
||||
_, err = containers.Remove(bt.conn, cid, nil)
|
||||
Expect(err).ToNot(BeNil())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
@@ -700,22 +703,22 @@ var _ = Describe("Podman containers ", func() {
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
// Removing running container should fail
|
||||
err = containers.Remove(bt.conn, name, new(containers.RemoveOptions).WithForce(true))
|
||||
// Removing running container should succeed
|
||||
rmResponse, err := containers.Remove(bt.conn, name, new(containers.RemoveOptions).WithForce(true))
|
||||
Expect(err).To(BeNil())
|
||||
//code, _ := bindings.CheckResponseCode(err)
|
||||
//Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
Expect(len(reports.RmReportsErrs(rmResponse))).To(Equal(0))
|
||||
Expect(len(reports.RmReportsIds(rmResponse))).To(Equal(1))
|
||||
})
|
||||
|
||||
It("podman forcibly remove running container by ID", func() {
|
||||
var name = "top"
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
// Removing running container should fail
|
||||
err = containers.Remove(bt.conn, cid, new(containers.RemoveOptions).WithForce(true))
|
||||
// Forcably Removing running container should succeed
|
||||
rmResponse, err := containers.Remove(bt.conn, cid, new(containers.RemoveOptions).WithForce(true))
|
||||
Expect(err).To(BeNil())
|
||||
//code, _ := bindings.CheckResponseCode(err)
|
||||
//Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
Expect(len(reports.RmReportsErrs(rmResponse))).To(Equal(0))
|
||||
Expect(len(reports.RmReportsIds(rmResponse))).To(Equal(1))
|
||||
})
|
||||
|
||||
It("podman remove running container and volume by name", func() {
|
||||
@@ -723,7 +726,7 @@ var _ = Describe("Podman containers ", func() {
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
// Removing running container should fail
|
||||
err = containers.Remove(bt.conn, name, new(containers.RemoveOptions).WithVolumes(true))
|
||||
_, err = containers.Remove(bt.conn, name, new(containers.RemoveOptions).WithVolumes(true))
|
||||
Expect(err).ToNot(BeNil())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
@@ -734,7 +737,7 @@ var _ = Describe("Podman containers ", func() {
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
// Removing running container should fail
|
||||
err = containers.Remove(bt.conn, cid, new(containers.RemoveOptions).WithVolumes(true))
|
||||
_, err = containers.Remove(bt.conn, cid, new(containers.RemoveOptions).WithVolumes(true))
|
||||
Expect(err).ToNot(BeNil())
|
||||
code, _ := bindings.CheckResponseCode(err)
|
||||
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
@@ -744,11 +747,11 @@ var _ = Describe("Podman containers ", func() {
|
||||
var name = "top"
|
||||
_, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
// Removing running container should fail
|
||||
err = containers.Remove(bt.conn, name, new(containers.RemoveOptions).WithVolumes(true).WithForce(true))
|
||||
// Forcibly Removing running container should succeed
|
||||
rmResponse, err := containers.Remove(bt.conn, name, new(containers.RemoveOptions).WithVolumes(true).WithForce(true))
|
||||
Expect(err).To(BeNil())
|
||||
//code, _ := bindings.CheckResponseCode(err)
|
||||
//Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
Expect(len(reports.RmReportsErrs(rmResponse))).To(Equal(0))
|
||||
Expect(len(reports.RmReportsIds(rmResponse))).To(Equal(1))
|
||||
})
|
||||
|
||||
It("podman forcibly remove running container and volume by ID", func() {
|
||||
@@ -756,10 +759,10 @@ var _ = Describe("Podman containers ", func() {
|
||||
cid, err := bt.RunTopContainer(&name, nil)
|
||||
Expect(err).To(BeNil())
|
||||
// Removing running container should fail
|
||||
err = containers.Remove(bt.conn, cid, new(containers.RemoveOptions).WithForce(true).WithVolumes(true))
|
||||
rmResponse, err := containers.Remove(bt.conn, cid, new(containers.RemoveOptions).WithForce(true).WithVolumes(true))
|
||||
Expect(err).To(BeNil())
|
||||
//code, _ := bindings.CheckResponseCode(err)
|
||||
//Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
|
||||
Expect(len(reports.RmReportsErrs(rmResponse))).To(Equal(0))
|
||||
Expect(len(reports.RmReportsIds(rmResponse))).To(Equal(1))
|
||||
})
|
||||
|
||||
It("List containers with filters", func() {
|
||||
|
||||
Reference in New Issue
Block a user