Skip to content
This repository was archived by the owner on Mar 23, 2021. It is now read-only.

Commit 209f52b

Browse files
bors[bot]bonomat
andauthored
Merge #1769
1769: Terminate cnd in new e2e format r=bonomat a=bonomat In the new e2e format the cnd nodes are not terminated leaving us with unwanted running processes. Even worse, since we do not stop btsieve queries, these cnd nodes keep firing requests to the blockchain nodes. Note: This does not work as the test framework does not honor the final block, i.e. if the test times out, finally is not executed. ```javascript it("after the swap was accepted", async function() { const { alice, bob } = await createActors( "cnd_can_be_restarted.log" ); try { await do_the_limbo_dance(); } finally { if (alice) { alice.stop(); } if (bob) { bob.stop(); } } } ``` Co-authored-by: Philipp Hoenisch <philipp@hoenisch.at>
2 parents f2f19b2 + 083b20c commit 209f52b

File tree

3 files changed

+44
-8
lines changed

3 files changed

+44
-8
lines changed

api_tests/e2e/rfc003/btc_eth/cnd_can_be_restarted.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
1+
import { Actor } from "../../../lib_sdk/actors/actor";
12
import { createActors } from "../../../lib_sdk/create_actors";
23

34
setTimeout(function() {
5+
let alice: Actor;
6+
let bob: Actor;
7+
8+
beforeEach(async function() {
9+
this.timeout(20000);
10+
const actors = await createActors("cnd_can_be_restarted.log");
11+
alice = actors.alice;
12+
bob = actors.bob;
13+
});
14+
15+
afterEach(() => {
16+
if (alice) {
17+
alice.stop();
18+
}
19+
if (bob) {
20+
bob.stop();
21+
}
22+
});
23+
424
describe("cnd can be restarted", function() {
525
this.timeout(60000);
626
it("after the swap was accepted", async function() {
7-
const { alice, bob } = await createActors(
8-
"cnd_can_be_restarted.log"
9-
);
10-
1127
await alice.sendRequest();
1228
await bob.accept();
1329

api_tests/e2e/rfc003/btc_eth/happy.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
1+
import { Actor } from "../../../lib_sdk/actors/actor";
12
import { AssetKind } from "../../../lib_sdk/asset";
23
import { createActors } from "../../../lib_sdk/create_actors";
34

45
setTimeout(function() {
6+
let alice: Actor;
7+
let bob: Actor;
8+
9+
beforeEach(async function() {
10+
this.timeout(20000);
11+
const actors = await createActors("e2e-rfc003-btc-eth-happy.log");
12+
alice = actors.alice;
13+
bob = actors.bob;
14+
});
15+
16+
afterEach(() => {
17+
if (alice) {
18+
alice.stop();
19+
}
20+
if (bob) {
21+
bob.stop();
22+
}
23+
});
24+
525
describe("happy path", function() {
626
this.timeout(60000);
727
it("bitcoin ether", async function() {
8-
const { alice, bob } = await createActors(
9-
"e2e-rfc003-btc-eth-happy.log"
10-
);
11-
1228
await alice.sendRequest(AssetKind.Bitcoin, AssetKind.Ether);
1329
await bob.accept();
1430
await alice.fund();

api_tests/lib_sdk/actors/actor.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,10 @@ export class Actor {
244244
await this.cndInstance.start();
245245
}
246246

247+
public stop() {
248+
this.cndInstance.stop();
249+
}
250+
247251
private async additionalIdentities(
248252
alphaAsset: AssetKind,
249253
betaAsset: AssetKind

0 commit comments

Comments
 (0)