@@ -194,9 +194,8 @@ func TestAgent(t *testing.T) {
194
194
}
195
195
})
196
196
197
+ //nolint:paralleltest // This test sets an environment variable.
197
198
t .Run ("Session TTY MOTD" , func (t * testing.T ) {
198
- t .Parallel ()
199
-
200
199
if runtime .GOOS == "windows" {
201
200
// This might be our implementation, or ConPTY itself.
202
201
// It's difficult to find extensive tests for it, so
@@ -206,10 +205,14 @@ func TestAgent(t *testing.T) {
206
205
207
206
wantMOTD := "Welcome to your Coder workspace!"
208
207
209
- name := filepath .Join (t .TempDir (), "motd" )
208
+ tmpdir := t .TempDir ()
209
+ name := filepath .Join (tmpdir , "motd" )
210
210
err := os .WriteFile (name , []byte (wantMOTD ), 0o600 )
211
211
require .NoError (t , err , "write motd file" )
212
212
213
+ // Set HOME so we can ensure no ~/.hushlogin is present.
214
+ t .Setenv ("HOME" , tmpdir )
215
+
213
216
session := setupSSHSession (t , codersdk.WorkspaceAgentMetadata {
214
217
MOTDFile : name ,
215
218
})
@@ -246,11 +249,14 @@ func TestAgent(t *testing.T) {
246
249
name := filepath .Join (tmpdir , "motd" )
247
250
err := os .WriteFile (name , []byte (wantNotMOTD ), 0o600 )
248
251
require .NoError (t , err , "write motd file" )
252
+
253
+ // Create hushlogin to silence motd.
249
254
f , err := os .Create (filepath .Join (tmpdir , ".hushlogin" ))
250
255
require .NoError (t , err , "create .hushlogin file" )
251
256
err = f .Close ()
252
257
require .NoError (t , err , "close .hushlogin file" )
253
258
259
+ // Set HOME so we can ensure ~/.hushlogin is present.
254
260
t .Setenv ("HOME" , tmpdir )
255
261
256
262
session := setupSSHSession (t , codersdk.WorkspaceAgentMetadata {
0 commit comments