Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
theFong committed Sep 28, 2023
1 parent b898e19 commit 351a384
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 4 deletions.
1 change: 0 additions & 1 deletion pkg/ssh/sshconfigurer.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ func makeSSHConfigEntryV2(workspace entity.Workspace, privateKeyPath string) (st
}

val := fmt.Sprintf("%s%s", sshVal, hostSSHVal)
fmt.Printf("'%s'", val)
return val, nil
}
}
Expand Down
66 changes: 63 additions & 3 deletions pkg/ssh/sshconfigurer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,18 @@ Host %s
RequestTTY yes
Port 22
Host %s-host
Hostname test1-dns-org.brev.sh
IdentityFile "/my/priv/key.pem"
User ubuntu
ServerAliveInterval 30
UserKnownHostsFile /dev/null
IdentitiesOnly yes
StrictHostKeyChecking no
PasswordAuthentication no
RequestTTY yes
Port 22
Host %s
Hostname test2-dns-org.brev.sh
IdentityFile "/my/priv/key.pem"
Expand All @@ -160,8 +172,21 @@ Host %s
RequestTTY yes
Port 22
`, somePlainWorkspaces[0].GetLocalIdentifier(),
somePlainWorkspaces[1].GetLocalIdentifier())
Host %s-host
Hostname test2-dns-org.brev.sh
IdentityFile "/my/priv/key.pem"
User ubuntu
ServerAliveInterval 30
UserKnownHostsFile /dev/null
IdentitiesOnly yes
StrictHostKeyChecking no
PasswordAuthentication no
RequestTTY yes
Port 22
`, somePlainWorkspaces[0].GetLocalIdentifier(), somePlainWorkspaces[0].GetLocalIdentifier(),
somePlainWorkspaces[1].GetLocalIdentifier(), somePlainWorkspaces[1].GetLocalIdentifier(),
)
assert.Equal(t, correct, cStr)

cStr, err = c.CreateNewSSHConfig([]entity.Workspace{})
Expand Down Expand Up @@ -551,6 +576,18 @@ Host testName1
RequestTTY yes
Port 22
Host testName1-host
Hostname test1-dns-org.brev.sh
IdentityFile "/home/test/.brev/brev.pem"
User ubuntu
ServerAliveInterval 30
UserKnownHostsFile /dev/null
IdentitiesOnly yes
StrictHostKeyChecking no
PasswordAuthentication no
RequestTTY yes
Port 22
`,

windowsSSHConfig: ``,
Expand Down Expand Up @@ -594,6 +631,18 @@ Host testName1
RequestTTY yes
Port 22
Host testName1-host
Hostname test1-dns-org.brev.sh
IdentityFile "/home/test/.brev/brev.pem"
User ubuntu
ServerAliveInterval 30
UserKnownHostsFile /dev/null
IdentitiesOnly yes
StrictHostKeyChecking no
PasswordAuthentication no
RequestTTY yes
Port 22
`,
windowsSSHConfig: "Include \"C:\\Users\\15854\\.brev\\ssh_config\"\n",
windowsBrevSSHConfig: `# included in C:\Users\15854\.brev\ssh_config
Expand All @@ -609,6 +658,18 @@ Host testName1
RequestTTY yes
Port 22
Host testName1-host
Hostname test1-dns-org.brev.sh
IdentityFile "C:\Users\15854\.brev\brev.pem"
User ubuntu
ServerAliveInterval 30
UserKnownHostsFile /dev/null
IdentitiesOnly yes
StrictHostKeyChecking no
PasswordAuthentication no
RequestTTY yes
Port 22
`,
windowsSSHConfigExists: true,
},
Expand Down Expand Up @@ -640,7 +701,6 @@ Host testName1
}
diff = cmp.Diff(tt.linuxBrevSSHConfig, linuxBrevSSHConfig)
if diff != "" {
fmt.Println("THIS DIFF IS DIFFERENT")
t.Fatalf(diff)
}

Expand Down

0 comments on commit 351a384

Please sign in to comment.