diff --git a/src/test/nim/tserver.nim b/src/test/nim/tserver.nim index cc517bc..19779b7 100644 --- a/src/test/nim/tserver.nim +++ b/src/test/nim/tserver.nim @@ -25,7 +25,8 @@ let testuser = UserRef( # note: needs to correspond to an actual user suite "strawboss server": # suite setup code - discard startProcess("./strawboss", ".", @["serve", "-c", cfgFilePath], loadEnv(), {poUsePath}) + let serverProcess = startProcess("./strawboss", ".", + @["serve", "-c", cfgFilePath], loadEnv(), {poUsePath}) let http = newHttpClient() @@ -89,7 +90,11 @@ suite "strawboss server": check sameContents(projects, cfg.projects) # suite tear-down + + # give the server time to spin down but kill it after that discard newAsyncHttpClient().post(apiBase & "/service/debug/stop") + sleep(100) + if serverProcess.running: kill(serverProcess) suite "strawboss server continued": @@ -99,13 +104,20 @@ suite "strawboss server continued": var newCfg = cfg newCfg.artifactsRepo = tmpArtifactsDir writeFile(tmpCfgPath, $newCfg) - discard startProcess("./strawboss", ".", @["serve", "-c", tmpCfgPath], loadEnv(), {poUsePath}) + let serverProcess = startProcess("./strawboss", ".", + @["serve", "-c", tmpCfgPath], loadEnv(), {poUsePath}) # give the server time to spin up sleep(100) teardown: discard newAsyncHttpClient().post(apiBase & "/service/debug/stop") + removeDir(tmpArtifactsDir) + removeFile(tmpCfgPath) + + # give the server time to spin down but kill it after that + sleep(100) + if serverProcess.running: kill(serverProcess) test "handle missing project configuration": let http = newAuthenticatedHttpClient(apibase, "bob@builder.com", "password")