Skip to content

Commit

Permalink
Fix sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
serban300 committed Mar 16, 2023
1 parent 757bc81 commit e896fde
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
4 changes: 2 additions & 2 deletions javascript/packages/orchestrator/src/providers/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ export abstract class Client {
abstract restartNode(name: string, timeout: number | null): Promise<boolean>;
}

let client: Client;
let client: Client | undefined;
export function getClient(): Client {
if (!client) throw new Error("Client not initialized");
return client;
}

export function setClient(c: Client) {
export function setClient(c: Client | undefined) {
client = c;
}
27 changes: 13 additions & 14 deletions javascript/packages/orchestrator/src/test-runner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import fs from "fs";
import Mocha from "mocha";
import path from "path";
import { Network, rebuildNetwork } from "../network";
import { NetworkNode } from "../networkNode";
import { start } from "../orchestrator";
import { Providers } from "../providers";
import { setClient } from "../providers/client";
Expand Down Expand Up @@ -271,20 +270,20 @@ export async function run(
let testFn = generator(assertion.parsed.args);
const test = new Test(assertion.original_line, async () => {
// Find the first network that contains the node and run the test on it.
let nodeName = assertion.parsed.args.node_name!;
for (let network of networks) {
let nodes: NetworkNode[];
try {
nodes = network.getNodes(nodeName);
} catch {
continue;
}

setClient(network.client);
await testFn(network, backchannelMap, configBasePath);
return;
let nodeName = assertion.parsed.args.node_name;
let network: Network | undefined;
if (nodeName) {
network = networks.find((network) => {
try {
network.getNodes(nodeName!);
return true;
} catch {}
});
}
throw new Error(`Node or Group: ${nodeName} not present`);

setClient(network?.client);
await testFn(network, backchannelMap, configBasePath);
return;
});
suite.addTest(test);
test.timeout(0);
Expand Down

0 comments on commit e896fde

Please sign in to comment.