forked from containers/podman
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update system connection add & remove
Add new --farm flag to podman system connection add so that a user can add a new connection to a farm immediately. Update system connection remove such that when a connection is removed, the connection is also removed from any farms that have it. Add docs and tests for these changes. Signed-off-by: Urvashi Mohnani <[email protected]>
- Loading branch information
Showing
4 changed files
with
155 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,6 +113,109 @@ var _ = Describe("podman system connection", func() { | |
)) | ||
}) | ||
|
||
It("add to new farm", func() { | ||
cfg, err := config.ReadCustomConfig() | ||
Expect(err).ShouldNot(HaveOccurred()) | ||
Expect(cfg.Farms.List).Should(BeEmpty()) | ||
|
||
cmd := []string{"system", "connection", "add", | ||
"--default", | ||
"--identity", "~/.ssh/id_rsa", | ||
"--farm", "farm1", | ||
"QA", | ||
"ssh://[email protected]:2222/run/podman/podman.sock", | ||
} | ||
session := podmanTest.Podman(cmd) | ||
session.WaitWithDefaultTimeout() | ||
Expect(session).Should(Exit(0)) | ||
Expect(session.Out.Contents()).Should(BeEmpty()) | ||
|
||
cfg, err = config.ReadCustomConfig() | ||
Expect(err).ShouldNot(HaveOccurred()) | ||
Expect(cfg).Should(HaveActiveService("QA")) | ||
Expect(cfg).Should(VerifyService( | ||
"QA", | ||
"ssh://[email protected]:2222/run/podman/podman.sock", | ||
"~/.ssh/id_rsa", | ||
)) | ||
Expect(cfg.Farms.List).Should(HaveKeyWithValue("farm1", []string{"QA"})) | ||
}) | ||
|
||
It("add to existing farm", func() { | ||
// create empty farm | ||
cmd := []string{"farm", "create", "empty-farm"} | ||
session := podmanTest.Podman(cmd) | ||
session.WaitWithDefaultTimeout() | ||
Expect(session).Should(Exit(0)) | ||
Expect(session.Out.Contents()).Should(ContainSubstring("Farm \"empty-farm\" created")) | ||
|
||
cfg, err := config.ReadCustomConfig() | ||
Expect(err).ShouldNot(HaveOccurred()) | ||
Expect(cfg.Farms.List).Should(HaveKeyWithValue("empty-farm", []string{})) | ||
|
||
cmd = []string{"system", "connection", "add", | ||
"--default", | ||
"--identity", "~/.ssh/id_rsa", | ||
"--farm", "empty-farm", | ||
"QA", | ||
"ssh://[email protected]:2222/run/podman/podman.sock", | ||
} | ||
session = podmanTest.Podman(cmd) | ||
session.WaitWithDefaultTimeout() | ||
Expect(session).Should(Exit(0)) | ||
Expect(session.Out.Contents()).Should(BeEmpty()) | ||
|
||
cfg, err = config.ReadCustomConfig() | ||
Expect(err).ShouldNot(HaveOccurred()) | ||
Expect(cfg).Should(HaveActiveService("QA")) | ||
Expect(cfg).Should(VerifyService( | ||
"QA", | ||
"ssh://[email protected]:2222/run/podman/podman.sock", | ||
"~/.ssh/id_rsa", | ||
)) | ||
Expect(cfg.Farms.List).Should(HaveKeyWithValue("empty-farm", []string{"QA"})) | ||
}) | ||
|
||
It("removing connection should remove from farm also", func() { | ||
cfg, err := config.ReadCustomConfig() | ||
Expect(err).ShouldNot(HaveOccurred()) | ||
Expect(cfg.Farms.List).Should(BeEmpty()) | ||
|
||
cmd := []string{"system", "connection", "add", | ||
"--default", | ||
"--identity", "~/.ssh/id_rsa", | ||
"--farm", "farm1", | ||
"QA", | ||
"ssh://[email protected]:2222/run/podman/podman.sock", | ||
} | ||
session := podmanTest.Podman(cmd) | ||
session.WaitWithDefaultTimeout() | ||
Expect(session).Should(Exit(0)) | ||
Expect(session.Out.Contents()).Should(BeEmpty()) | ||
|
||
cfg, err = config.ReadCustomConfig() | ||
Expect(err).ShouldNot(HaveOccurred()) | ||
Expect(cfg).Should(HaveActiveService("QA")) | ||
Expect(cfg).Should(VerifyService( | ||
"QA", | ||
"ssh://[email protected]:2222/run/podman/podman.sock", | ||
"~/.ssh/id_rsa", | ||
)) | ||
Expect(cfg.Farms.List).Should(HaveKeyWithValue("farm1", []string{"QA"})) | ||
|
||
// Remove the QA connection | ||
session = podmanTest.Podman([]string{"system", "connection", "remove", "QA"}) | ||
session.WaitWithDefaultTimeout() | ||
Expect(session).Should(Exit(0)) | ||
Expect(session.Out.Contents()).Should(BeEmpty()) | ||
|
||
cfg, err = config.ReadCustomConfig() | ||
Expect(err).ShouldNot(HaveOccurred()) | ||
Expect(cfg.Engine.ActiveService).Should(BeEmpty()) | ||
Expect(cfg.Engine.ServiceDestinations).Should(BeEmpty()) | ||
Expect(cfg.Farms.List).Should(HaveKeyWithValue("farm1", []string{})) | ||
}) | ||
|
||
It("remove", func() { | ||
session := podmanTest.Podman([]string{"system", "connection", "add", | ||
"--default", | ||
|