Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add an option for skipping the port connectivity check #163

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
2 changes: 2 additions & 0 deletions packages/dockest/src/@types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ export interface DockestOpts {
logLevel: number
/** Run dockest sequentially */
runInBand: boolean
/** Skip port connectivity checks */
skipCheckConnection: boolean

jestLib: Jest

Expand Down
3 changes: 2 additions & 1 deletion packages/dockest/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export class Dockest {
mutables,
perfStart,
runInBand,
skipCheckConnection,
} = this.config

await bootstrap({
Expand All @@ -59,7 +60,7 @@ export class Dockest {
perfStart,
})

await waitForServices({ composeOpts, mutables, hostname, isInsideDockerContainer, runInBand })
await waitForServices({ composeOpts, mutables, hostname, isInsideDockerContainer, runInBand, skipCheckConnection })
await debugMode({ debug, mutables })
const { success } = await runJest({ jestLib, jestOpts, mutables })
await teardown({ hostname, isInsideDockerContainer, mutables, perfStart })
Expand Down
2 changes: 2 additions & 0 deletions packages/dockest/src/run/waitForServices/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ describe('waitForServices', () => {
isInsideDockerContainer,
mutables: { runners, jestRanWithResult: false, dockerEventEmitter: new EventEmitter() as any },
runInBand,
skipCheckConnection: false,
})

expect(dockerComposeUp).toHaveBeenCalledTimes(3)
Expand Down Expand Up @@ -91,6 +92,7 @@ describe('waitForServices', () => {
isInsideDockerContainer,
mutables: { runners, jestRanWithResult: false, dockerEventEmitter: new EventEmitter() as any },
runInBand,
skipCheckConnection: false,
})

// waitForRunner
Expand Down
8 changes: 7 additions & 1 deletion packages/dockest/src/run/waitForServices/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ export const waitForServices = async ({
isInsideDockerContainer,
mutables: { runners },
runInBand,
skipCheckConnection,
}: {
composeOpts: DockestConfig['composeOpts']
hostname: DockestConfig['hostname']
isInsideDockerContainer: DockestConfig['isInsideDockerContainer']
mutables: DockestConfig['mutables']
runInBand: DockestConfig['runInBand']
skipCheckConnection: DockestConfig['skipCheckConnection']
}) => {
const setupPromises = []

Expand All @@ -46,7 +48,11 @@ export const waitForServices = async ({
await fixRunnerHostAccessOnLinux(runner)
}

await checkConnection({ runner })
if (skipCheckConnection) {
runner.logger.debug(`${LOG_PREFIX} Skip connection check.`)
} else {
await checkConnection({ runner })
}
await runReadinessCheck({ runner })
await runRunnerCommands({ runner })

Expand Down
1 change: 1 addition & 0 deletions packages/dockest/src/utils/getOpts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ describe('getOpts', () => {
"mutables": Any<Object>,
"perfStart": Any<Number>,
"runInBand": true,
"skipCheckConnection": false,
}
`,
)
Expand Down
1 change: 1 addition & 0 deletions packages/dockest/src/utils/getOpts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ export const getOpts = (opts: Partial<DockestOpts> = {}): DockestConfig => {
logLevel,
perfStart: Date.now(),
runInBand,
skipCheckConnection: false,
}
}