Skip to content

Commit

Permalink
Make undeslivered parcel test reliable
Browse files Browse the repository at this point in the history
  • Loading branch information
gnarea committed Jun 22, 2020
1 parent e9d65f1 commit 91329d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 24 deletions.
15 changes: 5 additions & 10 deletions src/functional_tests/pdc_client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { Stan } from 'node-nats-streaming';
import { promisify } from 'util';

import { configureServices, PONG_ENDPOINT_ADDRESS, startService, stopService } from './services';
import { configureServices, PONG_ENDPOINT_ADDRESS } from './services';
import {
connectToNatsStreaming,
OBJECT_STORAGE_BUCKET,
Expand Down Expand Up @@ -49,17 +49,12 @@ describe('PDC client', () => {
});

test('Undelivered parcels should remain in the queue', async () => {
await stopService('pong');
try {
const parcel = new Parcel(PONG_ENDPOINT_ADDRESS, senderCertificate, Buffer.from([]));
const parcel = new Parcel('https://relaynet.local', senderCertificate, Buffer.from([]));

await queueParcel(parcel);
await queueParcel(parcel);

await sleep(2);
await expect(isParcelInStore(parcel)).resolves.toBeTrue();
} finally {
await startService('pong');
}
await sleep(2);
await expect(isParcelInStore(parcel)).resolves.toBeTrue();
});
});

Expand Down
14 changes: 0 additions & 14 deletions src/functional_tests/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,6 @@ async function tearDownServices(): Promise<void> {
});
}

export async function stopService(service: string): Promise<void> {
await dockerCompose.stopOne(service, {
composeOptions: COMPOSE_OPTIONS,
log: true,
});
}

export async function startService(service: string): Promise<void> {
await dockerCompose.restartOne(service, {
composeOptions: COMPOSE_OPTIONS,
log: true,
});
}

export async function vaultEnableSecret(kvPrefix: string): Promise<void> {
await VAULT_CLIENT.post(`/sys/mounts/${kvPrefix}`, {
options: { version: '2' },
Expand Down

0 comments on commit 91329d4

Please sign in to comment.