Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alias for podman network rm -> remove #8404

Merged
merged 1 commit into from
Nov 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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