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

Commit bb7b66a

Browse files
authored
Merge pull request #772 from lightninglabs/fix-integ-test-flakes
Fix integration test flakes.
2 parents aa3c66b + 36e9b93 commit bb7b66a

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

test/integration/action/action-integration.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { rmdir, isPortOpen } from './test-util';
1+
import { rmdir, isPortOpen, killProcess } from './test-util';
22
import { Store } from '../../../src/store';
33
import IpcAction from '../../../src/action/ipc';
44
import GrpcAction from '../../../src/action/grpc';
@@ -280,7 +280,7 @@ describe('Action Integration Tests', function() {
280280
});
281281

282282
it('should fund wallet for node1', async () => {
283-
btcdProcess.kill('SIGINT');
283+
await killProcess(btcdProcess.pid);
284284
btcdArgs.miningAddress = store1.walletAddress;
285285
btcdProcess = await startBtcdProcess(btcdArgs);
286286
await nap(NAP_TIME);

test/integration/action/test-util.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import fs from 'fs';
22
import net from 'net';
3+
import { nap } from '../../../src/helper';
34

45
export const rmdir = path => {
56
if (fs.existsSync(path)) {
@@ -24,3 +25,15 @@ export const isPortOpen = async port => {
2425
client.connect(port, 'localhost');
2526
});
2627
};
28+
29+
export const killProcess = async pid => {
30+
let terminated = false;
31+
while (!terminated) {
32+
try {
33+
process.kill(pid);
34+
await nap(500);
35+
} catch (e) {
36+
terminated = true;
37+
}
38+
}
39+
};

0 commit comments

Comments
 (0)