Fix bug around spawning worker processes.

We were expecting to find the path to the `strawboss` binary implicitly from
the environment, which meant that configuration was also implicit, and required
more setup. Now the path to the binary is explicit in the StrawBoss runtime
configuration, and the path to the configuration file can also be explicitly given.
This commit is contained in:
Jonathan Bernard
2017-05-11 10:43:55 -05:00
parent 42f37a21e6
commit a1100f17d8
6 changed files with 47 additions and 15 deletions

View File

@ -87,9 +87,22 @@ suite "strawboss server":
let returnedVersions = parseJson(resp.body).getElems.mapIt(it.getStr)
check sameContents(expectedVersions, returnedVersions)
#test "enqueue a build":
# let http = newAuthenticatedHttpClient(apibase, "bob@builder.com", "password")
# let resp = http.get(apiBase & "/project/" & testProjName & "
test "run a successful build with artifacts":
let http = newAuthenticatedHttpClient(apibase, "bob@builder.com", "password")
let resp = http.get(apiBase & "/project/" & testProjName & "/step/build/run/0.1.0"
check resp.status.startsWith("200")
# TODO
# check that the project directory has been created in the artifacts repo
# check that the run status file has been created in the artifacts repo
# check that the run status is not failed
# wait for the build to complete
# check that the status is "complete"
# check that the artifacts we expect are present
check false
test "run a time-consuming build and check the status via the API"
check false
# Last-chance catch to kill the server in case some test err'ed and didn't
# reach it's teardown handler

View File

@ -5,14 +5,14 @@ import ../../../main/nim/strawbosspkg/configuration
suite "load and save configuration objects":
# suite setup & common data
let testProjDefStr = """{ "name": "test-project-1", "repo":
let testProjDefStr = """{ "name": "dummy-project", "repo":
"/non-existent/dir",
"cfgFilePath": "strawhat.json",
"defaultBranch": "deploy",
"envVars": { "VAR1": "value" } }"""
let testProjDef = ProjectDef(
name: "test-project-1",
name: "dummy-project",
repo: "/non-existent/dir",
cfgFilePath: "strawhat.json",
defaultBranch: "deploy",
@ -23,7 +23,7 @@ suite "load and save configuration objects":
let pd = parseProjectDef(parseJson(testProjDefStr))
check:
pd.name == "test-project-1"
pd.name == "dummy-project"
pd.repo == "/non-existent/dir"
pd.cfgFilePath == "strawhat.json"
pd.defaultBranch == "deploy"
@ -61,13 +61,13 @@ suite "load and save configuration objects":
let expectedUsers = @[UserRef(name: "bob@builder.com", hashedPwd: "testvalue"),
UserRef(name: "sam@sousa.com", hashedPwd: "testvalue")]
let expectedProjects = @[
ProjectDef(name: "test-project-1",
ProjectDef(name: "dummy-project",
repo: "/non-existent/dir",
defaultBranch: "deploy",
cfgFilePath: "strawhat.json",
envVars: newStringTable("VAR1", "value", modeCaseSensitive)),
ProjectDef(name: "test-strawboss",
repo: "https://git.jdb-labs.com:jdb/test-strawboss.git",
ProjectDef(name: "test-project",
repo: "",
defaultBranch: "master",
cfgFilePath: "strawboss.json",
envVars: newStringTable(modeCaseSensitive))]
@ -80,10 +80,10 @@ suite "load and save configuration objects":
sameContents(expectedProjects, cfg.projects)
test "loadProjectConfig":
let pc = loadProjectConfig("src/test/json/test-project-1.config.json")
let pc = loadProjectConfig("src/test/json/dummy-project.config.json")
check:
pc.name == "test-project-1"
pc.name == "dummy-project"
pc.versionCmd == "git describe --all --always"
pc.steps.len == 2

Binary file not shown.