From d0de62ed676075093c17f701d6b1b02c321d1c82 Mon Sep 17 00:00:00 2001 From: huianyang Date: Fri, 20 Sep 2024 12:22:52 -0700 Subject: [PATCH] test: updated ci script, test config and assertions --- .github/workflows/main.yml | 29 +++---------------- .../contract/estimation-tests.spec.ts | 8 ++--- integration-tests/__tests__/rpc/nodes.spec.ts | 4 +-- integration-tests/config.ts | 17 +++++++---- integration-tests/package.json | 1 + 5 files changed, 22 insertions(+), 37 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0739fee521..16419e9c4c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,6 +46,9 @@ jobs: - testnet: parisnet testnet_uppercase: PARISNET rpc_url: https://parisnet.ecadinfra.com + - testnet: quebecanet + testnet_uppercase: QUEBECANET + rpc_url: https://quebecanet.ecadinfra.com steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -63,28 +66,4 @@ jobs: run: npm -w integration-tests run test:${{ matrix.testnet }} -- --maxWorkers=4 env: # Ternary operator workaround - TEZOS_RPC_${{ matrix.testnet_uppercase }}: ${{ github.event.pull_request.head.repo.fork && matrix.rpc_url || null }} - integration-tests-testnet-quebecA-secret-key: - runs-on: ubuntu-latest - continue-on-error: true - strategy: - matrix: - include: - - testnet: quebecanet - testnet_uppercase: QUEBECANET - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: lts/hydrogen - - run: npm ci - - run: npm run build - - if: ${{ !github.event.pull_request.head.repo.fork }} - name: Tailscale - uses: tailscale/github-action@v1 - with: - authkey: ${{ secrets.TAILSCALE_AUTHKEY }} - version: 1.32.2 - - run: npm -w integration-tests run test:quebecanet-secret-key - env: - RUN_${{ matrix.testnet_uppercase }}_WITH_SECRET_KEY: true \ No newline at end of file + TEZOS_RPC_${{ matrix.testnet_uppercase }}: ${{ github.event.pull_request.head.repo.fork && matrix.rpc_url || null }} \ No newline at end of file diff --git a/integration-tests/__tests__/contract/estimation-tests.spec.ts b/integration-tests/__tests__/contract/estimation-tests.spec.ts index 6b260fe721..dbfec8f639 100644 --- a/integration-tests/__tests__/contract/estimation-tests.spec.ts +++ b/integration-tests/__tests__/contract/estimation-tests.spec.ts @@ -102,7 +102,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { expect(estimate.minimalFeeMutez).toEqual(374); expect(estimate.totalCost).toEqual(374); expect(estimate.usingBaseFeeMutez).toEqual(374); - expect(estimate.consumedMilligas).toEqual(1455798); + expect(estimate.consumedMilligas).toEqual(1455884); }); it('Verify .estimate.transfer for multiple internal transfers to unallocated account', async () => { @@ -119,7 +119,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { expect(estimate.minimalFeeMutez).toEqual(445); expect(estimate.totalCost).toEqual(133945); expect(estimate.usingBaseFeeMutez).toEqual(445); - expect(estimate.consumedMilligas).toEqual(1570327); + expect(estimate.consumedMilligas).toEqual(1570413); }); it('Verify .estimate.transfer for internal origination', async () => { @@ -132,7 +132,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { expect(estimate.minimalFeeMutez).toEqual(421); expect(estimate.totalCost).toEqual(84671); expect(estimate.usingBaseFeeMutez).toEqual(421); - expect(estimate.consumedMilligas).toEqual(1866422); + expect(estimate.consumedMilligas).toEqual(1866508); }); it('Verify .estimate.transfer for multiple internal originations', async () => { @@ -145,7 +145,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, rpc }) => { expect(estimate.minimalFeeMutez).toEqual(539); expect(estimate.totalCost).toEqual(164039); expect(estimate.usingBaseFeeMutez).toEqual(539); - expect(estimate.consumedMilligas).toEqual(2391575); + expect(estimate.consumedMilligas).toEqual(2391661); // Do the actual operation const op2 = await contract.methods.do(originate2()).send(); await op2.confirmation(); diff --git a/integration-tests/__tests__/rpc/nodes.spec.ts b/integration-tests/__tests__/rpc/nodes.spec.ts index a7eafa3511..1dc077bcc7 100644 --- a/integration-tests/__tests__/rpc/nodes.spec.ts +++ b/integration-tests/__tests__/rpc/nodes.spec.ts @@ -19,7 +19,7 @@ CONFIGS().forEach( knownViewContract, }) => { const Tezos = lib; - const unrestrictedRPCNode = rpc.endsWith("ecadinfra.com") ? test.skip : test; + const unrestrictedRPCNode = rpc.includes("i.ecadinfra.com") ? test : test.skip; const quebecanet = protocol === Protocols.PsquebeCa ? test : test.skip; let ticketContract: DefaultContractType; @@ -165,7 +165,7 @@ CONFIGS().forEach( expect(bigMapValue).toBeDefined(); }); - it(`Verify that rpcClient.getAllDelegates returns all delegates from RPC`, async () => { + unrestrictedRPCNode(`Verify that rpcClient.getAllDelegates returns all delegates from RPC`, async () => { const allDelegates = await rpcClient.getAllDelegates(); expect(allDelegates).toBeDefined(); diff --git a/integration-tests/config.ts b/integration-tests/config.ts index e7042b843c..e9cca8a83f 100644 --- a/integration-tests/config.ts +++ b/integration-tests/config.ts @@ -141,14 +141,17 @@ const parisnetEphemeral: Config = const parisnetSecretKey: Config = { ...parisnetEphemeral, ...{ signerConfig: defaultSecretKey }, ...{ defaultRpc: 'https://rpc.pariscnet.teztnets.com/' } }; -const quebecASecretKey: Config = +const quebecanetEphemeral: Config = defaultConfig({ networkName: 'QUEBECANET', protocol: Protocols.PsquebeCa, - defaultRpc: ' https://rpc.quebecanet.teztnets.com', + defaultRpc: 'http://ecad-tezos-quebecanet-rolling-1.i.ecadinfra.com/', knownContracts: knownContractsPsquebeCa, - signerConfig: defaultSecretKey - }) + signerConfig: defaultEphemeralConfig('https://keygen.ecadinfra.com/quebecanet') + }); + +const quebecanetSecretKey: Config = + { ...parisnetEphemeral, ...{ signerConfig: defaultSecretKey }, ...{ defaultRpc: 'https://quebecanet.ecadinfra.com/' } }; const ghostnetEphemeral: Config = defaultConfig({ @@ -160,7 +163,7 @@ const ghostnetEphemeral: Config = }); const ghostnetSecretKey: Config = - { ...ghostnetEphemeral, ...{ signerConfig: defaultSecretKey }, ...{ defaultRpc: 'http://ecad-tezos-ghostnet-rolling-1.i.ecadinfra.com/' } }; + { ...ghostnetEphemeral, ...{ signerConfig: defaultSecretKey }, ...{ defaultRpc: 'https://ghostnet.ecadinfra.com/' } }; const weeklynetEphemeral: Config = defaultConfig({ @@ -183,11 +186,13 @@ if (process.env['RUN_WITH_SECRET_KEY']) { } else if (process.env['RUN_GHOSTNET_WITH_SECRET_KEY']) { providers.push(ghostnetSecretKey); } else if (process.env['RUN_QUEBECANET_WITH_SECRET_KEY']) { - providers.push(quebecASecretKey); + providers.push(quebecanetSecretKey); } else if (process.env['RUN_WEEKLYNET_WITH_SECRET_KEY']) { providers.push(weeklynetSecretKey); } else if (process.env['PARISNET']) { providers.push(parisnetEphemeral); +} else if (process.env['QUEBECANET']) { + providers.push(quebecanetEphemeral); } else if (process.env['GHOSTNET']) { providers.push(ghostnetEphemeral); } else if (process.env['WEEKLYNET']) { diff --git a/integration-tests/package.json b/integration-tests/package.json index 1afa157094..8f55aafa61 100644 --- a/integration-tests/package.json +++ b/integration-tests/package.json @@ -5,6 +5,7 @@ "test:secret-key": "RUN_WITH_SECRET_KEY=true jest --runInBand", "test:parisnet": "PARISNET=true jest", "test:parisnet-secret-key": "RUN_PARISNET_WITH_SECRET_KEY=true jest --runInBand", + "test:quebecanet": "QUEBECANET=true jest", "test:quebecanet-secret-key": "RUN_QUEBECANET_WITH_SECRET_KEY=true jest --runInBand", "test:weeklynet": "WEEKLYNET=true jest", "test:weeklynet-secret-key": "RUN_WEEKLYNET_WITH_SECRET_KEY=true jest --runInBand",