@@ -1262,6 +1262,11 @@ func TestAPI(t *testing.T) {
12621262 deleteErrC : make (chan error , 1 ),
12631263 }
12641264 fakeDCCLI = & fakeDevcontainerCLI {
1265+ readConfig : agentcontainers.DevcontainerConfig {
1266+ Workspace : agentcontainers.DevcontainerWorkspace {
1267+ WorkspaceFolder : "/workspaces/coder" ,
1268+ },
1269+ },
12651270 execErrC : make (chan func (cmd string , args ... string ) error , 1 ),
12661271 readConfigErrC : make (chan func (envs []string ) error , 1 ),
12671272 }
@@ -1273,8 +1278,8 @@ func TestAPI(t *testing.T) {
12731278 Running : true ,
12741279 CreatedAt : time .Now (),
12751280 Labels : map [string ]string {
1276- agentcontainers .DevcontainerLocalFolderLabel : "/workspaces " ,
1277- agentcontainers .DevcontainerConfigFileLabel : "/workspace /.devcontainer/devcontainer.json" ,
1281+ agentcontainers .DevcontainerLocalFolderLabel : "/home/coder/coder " ,
1282+ agentcontainers .DevcontainerConfigFileLabel : "/home/coder/coder /.devcontainer/devcontainer.json" ,
12781283 },
12791284 }
12801285 )
@@ -1320,11 +1325,6 @@ func TestAPI(t *testing.T) {
13201325
13211326 // Allow initial agent creation and injection to succeed.
13221327 testutil .RequireSend (ctx , t , fakeSAC .createErrC , nil )
1323- testutil .RequireSend (ctx , t , fakeDCCLI .execErrC , func (cmd string , args ... string ) error {
1324- assert .Equal (t , "pwd" , cmd )
1325- assert .Empty (t , args )
1326- return nil
1327- }) // Exec pwd.
13281328 testutil .RequireSend (ctx , t , fakeDCCLI .readConfigErrC , func (envs []string ) error {
13291329 assert .Contains (t , envs , "CODER_WORKSPACE_AGENT_NAME=test-container" )
13301330 assert .Contains (t , envs , "CODER_WORKSPACE_NAME=test-workspace" )
@@ -1350,7 +1350,7 @@ func TestAPI(t *testing.T) {
13501350 // Verify agent was created.
13511351 require .Len (t , fakeSAC .created , 1 )
13521352 assert .Equal (t , "test-container" , fakeSAC .created [0 ].Name )
1353- assert .Equal (t , "/workspaces" , fakeSAC .created [0 ].Directory )
1353+ assert .Equal (t , "/workspaces/coder " , fakeSAC .created [0 ].Directory )
13541354 assert .Len (t , fakeSAC .deleted , 0 )
13551355
13561356 t .Log ("Agent injected successfully, now testing reinjection into the same container..." )
@@ -1467,11 +1467,6 @@ func TestAPI(t *testing.T) {
14671467 testutil .RequireSend (ctx , t , fakeSAC .deleteErrC , nil )
14681468 // Expect the agent to be recreated.
14691469 testutil .RequireSend (ctx , t , fakeSAC .createErrC , nil )
1470- testutil .RequireSend (ctx , t , fakeDCCLI .execErrC , func (cmd string , args ... string ) error {
1471- assert .Equal (t , "pwd" , cmd )
1472- assert .Empty (t , args )
1473- return nil
1474- }) // Exec pwd.
14751470 testutil .RequireSend (ctx , t , fakeDCCLI .readConfigErrC , func (envs []string ) error {
14761471 assert .Contains (t , envs , "CODER_WORKSPACE_AGENT_NAME=test-container" )
14771472 assert .Contains (t , envs , "CODER_WORKSPACE_NAME=test-workspace" )
@@ -1814,7 +1809,6 @@ func TestAPI(t *testing.T) {
18141809 },
18151810 },
18161811 },
1817- execErrC : make (chan func (cmd string , args ... string ) error , 1 ),
18181812 }
18191813
18201814 testContainer = codersdk.WorkspaceAgentContainer {
@@ -1861,15 +1855,9 @@ func TestAPI(t *testing.T) {
18611855
18621856 // Close before api.Close() defer to avoid deadlock after test.
18631857 defer close (fSAC .createErrC )
1864- defer close (fDCCLI .execErrC )
18651858
18661859 // Given: We allow agent creation and injection to succeed.
18671860 testutil .RequireSend (ctx , t , fSAC .createErrC , nil )
1868- testutil .RequireSend (ctx , t , fDCCLI .execErrC , func (cmd string , args ... string ) error {
1869- assert .Equal (t , "pwd" , cmd )
1870- assert .Empty (t , args )
1871- return nil
1872- })
18731861
18741862 // Wait until the ticker has been registered.
18751863 tickerTrap .MustWait (ctx ).MustRelease (ctx )
@@ -1913,7 +1901,6 @@ func TestAPI(t *testing.T) {
19131901 },
19141902 },
19151903 readConfigErrC : make (chan func (envs []string ) error , 2 ),
1916- execErrC : make (chan func (cmd string , args ... string ) error , 1 ),
19171904 }
19181905
19191906 testContainer = codersdk.WorkspaceAgentContainer {
@@ -1960,16 +1947,10 @@ func TestAPI(t *testing.T) {
19601947
19611948 // Close before api.Close() defer to avoid deadlock after test.
19621949 defer close (fSAC .createErrC )
1963- defer close (fDCCLI .execErrC )
19641950 defer close (fDCCLI .readConfigErrC )
19651951
19661952 // Given: We allow agent creation and injection to succeed.
19671953 testutil .RequireSend (ctx , t , fSAC .createErrC , nil )
1968- testutil .RequireSend (ctx , t , fDCCLI .execErrC , func (cmd string , args ... string ) error {
1969- assert .Equal (t , "pwd" , cmd )
1970- assert .Empty (t , args )
1971- return nil
1972- })
19731954 testutil .RequireSend (ctx , t , fDCCLI .readConfigErrC , func (env []string ) error {
19741955 // We expect the wrong workspace agent name passed in first.
19751956 assert .Contains (t , env , "CODER_WORKSPACE_AGENT_NAME=test-container" )
0 commit comments