fix: remove flakey tests from cloud functions and overall deflake (#7156)
* fix: remove flakey tests * increase setup time * reduce max workers * Update .github/workflows/test.yml Co-authored-by: Zach Pomerantz <zzmp@uniswap.org> * Update functions/global-setup.ts Co-authored-by: Zach Pomerantz <zzmp@uniswap.org> * Update global-teardown.ts * add retry time --------- Co-authored-by: Zach Pomerantz <zzmp@uniswap.org>
This commit is contained in:
parent
7cf768b8dd
commit
51dc10b467
3
.github/workflows/test.yml
vendored
3
.github/workflows/test.yml
vendored
@ -225,7 +225,8 @@ jobs:
|
|||||||
path: node_modules/.cache
|
path: node_modules/.cache
|
||||||
key: ${{ runner.os }}-cloud-jest-${{ github.run_id }}
|
key: ${{ runner.os }}-cloud-jest-${{ github.run_id }}
|
||||||
restore-keys: ${{ runner.os }}-cloud-jest-
|
restore-keys: ${{ runner.os }}-cloud-jest-
|
||||||
- run: yarn test:cloud --coverage --maxWorkers=100%
|
# Only use 1 worker, so the other can be used for the proxy server under test.
|
||||||
|
- run: yarn test:cloud --coverage --maxWorkers=1
|
||||||
|
|
||||||
pre:
|
pre:
|
||||||
if: ${{ github.ref_name == 'main' || github.ref_name == 'releases/staging' }}
|
if: ${{ github.ref_name == 'main' || github.ref_name == 'releases/staging' }}
|
||||||
|
@ -10,7 +10,7 @@ test.each(assetImageUrl)('assetImageUrl', async (url) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const invalidAssetImageUrl = [
|
const invalidAssetImageUrl = [
|
||||||
'http://127.0.0.1:3000/api/image/nfts/asset/0xed5af388653567af2f388e6224dc7c4b3241c544/100000',
|
'http://127.0.0.1:3000/api/image/nfts/asset/0xed5af388653567af2f388e6224dc7c4b3241c544/10001',
|
||||||
'http://127.0.0.1:3000/api/image/nfts/asset/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/44700',
|
'http://127.0.0.1:3000/api/image/nfts/asset/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/44700',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ export const onRequest: PagesFunction = async ({ params, request }) => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return new Response('Asset not found.', { status: 404 })
|
return new Response('Collection not found.', { status: 404 })
|
||||||
}
|
}
|
||||||
|
|
||||||
const [fontData, palette] = await Promise.all([getFont(), getColor(data.ogImage)])
|
const [fontData, palette] = await Promise.all([getFont(), getColor(data.ogImage)])
|
||||||
|
@ -25,7 +25,7 @@ export const onRequest: PagesFunction = async ({ params, request }) => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return new Response('Asset not found.', { status: 404 })
|
return new Response('Token not found.', { status: 404 })
|
||||||
}
|
}
|
||||||
|
|
||||||
const [fontData, palette] = await Promise.all([getFont(), getColor(data.ogImage)])
|
const [fontData, palette] = await Promise.all([getFont(), getColor(data.ogImage)])
|
||||||
|
@ -13,7 +13,6 @@ const invalidTokenImageUrl = [
|
|||||||
'http://127.0.0.1:3000/api/image/tokens/ethereum/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb49',
|
'http://127.0.0.1:3000/api/image/tokens/ethereum/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb49',
|
||||||
'http://127.0.0.1:3000/api/image/tokens/ethereum',
|
'http://127.0.0.1:3000/api/image/tokens/ethereum',
|
||||||
'http://127.0.0.1:3000/api/image/tokens/ethereun',
|
'http://127.0.0.1:3000/api/image/tokens/ethereun',
|
||||||
'http://127.0.0.1:3000/api/image/tokens/ethereum/0x0',
|
|
||||||
'http://127.0.0.1:3000/api/image/tokens/potato/?potato=1',
|
'http://127.0.0.1:3000/api/image/tokens/potato/?potato=1',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ module.exports = async function globalSetup() {
|
|||||||
globalThis.servers = await setup({
|
globalThis.servers = await setup({
|
||||||
command: `yarn start:cloud`,
|
command: `yarn start:cloud`,
|
||||||
port: 3000,
|
port: 3000,
|
||||||
launchTimeout: 80000,
|
launchTimeout: 120000, // takes ~2m on CI
|
||||||
})
|
})
|
||||||
// Wait for wrangler to return a request before running tests
|
// Wait for wrangler to return a request before running tests
|
||||||
for (let i = 0; i < 3; i++) {
|
for (let i = 0; i < 3; i++) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"globalSetup": "<rootDir>/global-setup.ts",
|
"globalSetup": "<rootDir>/global-setup.ts",
|
||||||
"globalTeardown": "<rootDir>/global-teardown.ts",
|
"globalTeardown": "<rootDir>/global-teardown.ts",
|
||||||
|
"setupFilesAfterEnv": ["<rootDir>/setupAfterEnv.ts"],
|
||||||
"preset": "ts-jest",
|
"preset": "ts-jest",
|
||||||
"transform": {
|
"transform": {
|
||||||
"'^.+\\.(ts|tsx)?$'": "ts-jest",
|
"'^.+\\.(ts|tsx)?$'": "ts-jest",
|
||||||
|
1
functions/setupAfterEnv.ts
Normal file
1
functions/setupAfterEnv.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
jest.retryTimes(3)
|
Loading…
Reference in New Issue
Block a user