Skip to content

Commit

Permalink
test: updated ci script, test config and assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
hui-an-yang committed Sep 20, 2024
1 parent d7ce3cb commit d0de62e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 37 deletions.
29 changes: 4 additions & 25 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
TEZOS_RPC_${{ matrix.testnet_uppercase }}: ${{ github.event.pull_request.head.repo.fork && matrix.rpc_url || null }}
8 changes: 4 additions & 4 deletions integration-tests/__tests__/contract/estimation-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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 () => {
Expand All @@ -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 () => {
Expand All @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/__tests__/rpc/nodes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();

Expand Down
17 changes: 11 additions & 6 deletions integration-tests/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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({
Expand All @@ -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']) {
Expand Down
1 change: 1 addition & 0 deletions integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit d0de62e

Please sign in to comment.