* v test * Cleanup test. Add pull policy. * Find new bounty on the list. Extract test support. * Working no-substrate test * Change imports to local * Add a test for validation * Extract local var * Update package versions * Read the right const (dataDepositPerByte) * Update yarn.lock * Revert fast test changes. * Update yarn.lock * Update yarn.lock
30 lines
971 B
TypeScript
30 lines
971 B
TypeScript
// Copyright 2017-2020 @polkadot/app-accounts authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import { AlwaysPullPolicy, GenericContainer, Wait } from 'testcontainers';
|
|
|
|
import { SubstrateTestsGlobal } from './substrateTestsGlobal';
|
|
|
|
declare const global: SubstrateTestsGlobal;
|
|
|
|
const startSubstrate = async () => {
|
|
console.log('Substrate container starting...');
|
|
|
|
const startedTestContainer = await new GenericContainer('parity/substrate')
|
|
.withPullPolicy(new AlwaysPullPolicy())
|
|
.withName('polkadot-apps-test-substrate')
|
|
.withExposedPorts(9944)
|
|
.withCmd(['--dev', '--ws-port=9944', '--unsafe-ws-external'])
|
|
.withWaitStrategy(Wait.forLogMessage('New epoch 0 launching'))
|
|
.start();
|
|
|
|
console.log('Done.');
|
|
|
|
process.env.TEST_SUBSTRATE_PORT = startedTestContainer.getMappedPort(9944)?.toString() || '';
|
|
global.__SUBSTRATE__ = startedTestContainer;
|
|
};
|
|
|
|
export default async (): Promise<void> => {
|
|
await startSubstrate();
|
|
};
|