Skip to content

Commit

Permalink
Add alias for podman network rm -> remove
Browse files Browse the repository at this point in the history
docker network remove exists and is alias to docker network rm.

Bug for bug compatible.

Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Nov 19, 2020
1 parent 70f91fb commit f4eac94
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 25 deletions.
1 change: 1 addition & 0 deletions cmd/podman/networks/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var (
networkrmDescription = `Remove networks`
networkrmCommand = &cobra.Command{
Use: "rm [options] NETWORK [NETWORK...]",
Aliases: []string{"remove"},
Short: "network rm",
Long: networkrmDescription,
RunE: networkRm,
Expand Down
55 changes: 30 additions & 25 deletions test/e2e/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,31 +76,36 @@ var _ = Describe("Podman network", func() {
Expect(session.LineInOutputContains(name)).To(BeFalse())
})

It("podman network rm no args", func() {
session := podmanTest.Podman([]string{"network", "rm"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).ToNot(BeZero())
})

It("podman network rm", func() {
SkipIfRootless("FIXME: This one is definitely broken in rootless mode")
name, path := generateNetworkConfig(podmanTest)
defer removeConf(path)

session := podmanTest.Podman([]string{"network", "ls", "--quiet"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.LineInOutputContains(name)).To(BeTrue())

rm := podmanTest.Podman([]string{"network", "rm", name})
rm.WaitWithDefaultTimeout()
Expect(rm.ExitCode()).To(BeZero())

results := podmanTest.Podman([]string{"network", "ls", "--quiet"})
results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(0))
Expect(results.LineInOutputContains(name)).To(BeFalse())
})
rm_func := func(rm string) {
It(fmt.Sprintf("podman network %s no args", rm), func() {
session := podmanTest.Podman([]string{"network", rm})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).ToNot(BeZero())

})

It(fmt.Sprintf("podman network %s", rm), func() {
name, path := generateNetworkConfig(podmanTest)
defer removeConf(path)

session := podmanTest.Podman([]string{"network", "ls", "--quiet"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.LineInOutputContains(name)).To(BeTrue())

rm := podmanTest.Podman([]string{"network", rm, name})
rm.WaitWithDefaultTimeout()
Expect(rm.ExitCode()).To(BeZero())

results := podmanTest.Podman([]string{"network", "ls", "--quiet"})
results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(0))
Expect(results.LineInOutputContains(name)).To(BeFalse())
})
}

rm_func("rm")
rm_func("remove")

It("podman network inspect no args", func() {
session := podmanTest.Podman([]string{"network", "inspect"})
Expand Down

0 comments on commit f4eac94

Please sign in to comment.