-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18772 from esendjer/main
fix ignition config creation (propagation of proxy settings)
- Loading branch information
Showing
3 changed files
with
81 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package e2e_test | ||
|
||
import ( | ||
"os" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
. "github.com/onsi/gomega/gexec" | ||
) | ||
|
||
var _ = Describe("podman machine proxy settings propagation", func() { | ||
var ( | ||
mb *machineTestBuilder | ||
testDir string | ||
) | ||
|
||
BeforeEach(func() { | ||
testDir, mb = setup() | ||
}) | ||
AfterEach(func() { | ||
teardown(originalHomeDir, testDir, mb) | ||
}) | ||
|
||
It("ssh to running machine and check proxy settings", func() { | ||
name := randomString() | ||
i := new(initMachine) | ||
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run() | ||
Expect(err).ToNot(HaveOccurred()) | ||
Expect(session).To(Exit(0)) | ||
|
||
defer func() { | ||
httpProxyEnv := os.Getenv("HTTP_PROXY") | ||
httpsProxyEnv := os.Getenv("HTTPS_PROXY") | ||
if httpProxyEnv != "" { | ||
os.Unsetenv("HTTP_PROXY") | ||
} | ||
if httpsProxyEnv != "" { | ||
os.Unsetenv("HTTPS_PROXY") | ||
} | ||
}() | ||
proxyURL := "http://abcdefghijklmnopqrstuvwxyz-proxy" | ||
os.Setenv("HTTP_PROXY", proxyURL) | ||
os.Setenv("HTTPS_PROXY", proxyURL) | ||
|
||
s := new(startMachine) | ||
startSession, err := mb.setName(name).setCmd(s).run() | ||
Expect(err).ToNot(HaveOccurred()) | ||
Expect(startSession).To(Exit(0)) | ||
|
||
sshProxy := sshMachine{} | ||
sshSession, err := mb.setName(name).setCmd(sshProxy.withSSHCommand([]string{"printenv", "HTTP_PROXY"})).run() | ||
Expect(err).ToNot(HaveOccurred()) | ||
Expect(sshSession).To(Exit(0)) | ||
Expect(sshSession.outputToString()).To(ContainSubstring(proxyURL)) | ||
|
||
sshSession, err = mb.setName(name).setCmd(sshProxy.withSSHCommand([]string{"printenv", "HTTPS_PROXY"})).run() | ||
Expect(err).ToNot(HaveOccurred()) | ||
Expect(sshSession).To(Exit(0)) | ||
Expect(sshSession.outputToString()).To(ContainSubstring(proxyURL)) | ||
}) | ||
}) |
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