Add retry handling when hitting SSO (#11061)

This aims to reduce flakiness when SSO disabling for a test project is
still disabling/propagating.

x-ref:
https://github.com/vercel/vercel/actions/runs/7563953104/job/20597320056?pr=11059
x-ref:
https://github.com/vercel/vercel/actions/runs/7563953104/job/20597322078?pr=11059

---------

Co-authored-by: Nathan Rajlich <n@n8.io>
Co-authored-by: Sean Massa <EndangeredMassa@gmail.com>
This commit is contained in:
JJ Kasper
2024-01-18 13:17:49 -08:00
committed by GitHub
parent 7de754398e
commit 0da7ea7b78
2 changed files with 29 additions and 3 deletions

View File

@@ -3,7 +3,7 @@ const assert = require('assert');
const { createHash } = require('crypto');
const path = require('path');
const _fetch = require('node-fetch');
const fetch = require('./fetch-retry.js');
const fetch = require('./fetch-retry');
const fileModeSymbol = Symbol('fileMode');
const { logWithinTest } = require('./log');
const ms = require('ms');
@@ -149,7 +149,7 @@ async function disableSSO(deploymentId, useTeam = true) {
);
if (settingRes.ok) {
for (let i = 0; i < 5; i++) {
for (let i = 0; i < 10; i++) {
const res = await fetch(`https://${deploymentUrl}`);
if (res.status !== 401) {
break;