-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed failing unit tests related to git creds
Signed-off-by: Anand Francis Joseph <[email protected]>
- Loading branch information
Showing
2 changed files
with
9 additions
and
5 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 |
---|---|---|
|
@@ -255,7 +255,7 @@ func Test_SSHCreds_Environ_WithProxy(t *testing.T) { | |
hostsPath := cert.GetSSHKnownHostsDataPath() | ||
assert.Contains(t, env[1], fmt.Sprintf("-o UserKnownHostsFile=%s", hostsPath)) | ||
} | ||
assert.Contains(t, env[1], "-o ProxyCommand='ncat --proxy-type socks5 --proxy 127.0.0.1:1080 --proxy-auth '' %h %p'") | ||
assert.Contains(t, env[1], "-o ProxyCommand='connect-proxy -S 127.0.0.1:1080 -5 %h %p'") | ||
|
||
envRegex := regexp.MustCompile("-i ([^ ]+)") | ||
assert.Regexp(t, envRegex, env[1]) | ||
|
@@ -275,11 +275,13 @@ func Test_SSHCreds_Environ_WithProxyUserNamePassword(t *testing.T) { | |
creds := NewSSHCreds("sshPrivateKey", caFile, insecureIgnoreHostKey, &NoopCredsStore{}, "socks5://user:[email protected]:1080") | ||
closer, env, err := creds.Environ() | ||
require.NoError(t, err) | ||
require.Len(t, env, 2) | ||
require.Len(t, env, 4) | ||
|
||
assert.Equal(t, fmt.Sprintf("GIT_SSL_CAINFO=%s/caFile", tempDir), env[0], "CAINFO env var must be set") | ||
|
||
assert.True(t, strings.HasPrefix(env[1], "GIT_SSH_COMMAND=")) | ||
assert.Equal(t, "SOCKS5_USER=user", env[2], "SOCKS5 user env var must be set") | ||
assert.Equal(t, "SOCKS5_PASSWD=password", env[3], "SOCKS5 password env var must be set") | ||
|
||
if insecureIgnoreHostKey { | ||
assert.Contains(t, env[1], "-o StrictHostKeyChecking=no") | ||
|
@@ -289,7 +291,7 @@ func Test_SSHCreds_Environ_WithProxyUserNamePassword(t *testing.T) { | |
hostsPath := cert.GetSSHKnownHostsDataPath() | ||
assert.Contains(t, env[1], fmt.Sprintf("-o UserKnownHostsFile=%s", hostsPath)) | ||
} | ||
assert.Contains(t, env[1], "-o ProxyCommand='ncat --proxy-type socks5 --proxy 127.0.0.1:1080 --proxy-auth 'user:password' %h %p'") | ||
assert.Contains(t, env[1], "-o ProxyCommand='connect-proxy -S 127.0.0.1:1080 -5 %h %p'") | ||
|
||
envRegex := regexp.MustCompile("-i ([^ ]+)") | ||
assert.Regexp(t, envRegex, env[1]) | ||
|