Skip to content

Commit 266ba5a

Browse files
committed
Add test for exposing default network name in podman info
Fixes #27580 Signed-off-by: Kyounghoon Jang <[email protected]>
1 parent 96631c7 commit 266ba5a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/e2e/info_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,23 @@ var _ = Describe("Podman Info", func() {
167167
Expect(session.OutputToString()).To(Equal("netavark"))
168168
})
169169

170+
It("Podman info: check default network from configuration", func() {
171+
configPath := filepath.Join(podmanTest.TempDir, "containers.conf")
172+
173+
os.Setenv("CONTAINERS_CONF_OVERRIDE", configPath)
174+
175+
customNetName := "my-custom-test-network"
176+
configContent := fmt.Sprintf("[network]\ndefault_network=%q\n", customNetName)
177+
178+
err := os.WriteFile(configPath, []byte(configContent), os.ModePerm)
179+
Expect(err).ToNot(HaveOccurred())
180+
181+
session := podmanTest.Podman([]string{"info", "--format", "{{.Host.NetworkBackendInfo.DefaultNetwork}}"})
182+
session.WaitWithDefaultTimeout()
183+
Expect(session).To(ExitCleanly())
184+
Expect(session.OutputToString()).To(Equal(customNetName))
185+
})
186+
170187
It("Podman info: check desired storage driver", func() {
171188
// defined in .cirrus.yml
172189
want := os.Getenv("CI_DESIRED_STORAGE")

0 commit comments

Comments
 (0)