Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@ export class FunctionalTestRunner {

async run(abortSignal?: AbortSignal) {
const testStats = await this.getTestStats();
const realServices =
!testStats || (testStats.testCount > 0 && testStats.nonSkippedTestCount > 0);

return await this.runHarness(async (lifecycle, coreProviders) => {
return await this.runHarness({ realServices }, async (lifecycle, coreProviders) => {
SuiteTracker.startTracking(lifecycle, this.config.path);

const realServices =
!testStats || (testStats.testCount > 0 && testStats.nonSkippedTestCount > 0);

const providers = realServices
? new ProviderCollection(this.log, [
...coreProviders,
Expand Down Expand Up @@ -113,10 +112,12 @@ export class FunctionalTestRunner {
return;
}

await lifecycle.beforeTests.trigger(mocha.suite);
if (abortSignal?.aborted) {
this.log.warning('run aborted');
return;
if (realServices) {
await lifecycle.beforeTests.trigger(mocha.suite);
if (abortSignal?.aborted) {
this.log.warning('run aborted');
return;
}
}

this.log.info('Starting tests');
Expand Down Expand Up @@ -152,7 +153,7 @@ export class FunctionalTestRunner {
}

async getTestStats() {
return await this.runHarness(async (lifecycle, coreProviders) => {
return await this.runHarness({ realServices: false }, async (lifecycle, coreProviders) => {
if (this.config.get('testRunner')) {
return;
}
Expand Down Expand Up @@ -222,6 +223,11 @@ export class FunctionalTestRunner {
}

private async runHarness<T = any>(
{
realServices,
}: {
realServices: boolean;
},
handler: (lifecycle: Lifecycle, coreProviders: Providers) => Promise<T>
): Promise<T> {
let runErrorOccurred = false;
Expand All @@ -239,7 +245,8 @@ export class FunctionalTestRunner {
const dockerServers = new DockerServersService(
this.config.get('dockerServers'),
this.log,
lifecycle
lifecycle,
!realServices
);

// base level services that functional_test_runner exposes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export class DockerServersService {
[name: string]: DockerServerSpec;
},
private log: ToolingLog,
private lifecycle: Lifecycle
private lifecycle: Lifecycle,
private disabled?: boolean
) {
this.servers = Object.entries(configs).map(([name, config]) => ({
...config,
Expand Down Expand Up @@ -208,6 +209,10 @@ export class DockerServersService {
}

private async startServers() {
if (this.disabled) {
return;
}

await Promise.all(
this.servers.map(async (server) => {
if (server.enabled) {
Expand Down