Skip to content

Commit 2e26dee

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 2e26dee

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/e2e/info_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,24 @@ 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+
podmanTest.RestartRemoteService()
181+
182+
session := podmanTest.Podman([]string{"info", "--format", "{{.Host.NetworkBackendInfo.DefaultNetwork}}"})
183+
session.WaitWithDefaultTimeout()
184+
Expect(session).To(ExitCleanly())
185+
Expect(session.OutputToString()).To(Equal(customNetName))
186+
})
187+
170188
It("Podman info: check desired storage driver", func() {
171189
// defined in .cirrus.yml
172190
want := os.Getenv("CI_DESIRED_STORAGE")

0 commit comments

Comments
 (0)