Skip to content

Commit

Permalink
fix TestResolvePuppetfileUseSSHAgent by adding a test fake key
Browse files Browse the repository at this point in the history
  • Loading branch information
xorpaul committed Jan 31, 2024
1 parent 99341c9 commit 55024b7
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 8 deletions.
8 changes: 4 additions & 4 deletions g10k_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2882,7 +2882,7 @@ func TestResolvePuppetfileUseSSHAgent(t *testing.T) {
if exitCode != 1 {
t.Errorf("terminated with %v, but we expected exit status %v Output: %s", exitCode, 1, string(out))
}
//fmt.Println(string(out))
// fmt.Println(string(out))

sshAddCmd := "ssh-add"
if runtime.GOOS == "darwin" {
Expand All @@ -2891,11 +2891,11 @@ func TestResolvePuppetfileUseSSHAgent(t *testing.T) {

expectedLines := []string{
"DEBUG git repo url git@local.git.server:foo/git_module_with_ssh_agent.git with loaded SSH keys from ssh-agent",
"DEBUG git repo url git@github.com:foobar/github_module_without_ssh_add.git with SSH key tests/TestConfigUseSSHAgent.yaml",
"DEBUG git repo url git@local.git.server:bar/git_module_with_ssh_add.git with SSH key tests/TestConfigUseSSHAgent.yaml",
"DEBUG git repo url git@github.com:foobar/github_module_without_ssh_add.git with SSH key tests/test-fake-key",
"DEBUG git repo url git@local.git.server:bar/git_module_with_ssh_add.git with SSH key tests/test-fake-key",
"DEBUG executeCommand(): Executing git clone --mirror git@local.git.server:foo/git_module_with_ssh_agent.git /tmp/g10k/modules/git@local.git.server-foo_git_module_with_ssh_agent.git",
"DEBUG executeCommand(): Executing git clone --mirror git@github.com:foobar/github_module_without_ssh_add.git /tmp/g10k/modules/git@github.com-foobar_github_module_without_ssh_add.git",
"DEBUG executeCommand(): Executing ssh-agent bash -c '" + sshAddCmd + " tests/TestConfigUseSSHAgent.yaml; git clone --mirror git@local.git.server:bar/git_module_with_ssh_add.git /tmp/g10k/modules/git@local.git.server-bar_git_module_with_ssh_add.git'",
"DEBUG executeCommand(): Executing ssh-agent bash -c '" + sshAddCmd + " tests/test-fake-key; git clone --mirror git@local.git.server:bar/git_module_with_ssh_add.git /tmp/g10k/modules/git@local.git.server-bar_git_module_with_ssh_add.git'",
}

for _, expectedLine := range expectedLines {
Expand Down
8 changes: 4 additions & 4 deletions tests/TestConfigUseSSHAgent.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
:cachedir: '/tmp/g10k'
:cachedir: "/tmp/g10k"

sources:
example:
remote: 'https://github.com/xorpaul/g10k-environment.git'
basedir: '/tmp/example/'
private_key: 'tests/TestConfigUseSSHAgent.yaml' # just some existing file, we just want to check if the ssh-add command isn't used
remote: "https://github.com/xorpaul/g10k-environment.git"
basedir: "/tmp/example/"
private_key: "tests/test-fake-key" # just some existing file, we just want to check if the ssh-add command isn't used
38 changes: 38 additions & 0 deletions tests/test-fake-key
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
NhAAAAAwEAAQAAAYEA2Bk3OVSuVcP0Wdw57JzKMxKbf3qwBPHZHrMN8MJ7S/qZ11zAUzAY
57Y4e6sE8dd+nC1hK2E8vBZcyib/W+mWJw3JzUHsGTJgZCi+kRieXwZmztwNC4+sUDwDf6
lT8K95kXV36r5IYoo16Fh5/yxYON+HBtDAYDIZp01ez5VDhjNMpnUX39Km5Jt9950CdkhN
pns66QYPAZ3sKBhwGt7l7+X15aKxNaVshLJtPd4V21hDbyqyQUJOwRjj6RvnDibM8XhDuA
Y/yXH6vHCHsHBd/QOaiLmIl+Jkv1Zl5pSRJmTFMrrbMDTojsoiqZel3NNWBJnCCf8B+A8g
hFOp3q+ggrcXmXGE9+uutbrTmBbZrOOfuHPnvTHMyYJ9ogkdcVX751+6w5ujJP8eD0cFLf
GDr6pNX9tT4qI/jQIo8XiBbKRAPFnTX9qydESBagr6Iy83eUGYvQ12zdYyZy/Uzmj/++3g
kO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7jeeVTh2+y2+hn9ASsS94dplD+HSmz5uNrpW1BAAAA
wHH/zkovIwhCgsNchW5HZKPSqBhKhtaDTIcjzbFHzysjC5rGqP/SHVPey/qEQGpEvDcYYX
YAr5yl8XjGJfHiPInM4hPiEhGcgKdXHYlJK5+65x/apxJNWrQbKsfvOJwGpA1Dc0PpYqbB
Fz5tDLZ8JvhwYVzOq/D/9zadk6NCXrzixZ1UTuP7dRpEnG6/xiZncuh0nTQqghnKCNhDBr
B9XP/wcZzs3cQnNVCJokuDta2Js3E+e+jhFEDLYPSaQTuXmwAAAMEA+g+MemDkq1iLIYti
AWv3gpjgEHI5oTrQAuOjr0cC1UZJGbnHtajmKTr6mOHFLWUPmX710xFR7Ge5QLPeY5YxQs
0LzH+XT7YF71NrsUQR15cNBQCn5bFQySsllGprG3honT8ByoqA16nGLFxdjz88AOag9C+j
/hs5yfCpJf99/nOxn91uraLOyVUJtbaPuJslyqTjDCS/vnVGDUoQSenPKryufgWLkPAH4V
N3/falJ6549riavML//KwiYsOvvqRDAAAAwQDdOypZ11/Y/KiDCKIiP5VUoGb80u/jgtXd
FQJ4oKc2+POTvTI52B3sH5Ik3nWMvHMrVm6ks+4/JTEi1rN2EENB5yhwWtbySJb6URnT+i
1wdHXMBrfGTt0QijrBjH88XKERLSIz6VW5Ltfv3Hzai1ZDB4DGAbJT5VmvyQ3iH/14ra7H
bT6lVspOxFmS/2j/kwixtZS3IIHJvRq6WxkFdJu87Qtd0vZk/dcWOyI6f3fopSLTDDZD6c
gAbG/hkYbqz3kAAAAUYW5kcGF1bEBkeGthLWc4MGJuejIBAgMEBQYH
-----END OPENSSH PRIVATE KEY-----

0 comments on commit 55024b7

Please sign in to comment.