@@ -15,7 +15,7 @@ import * as ssh from "ssh2";
1515import { TarWriter } from "utils/tar" ;
1616import {
1717agentPProfPort ,
18- coderMain ,
18+ coderBinary ,
1919coderPort ,
2020defaultOrganizationName ,
2121defaultPassword ,
@@ -311,12 +311,9 @@ export const createGroup = async (page: Page): Promise<string> => {
311311export const sshIntoWorkspace = async (
312312page :Page ,
313313workspace :string ,
314- binaryPath = "go" ,
314+ binaryPath = coderBinary ,
315315binaryArgs :string [ ] = [ ] ,
316316) :Promise < ssh . Client > => {
317- if ( binaryPath === "go" ) {
318- binaryArgs = [ "run" , coderMain ] ;
319- }
320317const sessionToken = await findSessionToken ( page ) ;
321318return new Promise < ssh . Client > ( ( resolve , reject ) => {
322319const cp = spawn ( binaryPath , [ ...binaryArgs , "ssh" , "--stdio" , workspace ] , {
@@ -398,7 +395,7 @@ export const startAgent = async (
398395page :Page ,
399396token :string ,
400397) :Promise < ChildProcess > => {
401- return startAgentWithCommand ( page , token , "go" , "run" , coderMain ) ;
398+ return startAgentWithCommand ( page , token , coderBinary ) ;
402399} ;
403400
404401/**
@@ -479,27 +476,21 @@ export const startAgentWithCommand = async (
479476} ,
480477} ) ;
481478cp . stdout . on ( "data" , ( data :Buffer ) => {
482- console . info (
483- `[agent] [stdout] [onData]${ data . toString ( ) . replace ( / \n $ / g, "" ) } ` ,
484- ) ;
479+ console . info ( `[agent][stdout]${ data . toString ( ) . replace ( / \n $ / g, "" ) } ` ) ;
485480} ) ;
486481cp . stderr . on ( "data" , ( data :Buffer ) => {
487- console . info (
488- `[agent] [stderr] [onData]${ data . toString ( ) . replace ( / \n $ / g, "" ) } ` ,
489- ) ;
482+ console . info ( `[agent][stderr]${ data . toString ( ) . replace ( / \n $ / g, "" ) } ` ) ;
490483} ) ;
491484
492485await page
493486. getByTestId ( "agent-status-ready" )
494- . waitFor ( { state :"visible" , timeout :45_000 } ) ;
487+ . waitFor ( { state :"visible" , timeout :15_000 } ) ;
495488return cp ;
496489} ;
497490
498- export const stopAgent = async ( cp :ChildProcess , goRun = true ) => {
499- // When the web server is started with `go run`, it spawns a child process with coder server.
500- // `pkill -P` terminates child processes belonging the same group as `go run`.
501- // The command `kill` is used to terminate a web server started as a standalone binary.
502- exec ( goRun ?`pkill -P${ cp . pid } ` :`kill${ cp . pid } ` , ( error ) => {
491+ export const stopAgent = async ( cp :ChildProcess ) => {
492+ // The command `kill` is used to terminate an agent started as a standalone binary.
493+ exec ( `kill${ cp . pid } ` , ( error ) => {
503494if ( error ) {
504495throw new Error ( `exec error:${ JSON . stringify ( error ) } ` ) ;
505496}
@@ -922,10 +913,8 @@ export const updateTemplate = async (
922913
923914const sessionToken = await findSessionToken ( page ) ;
924915const child = spawn (
925- "go" ,
916+ coderBinary ,
926917[
927- "run" ,
928- coderMain ,
929918"templates" ,
930919"push" ,
931920"--test.provisioner" ,