Skip to content

Commit

Permalink
test(e2e): ensure target application resets after each test execution (
Browse files Browse the repository at this point in the history
  • Loading branch information
derevnjuk committed Apr 18, 2024
1 parent 9fa11cd commit b6d75b0
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions tests/Commands/repeater.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@ describe('Repeater Command', () => {
baseUrl: `https://${config.cluster}`,
apiKey: config.apiKey
});
});

afterAll(() => {
targetProcess.stderr.destroy();
targetProcess.stdout.destroy();
targetProcess.kill('SIGTERM');
});

beforeEach(async () => {
const [targetCmd, ...targetArgs]: string[] = config.targetCmd.split(' ');
targetProcess = spawn(targetCmd, targetArgs, {
shell: true,
Expand All @@ -44,15 +52,7 @@ describe('Repeater Command', () => {

targetProcess.stdout.pipe(process.stdout);
targetProcess.stderr.pipe(process.stderr);
});

afterAll(() => {
targetProcess.stderr.destroy();
targetProcess.stdout.destroy();
targetProcess.kill('SIGTERM');
});

beforeEach(async () => {
repeaterId = await api.createRepeater(name);
}, 10000);

Expand All @@ -63,6 +63,12 @@ describe('Repeater Command', () => {
commandProcess.kill('SIGTERM');
}

if (targetProcess) {
targetProcess.stderr.destroy();
targetProcess.stdout.destroy();
targetProcess.kill('SIGTERM');
}

await api.deleteRepeater(repeaterId);
}, 10000);

Expand Down

0 comments on commit b6d75b0

Please sign in to comment.