Skip to content

Commit

Permalink
Feat move integ tests to goerli (#233)
Browse files Browse the repository at this point in the history
* Refactor to run on goerli

* Add token addreses for goerli

* Pass rpc into integ test via env

* Add fetching from secrets manager for pks

* lower min balances

* Re enable goerli for joi

* Add back in old logs

* save

* bump gouda sdk for new quoter and reactor addresses

* Add addresses to high max and fix integ

* increment nonce in build order

* fix nonce reuse fails

* skip last test for now

* fix prettier
  • Loading branch information
zhongeric authored Jul 5, 2023
1 parent 8328134 commit d5db36a
Show file tree
Hide file tree
Showing 12 changed files with 143 additions and 177 deletions.
16 changes: 13 additions & 3 deletions bin/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,27 @@ export class APIPipeline extends Stack {
value: `${stage}/gouda-service/url`,
type: BuildEnvironmentVariableType.SECRETS_MANAGER,
},
TENDERLY_FORK_RPC: {
value: 'all/gouda-tenderly-fork/rpc',
INTEG_TEST_RPC: {
value: 'all/gouda-service/integ-test-rpc',
type: BuildEnvironmentVariableType.SECRETS_MANAGER,
},
TEST_WALLET_PK: {
value: 'all/gouda-service/test-wallet-pk',
type: BuildEnvironmentVariableType.SECRETS_MANAGER,
},
TEST_FILLER_PK: {
value: 'all/gouda-service/test-filler-pk',
type: BuildEnvironmentVariableType.SECRETS_MANAGER,
}
},
},
commands: [
'git config --global url."https://${GH_TOKEN}@github.com/".insteadOf ssh://git@github.com/',
'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc',
'echo "UNISWAP_API=${UNISWAP_API}" > .env',
'echo "RPC_12341234=${TENDERLY_FORK_RPC}" > .env',
'echo "RPC_5=${INTEG_TEST_RPC}" > .env',
'echo "TEST_WALLET_PK=${TEST_WALLET_PK}" > .env',
'echo "TEST_FILLER_PK=${TEST_FILLER_PK}" > .env',
'yarn install --network-concurrency 1 --skip-integrity-check',
'yarn build',
'yarn run integ-test',
Expand Down
4 changes: 4 additions & 0 deletions lib/handlers/post-order/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,14 @@ export class PostOrderHandler extends APIGLambdaHandler<
}

const HIGH_MAX_OPEN_ORDERS_SWAPPERS: string[] = [
// canaries
'0xa7152fad7467857dc2d4060fecaadf9f6b8227d3',
'0xf82af5cd1f0d24cdcf9d35875107d5e43ce9b3d0',
'0xa50dac48d61bb52b339c7ef0dcefa7688338d00a',
'0x5b062dc717983be67f7e1b44a6557d7da7d399bd',
// integ tests
'0xe001e6f6879c07b9ac24291a490f2795106d348c',
'0x8943ea25bbfe135450315ab8678f2f79559f4630',
]
export const DEFAULT_MAX_OPEN_ORDERS = 5
export const HIGH_MAX_OPEN_ORDERS = 200
Expand Down
2 changes: 1 addition & 1 deletion lib/util/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export enum ChainId {
TENDERLY = 12341234,
}

export const SUPPORTED_CHAINS = [ChainId.MAINNET, ChainId.POLYGON, ChainId.TENDERLY]
export const SUPPORTED_CHAINS = [ChainId.MAINNET, ChainId.GÖRLI, ChainId.POLYGON, ChainId.TENDERLY]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@aws-sdk/client-s3": "^3.341.0",
"@aws-sdk/client-sfn": "^3.341.0",
"@types/sinon": "^10.0.13",
"@uniswap/gouda-sdk": "^1.0.0-alpha.4",
"@uniswap/gouda-sdk": "^1.0.0-alpha.5",
"aws-cdk-lib": "2.85.0",
"aws-embedded-metrics": "^4.1.0",
"aws-sdk": "^2.1238.0",
Expand Down
2 changes: 1 addition & 1 deletion test/handlers/check-order-status.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe('Testing check order status handler', () => {
orderStatus: ORDER_STATUS.OPEN as string,
chainId: 2022,
} as any)
).rejects.toThrowError(`"chainId" must be one of [1, 137, 12341234]`)
).rejects.toThrowError(`"chainId" must be one of [1, 5, 137, 12341234]`)
})
})

Expand Down
2 changes: 1 addition & 1 deletion test/handlers/get-nonce.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('Testing get nonce handler.', () => {
[{ address: '' }, '"address\\" is not allowed to be empty"'],
[{ address: '0xF53bDa7e0337BD456cDcDab0Ab24Db43E738065' }, 'VALIDATION ERROR: Invalid address'],
[{}, '"address\\" is required'],
[{ address: MOCK_ADDRESS, chainId: 'foo' }, '\\"chainId\\" must be one of [1, 137, 12341234]'],
[{ address: MOCK_ADDRESS, chainId: 'foo' }, '\\"chainId\\" must be one of [1, 5, 137, 12341234]'],
])('Throws 400 with invalid query param %p', async (invalidQueryParam, bodyMsg) => {
const invalidEvent = {
...event,
Expand Down
2 changes: 1 addition & 1 deletion test/handlers/get-orders.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe('Testing get orders handler.', () => {
[{ sort: 'foo(bar)' }, '"foo(bar)\\" fails to match the required pattern'],
[{ cursor: 1 }, 'must be a string'],
[{ sort: 'gt(4)' }, '{"detail":"\\"sortKey\\" is required","errorCode":"VALIDATION_ERROR"}'],
[{ chainId: 420 }, '{"detail":"\\"chainId\\" must be one of [1, 137, 12341234]","errorCode":"VALIDATION_ERROR"}'],
[{ chainId: 420 }, '{"detail":"\\"chainId\\" must be one of [1, 5, 137, 12341234]","errorCode":"VALIDATION_ERROR"}'],
[{ desc: true }, '{"detail":"\\"sortKey\\" is required","errorCode":"VALIDATION_ERROR"}'],
[
{ desc: 'yes', sortKey: 'createdAt', orderStatus: 'expired' },
Expand Down
2 changes: 1 addition & 1 deletion test/handlers/post-order.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ describe('Testing post order handler.', () => {
{ signature: '0xbad_signature' },
'{"detail":"\\"signature\\" with value \\"0xbad_signature\\" fails to match the required pattern: /^0x[0-9,a-z,A-Z]{130}$/","errorCode":"VALIDATION_ERROR"}',
],
[{ chainId: 0 }, `{"detail":"\\"chainId\\" must be one of [1, 137, 12341234]","errorCode":"VALIDATION_ERROR"}`],
[{ chainId: 0 }, `{"detail":"\\"chainId\\" must be one of [1, 5, 137, 12341234]","errorCode":"VALIDATION_ERROR"}`],
[{ quoteId: 'not_UUIDV4' }, '{"detail":"\\"quoteId\\" must be a valid GUID","errorCode":"VALIDATION_ERROR"}'],
])('Throws 400 with invalid field %p', async (invalidBodyField, bodyMsg) => {
const invalidEvent = {
Expand Down
2 changes: 2 additions & 0 deletions test/integ/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ export const PERMIT2 = '0x000000000022d473030f116ddee9f6b43ac78ba3'

export const WETH = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
export const UNI = '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984'
export const WETH_GOERLI = '0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6'
export const UNI_GOERLI = '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984'
Loading

0 comments on commit d5db36a

Please sign in to comment.