@@ -60,7 +60,7 @@ func TestAgent_Stats_SSH(t *testing.T) {
60
60
defer cancel ()
61
61
62
62
//nolint:dogsled
63
- conn , _ , stats , _ , _ := setupAgent (t , agentsdk.Metadata {}, 0 )
63
+ conn , _ , stats , _ , _ := setupAgent (t , agentsdk.Manifest {}, 0 )
64
64
65
65
sshClient , err := conn .SSHClient (ctx )
66
66
require .NoError (t , err )
@@ -93,7 +93,7 @@ func TestAgent_Stats_ReconnectingPTY(t *testing.T) {
93
93
defer cancel ()
94
94
95
95
//nolint:dogsled
96
- conn , _ , stats , _ , _ := setupAgent (t , agentsdk.Metadata {}, 0 )
96
+ conn , _ , stats , _ , _ := setupAgent (t , agentsdk.Manifest {}, 0 )
97
97
98
98
ptyConn , err := conn .ReconnectingPTY (ctx , uuid .New (), 128 , 128 , "/bin/bash" )
99
99
require .NoError (t , err )
@@ -123,7 +123,7 @@ func TestAgent_Stats_Magic(t *testing.T) {
123
123
ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
124
124
defer cancel ()
125
125
//nolint:dogsled
126
- conn , _ , _ , _ , _ := setupAgent (t , agentsdk.Metadata {}, 0 )
126
+ conn , _ , _ , _ , _ := setupAgent (t , agentsdk.Manifest {}, 0 )
127
127
sshClient , err := conn .SSHClient (ctx )
128
128
require .NoError (t , err )
129
129
defer sshClient .Close ()
@@ -150,7 +150,7 @@ func TestAgent_Stats_Magic(t *testing.T) {
150
150
ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
151
151
defer cancel ()
152
152
//nolint:dogsled
153
- conn , _ , stats , _ , _ := setupAgent (t , agentsdk.Metadata {}, 0 )
153
+ conn , _ , stats , _ , _ := setupAgent (t , agentsdk.Manifest {}, 0 )
154
154
sshClient , err := conn .SSHClient (ctx )
155
155
require .NoError (t , err )
156
156
defer sshClient .Close ()
@@ -185,7 +185,7 @@ func TestAgent_Stats_Magic(t *testing.T) {
185
185
186
186
func TestAgent_SessionExec (t * testing.T ) {
187
187
t .Parallel ()
188
- session := setupSSHSession (t , agentsdk.Metadata {})
188
+ session := setupSSHSession (t , agentsdk.Manifest {})
189
189
190
190
command := "echo test"
191
191
if runtime .GOOS == "windows" {
@@ -198,7 +198,7 @@ func TestAgent_SessionExec(t *testing.T) {
198
198
199
199
func TestAgent_GitSSH (t * testing.T ) {
200
200
t .Parallel ()
201
- session := setupSSHSession (t , agentsdk.Metadata {})
201
+ session := setupSSHSession (t , agentsdk.Manifest {})
202
202
command := "sh -c 'echo $GIT_SSH_COMMAND'"
203
203
if runtime .GOOS == "windows" {
204
204
command = "cmd.exe /c echo %GIT_SSH_COMMAND%"
@@ -218,7 +218,7 @@ func TestAgent_SessionTTYShell(t *testing.T) {
218
218
// it seems like it could be either.
219
219
t .Skip ("ConPTY appears to be inconsistent on Windows." )
220
220
}
221
- session := setupSSHSession (t , agentsdk.Metadata {})
221
+ session := setupSSHSession (t , agentsdk.Manifest {})
222
222
command := "sh"
223
223
if runtime .GOOS == "windows" {
224
224
command = "cmd.exe"
@@ -241,7 +241,7 @@ func TestAgent_SessionTTYShell(t *testing.T) {
241
241
242
242
func TestAgent_SessionTTYExitCode (t * testing.T ) {
243
243
t .Parallel ()
244
- session := setupSSHSession (t , agentsdk.Metadata {})
244
+ session := setupSSHSession (t , agentsdk.Manifest {})
245
245
command := "areallynotrealcommand"
246
246
err := session .RequestPty ("xterm" , 128 , 128 , ssh.TerminalModes {})
247
247
require .NoError (t , err )
@@ -280,7 +280,7 @@ func TestAgent_Session_TTY_MOTD(t *testing.T) {
280
280
// Set HOME so we can ensure no ~/.hushlogin is present.
281
281
t .Setenv ("HOME" , tmpdir )
282
282
283
- session := setupSSHSession (t , agentsdk.Metadata {
283
+ session := setupSSHSession (t , agentsdk.Manifest {
284
284
MOTDFile : name ,
285
285
})
286
286
err = session .RequestPty ("xterm" , 128 , 128 , ssh.TerminalModes {})
@@ -326,7 +326,7 @@ func TestAgent_Session_TTY_Hushlogin(t *testing.T) {
326
326
// Set HOME so we can ensure ~/.hushlogin is present.
327
327
t .Setenv ("HOME" , tmpdir )
328
328
329
- session := setupSSHSession (t , agentsdk.Metadata {
329
+ session := setupSSHSession (t , agentsdk.Manifest {
330
330
MOTDFile : name ,
331
331
})
332
332
err = session .RequestPty ("xterm" , 128 , 128 , ssh.TerminalModes {})
@@ -607,7 +607,7 @@ func TestAgent_SFTP(t *testing.T) {
607
607
home = "/" + strings .ReplaceAll (home , "\\ " , "/" )
608
608
}
609
609
//nolint:dogsled
610
- conn , _ , _ , _ , _ := setupAgent (t , agentsdk.Metadata {}, 0 )
610
+ conn , _ , _ , _ , _ := setupAgent (t , agentsdk.Manifest {}, 0 )
611
611
sshClient , err := conn .SSHClient (ctx )
612
612
require .NoError (t , err )
613
613
defer sshClient .Close ()
@@ -639,7 +639,7 @@ func TestAgent_SCP(t *testing.T) {
639
639
defer cancel ()
640
640
641
641
//nolint:dogsled
642
- conn , _ , _ , _ , _ := setupAgent (t , agentsdk.Metadata {}, 0 )
642
+ conn , _ , _ , _ , _ := setupAgent (t , agentsdk.Manifest {}, 0 )
643
643
sshClient , err := conn .SSHClient (ctx )
644
644
require .NoError (t , err )
645
645
defer sshClient .Close ()
@@ -658,7 +658,7 @@ func TestAgent_EnvironmentVariables(t *testing.T) {
658
658
t .Parallel ()
659
659
key := "EXAMPLE"
660
660
value := "value"
661
- session := setupSSHSession (t , agentsdk.Metadata {
661
+ session := setupSSHSession (t , agentsdk.Manifest {
662
662
EnvironmentVariables : map [string ]string {
663
663
key : value ,
664
664
},
@@ -675,7 +675,7 @@ func TestAgent_EnvironmentVariables(t *testing.T) {
675
675
func TestAgent_EnvironmentVariableExpansion (t * testing.T ) {
676
676
t .Parallel ()
677
677
key := "EXAMPLE"
678
- session := setupSSHSession (t , agentsdk.Metadata {
678
+ session := setupSSHSession (t , agentsdk.Manifest {
679
679
EnvironmentVariables : map [string ]string {
680
680
key : "$SOMETHINGNOTSET" ,
681
681
},
@@ -702,7 +702,7 @@ func TestAgent_CoderEnvVars(t *testing.T) {
702
702
t .Run (key , func (t * testing.T ) {
703
703
t .Parallel ()
704
704
705
- session := setupSSHSession (t , agentsdk.Metadata {})
705
+ session := setupSSHSession (t , agentsdk.Manifest {})
706
706
command := "sh -c 'echo $" + key + "'"
707
707
if runtime .GOOS == "windows" {
708
708
command = "cmd.exe /c echo %" + key + "%"
@@ -725,7 +725,7 @@ func TestAgent_SSHConnectionEnvVars(t *testing.T) {
725
725
t .Run (key , func (t * testing.T ) {
726
726
t .Parallel ()
727
727
728
- session := setupSSHSession (t , agentsdk.Metadata {})
728
+ session := setupSSHSession (t , agentsdk.Manifest {})
729
729
command := "sh -c 'echo $" + key + "'"
730
730
if runtime .GOOS == "windows" {
731
731
command = "cmd.exe /c echo %" + key + "%"
@@ -744,7 +744,7 @@ func TestAgent_StartupScript(t *testing.T) {
744
744
}
745
745
content := "output"
746
746
//nolint:dogsled
747
- _ , _ , _ , fs , _ := setupAgent (t , agentsdk.Metadata {
747
+ _ , _ , _ , fs , _ := setupAgent (t , agentsdk.Manifest {
748
748
StartupScript : "echo " + content ,
749
749
}, 0 )
750
750
var gotContent string
@@ -778,7 +778,7 @@ func TestAgent_Lifecycle(t *testing.T) {
778
778
t .Run ("StartTimeout" , func (t * testing.T ) {
779
779
t .Parallel ()
780
780
781
- _ , client , _ , _ , _ := setupAgent (t , agentsdk.Metadata {
781
+ _ , client , _ , _ , _ := setupAgent (t , agentsdk.Manifest {
782
782
StartupScript : "sleep 5" ,
783
783
StartupScriptTimeout : time .Nanosecond ,
784
784
}, 0 )
@@ -807,7 +807,7 @@ func TestAgent_Lifecycle(t *testing.T) {
807
807
t .Run ("StartError" , func (t * testing.T ) {
808
808
t .Parallel ()
809
809
810
- _ , client , _ , _ , _ := setupAgent (t , agentsdk.Metadata {
810
+ _ , client , _ , _ , _ := setupAgent (t , agentsdk.Manifest {
811
811
StartupScript : "false" ,
812
812
StartupScriptTimeout : 30 * time .Second ,
813
813
}, 0 )
@@ -836,7 +836,7 @@ func TestAgent_Lifecycle(t *testing.T) {
836
836
t .Run ("Ready" , func (t * testing.T ) {
837
837
t .Parallel ()
838
838
839
- _ , client , _ , _ , _ := setupAgent (t , agentsdk.Metadata {
839
+ _ , client , _ , _ , _ := setupAgent (t , agentsdk.Manifest {
840
840
StartupScript : "true" ,
841
841
StartupScriptTimeout : 30 * time .Second ,
842
842
}, 0 )
@@ -865,7 +865,7 @@ func TestAgent_Lifecycle(t *testing.T) {
865
865
t .Run ("ShuttingDown" , func (t * testing.T ) {
866
866
t .Parallel ()
867
867
868
- _ , client , _ , _ , closer := setupAgent (t , agentsdk.Metadata {
868
+ _ , client , _ , _ , closer := setupAgent (t , agentsdk.Manifest {
869
869
ShutdownScript : "sleep 5" ,
870
870
StartupScriptTimeout : 30 * time .Second ,
871
871
}, 0 )
@@ -903,7 +903,7 @@ func TestAgent_Lifecycle(t *testing.T) {
903
903
t .Run ("ShutdownTimeout" , func (t * testing.T ) {
904
904
t .Parallel ()
905
905
906
- _ , client , _ , _ , closer := setupAgent (t , agentsdk.Metadata {
906
+ _ , client , _ , _ , closer := setupAgent (t , agentsdk.Manifest {
907
907
ShutdownScript : "sleep 5" ,
908
908
ShutdownScriptTimeout : time .Nanosecond ,
909
909
}, 0 )
@@ -950,7 +950,7 @@ func TestAgent_Lifecycle(t *testing.T) {
950
950
t .Run ("ShutdownError" , func (t * testing.T ) {
951
951
t .Parallel ()
952
952
953
- _ , client , _ , _ , closer := setupAgent (t , agentsdk.Metadata {
953
+ _ , client , _ , _ , closer := setupAgent (t , agentsdk.Manifest {
954
954
ShutdownScript : "false" ,
955
955
ShutdownScriptTimeout : 30 * time .Second ,
956
956
}, 0 )
@@ -1001,7 +1001,7 @@ func TestAgent_Lifecycle(t *testing.T) {
1001
1001
client := & client {
1002
1002
t : t ,
1003
1003
agentID : uuid .New (),
1004
- metadata : agentsdk.Metadata {
1004
+ manifest : agentsdk.Manifest {
1005
1005
DERPMap : tailnettest .RunDERPAndSTUN (t ),
1006
1006
StartupScript : "echo 1" ,
1007
1007
ShutdownScript : "echo " + expected ,
@@ -1054,7 +1054,7 @@ func TestAgent_Startup(t *testing.T) {
1054
1054
t .Run ("EmptyDirectory" , func (t * testing.T ) {
1055
1055
t .Parallel ()
1056
1056
1057
- _ , client , _ , _ , _ := setupAgent (t , agentsdk.Metadata {
1057
+ _ , client , _ , _ , _ := setupAgent (t , agentsdk.Manifest {
1058
1058
StartupScript : "true" ,
1059
1059
StartupScriptTimeout : 30 * time .Second ,
1060
1060
Directory : "" ,
@@ -1068,7 +1068,7 @@ func TestAgent_Startup(t *testing.T) {
1068
1068
t .Run ("HomeDirectory" , func (t * testing.T ) {
1069
1069
t .Parallel ()
1070
1070
1071
- _ , client , _ , _ , _ := setupAgent (t , agentsdk.Metadata {
1071
+ _ , client , _ , _ , _ := setupAgent (t , agentsdk.Manifest {
1072
1072
StartupScript : "true" ,
1073
1073
StartupScriptTimeout : 30 * time .Second ,
1074
1074
Directory : "~" ,
@@ -1084,7 +1084,7 @@ func TestAgent_Startup(t *testing.T) {
1084
1084
t .Run ("HomeEnvironmentVariable" , func (t * testing.T ) {
1085
1085
t .Parallel ()
1086
1086
1087
- _ , client , _ , _ , _ := setupAgent (t , agentsdk.Metadata {
1087
+ _ , client , _ , _ , _ := setupAgent (t , agentsdk.Manifest {
1088
1088
StartupScript : "true" ,
1089
1089
StartupScriptTimeout : 30 * time .Second ,
1090
1090
Directory : "$HOME" ,
@@ -1111,7 +1111,7 @@ func TestAgent_ReconnectingPTY(t *testing.T) {
1111
1111
defer cancel ()
1112
1112
1113
1113
//nolint:dogsled
1114
- conn , _ , _ , _ , _ := setupAgent (t , agentsdk.Metadata {}, 0 )
1114
+ conn , _ , _ , _ , _ := setupAgent (t , agentsdk.Manifest {}, 0 )
1115
1115
id := uuid .New ()
1116
1116
netConn , err := conn .ReconnectingPTY (ctx , id , 100 , 100 , "/bin/bash" )
1117
1117
require .NoError (t , err )
@@ -1213,7 +1213,7 @@ func TestAgent_Dial(t *testing.T) {
1213
1213
}()
1214
1214
1215
1215
//nolint:dogsled
1216
- conn , _ , _ , _ , _ := setupAgent (t , agentsdk.Metadata {}, 0 )
1216
+ conn , _ , _ , _ , _ := setupAgent (t , agentsdk.Manifest {}, 0 )
1217
1217
require .True (t , conn .AwaitReachable (context .Background ()))
1218
1218
conn1 , err := conn .DialContext (context .Background (), l .Addr ().Network (), l .Addr ().String ())
1219
1219
require .NoError (t , err )
@@ -1235,7 +1235,7 @@ func TestAgent_Speedtest(t *testing.T) {
1235
1235
defer cancel ()
1236
1236
derpMap := tailnettest .RunDERPAndSTUN (t )
1237
1237
//nolint:dogsled
1238
- conn , _ , _ , _ , _ := setupAgent (t , agentsdk.Metadata {
1238
+ conn , _ , _ , _ , _ := setupAgent (t , agentsdk.Manifest {
1239
1239
DERPMap : derpMap ,
1240
1240
}, 0 )
1241
1241
defer conn .Close ()
@@ -1257,7 +1257,7 @@ func TestAgent_Reconnect(t *testing.T) {
1257
1257
client := & client {
1258
1258
t : t ,
1259
1259
agentID : agentID ,
1260
- metadata : agentsdk.Metadata {
1260
+ manifest : agentsdk.Manifest {
1261
1261
DERPMap : derpMap ,
1262
1262
},
1263
1263
statsChan : statsCh ,
@@ -1292,7 +1292,7 @@ func TestAgent_WriteVSCodeConfigs(t *testing.T) {
1292
1292
client := & client {
1293
1293
t : t ,
1294
1294
agentID : uuid .New (),
1295
- metadata : agentsdk.Metadata {
1295
+ manifest : agentsdk.Manifest {
1296
1296
GitAuthConfigs : 1 ,
1297
1297
DERPMap : & tailcfg.DERPMap {},
1298
1298
},
@@ -1321,7 +1321,7 @@ func TestAgent_WriteVSCodeConfigs(t *testing.T) {
1321
1321
1322
1322
func setupSSHCommand (t * testing.T , beforeArgs []string , afterArgs []string ) * exec.Cmd {
1323
1323
//nolint:dogsled
1324
- agentConn , _ , _ , _ , _ := setupAgent (t , agentsdk.Metadata {}, 0 )
1324
+ agentConn , _ , _ , _ , _ := setupAgent (t , agentsdk.Manifest {}, 0 )
1325
1325
listener , err := net .Listen ("tcp" , "127.0.0.1:0" )
1326
1326
require .NoError (t , err )
1327
1327
waitGroup := sync.WaitGroup {}
@@ -1364,7 +1364,7 @@ func setupSSHCommand(t *testing.T, beforeArgs []string, afterArgs []string) *exe
1364
1364
return exec .Command ("ssh" , args ... )
1365
1365
}
1366
1366
1367
- func setupSSHSession (t * testing.T , options agentsdk.Metadata ) * ssh.Session {
1367
+ func setupSSHSession (t * testing.T , options agentsdk.Manifest ) * ssh.Session {
1368
1368
ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
1369
1369
defer cancel ()
1370
1370
//nolint:dogsled
@@ -1388,7 +1388,7 @@ func (c closeFunc) Close() error {
1388
1388
return c ()
1389
1389
}
1390
1390
1391
- func setupAgent (t * testing.T , metadata agentsdk.Metadata , ptyTimeout time.Duration ) (
1391
+ func setupAgent (t * testing.T , metadata agentsdk.Manifest , ptyTimeout time.Duration ) (
1392
1392
* codersdk.WorkspaceAgentConn ,
1393
1393
* client ,
1394
1394
<- chan * agentsdk.Stats ,
@@ -1408,7 +1408,7 @@ func setupAgent(t *testing.T, metadata agentsdk.Metadata, ptyTimeout time.Durati
1408
1408
c := & client {
1409
1409
t : t ,
1410
1410
agentID : agentID ,
1411
- metadata : metadata ,
1411
+ manifest : metadata ,
1412
1412
statsChan : statsCh ,
1413
1413
coordinator : coordinator ,
1414
1414
}
@@ -1491,7 +1491,7 @@ func assertWritePayload(t *testing.T, w io.Writer, payload []byte) {
1491
1491
type client struct {
1492
1492
t * testing.T
1493
1493
agentID uuid.UUID
1494
- metadata agentsdk.Metadata
1494
+ manifest agentsdk.Manifest
1495
1495
statsChan chan * agentsdk.Stats
1496
1496
coordinator tailnet.Coordinator
1497
1497
lastWorkspaceAgent func ()
@@ -1501,8 +1501,8 @@ type client struct {
1501
1501
startup agentsdk.PostStartupRequest
1502
1502
}
1503
1503
1504
- func (c * client ) Metadata (_ context.Context ) (agentsdk.Metadata , error ) {
1505
- return c .metadata , nil
1504
+ func (c * client ) Manifest (_ context.Context ) (agentsdk.Manifest , error ) {
1505
+ return c .manifest , nil
1506
1506
}
1507
1507
1508
1508
func (c * client ) Listen (_ context.Context ) (net.Conn , error ) {
0 commit comments