Skip to content

Commit

Permalink
test: wait longer for front door
Browse files Browse the repository at this point in the history
  • Loading branch information
TheUnderScorer committed Jun 18, 2024
1 parent 639602e commit 868b9e8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion e2e/infra/frontdoor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
import { KnownSessionAffinityEnabledState } from '@azure/arm-frontdoor'
import invariant from 'tiny-invariant'
import { ExponentialBackoff, handleAll, retry } from 'cockatiel'
import { wait } from '../../shared/wait'

export interface ProvisionFrontDoorParams {
resourceGroup: string
Expand Down Expand Up @@ -155,6 +156,9 @@ export async function provisionFrontDoor({
}
}

// 4 minutes
const ADDITIONAL_WAIT = 240_000

async function waitForFrontDoor(url: string) {
console.info('Waiting for front door to be ready...', url)

Expand All @@ -166,7 +170,7 @@ async function waitForFrontDoor(url: string) {
maxAttempts: 40,
})

return policy.execute(async ({ attempt }) => {
await policy.execute(async ({ attempt }) => {
if (attempt > 1) {
console.info(`Attempt ${attempt}...`)
}
Expand All @@ -184,4 +188,7 @@ async function waitForFrontDoor(url: string) {

console.log('Frontdoor is ready!')
})

// Wait additional ADDITIONAL_WAIT ms, to make sure that frontdoor is fully ready. Otherwise it might cause flaky tests.
await wait(ADDITIONAL_WAIT)
}

0 comments on commit 868b9e8

Please sign in to comment.