Skip to content

Commit

Permalink
fix: isWUComplete fails for compile + Attach
Browse files Browse the repository at this point in the history
Signed-off-by: Gordon Smith <[email protected]>
  • Loading branch information
GordonSmith committed Oct 26, 2023
1 parent e8db09d commit af478fd
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 23 deletions.
4 changes: 4 additions & 0 deletions packages/comms/src/ecl/workunit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,10 @@ export class Workunit extends StateObject<UWorkunitState, IWorkunitState> implem

async refreshState(): Promise<this> {
await this.WUQuery();
// Ensure "isComplete" is correct for WUs that are only "Compiled".
if (this.StateID === WUStateID.Compiled && !this.ActionEx && !this._submitAction) {
await this.refreshInfo();
}
return this;
}

Expand Down
26 changes: 3 additions & 23 deletions tests/test-comms/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,9 @@
"configurations": [
{
"name": "Mocha Tests",
"type": "node",
"request": "launch",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/../../node_modules/.bin/mocha",
"windows": {
"runtimeExecutable": "${workspaceRoot}/../../node_modules/.bin/mocha.cmd"
},
"linux": {
"runtimeExecutable": "${workspaceRoot}/../../node_modules/.bin/mocha"
},
"runtimeArgs": [
"-u",
"tdd",
"--timeout",
"999999",
"--colors",
"--exit",
"${workspaceRoot}/lib-umd/index.node.spec.js"
],
"internalConsoleOptions": "openOnSessionStart",
"outFiles": [
"${workspaceRoot}/build/**/*"
]
"type": "node-terminal",
"command": "npm run test:node && exit",
"request": "launch"
},
{
"name": "Launch Edge",
Expand Down
24 changes: 24 additions & 0 deletions tests/test-comms/src/ecl/workunit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,28 @@ allPeople;
});
});
});

describe.only("Compile + watchUntilComplete", function () {
it("Simple", function () {
return Workunit.compile({ baseUrl: ESP_URL }, "hthor", "'Hello and Welcome!';").then((wu) => {
return wu.watchUntilComplete();
}).then((wu) => {
return wu.delete();
}).catch((e) => {
logger.debug(e);
});
});

it("Compile + Attach", function () {
return Workunit.compile({ baseUrl: ESP_URL }, "hthor", "'Hello and Welcome!';").then((wu) => {
return Workunit.attach({ baseUrl: ESP_URL }, wu.Wuid);
}).then(wu => {
return wu.watchUntilComplete();
}).then((wu) => {
return wu.delete();
}).catch((e) => {
logger.debug(e);
});
});
});
});

0 comments on commit af478fd

Please sign in to comment.