Skip to content

fix: avoid logging env in unit tests #9885

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: avoid logging env in unit tests
  • Loading branch information
johnstcn committed Sep 27, 2023
commit 160fa252ef5e795dc32597c7a7e201f37be292c5
1 change: 0 additions & 1 deletion cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ func (r *RootCmd) Command(subcommands []*clibase.Cmd) (*clibase.Cmd, error) {
},
),
Handler: func(i *clibase.Invocation) error {
// fmt.Fprintf(i.Stderr, "env debug: %+v", i.Environ)
// The GIT_ASKPASS environment variable must point at
// a binary with no arguments. To prevent writing
// cross-platform scripts to invoke the Coder binary
Expand Down
2 changes: 1 addition & 1 deletion cli/ssh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ func TestSSH(t *testing.T) {
// Ensure that SSH_AUTH_SOCK is set.
// Linux: /tmp/auth-agent3167016167/listener.sock
// macOS: /var/folders/ng/m1q0wft14hj0t3rtjxrdnzsr0000gn/T/auth-agent3245553419/listener.sock
pty.WriteLine("env")
pty.WriteLine(`grep --perl-regexp --binary-files=text 'SSH_AUTH_SOCK=[^\x00]+' /proc/self/environ`)
pty.ExpectMatch("SSH_AUTH_SOCK=")
// Ensure that ssh-add lists our key.
pty.WriteLine("ssh-add -L")
Expand Down
2 changes: 1 addition & 1 deletion pty/start_other_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestStart(t *testing.T) {
Height: 24,
},
}))
pty, ps := ptytest.Start(t, pty.Command("env"), opts)
pty, ps := ptytest.Start(t, pty.Command("grep", "--binary-files=text", `SSH_TTY=/dev/`, "/proc/self/environ"), opts)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Mostly) same as above.

pty.ExpectMatch("SSH_TTY=/dev/")
err := ps.Wait()
require.NoError(t, err)
Expand Down