Skip to content

Commit

Permalink
Integration test refine (#2897)
Browse files Browse the repository at this point in the history
* test: updating tests to be compatible running with secret-key

* ci: updated weeklynet ci script
  • Loading branch information
hui-an-yang authored Apr 10, 2024
1 parent b426db1 commit fb3f970
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/mondaynet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
working-directory: ./integration-tests
env:
MONDAYNET: true
run: npm run test:originate-known-contracts
run: npm run originate-known-contracts
-
if: always()
id: integration-tests-mondaynet
Expand All @@ -58,7 +58,7 @@ jobs:
TEZOS_MONDAYNET_TZIP1216CONTRACT_ADDRESS: ${{ steps.originate-contracts-mondaynet.outputs.knownTzip12BigMapOffChainContractAddress }}
TEZOS_MONDAYNET_SAPLINGCONTRACT_ADDRESS: ${{ steps.originate-contracts-mondaynet.outputs.knownSaplingContractAddress }}
TEZOS_MONDAYNET_ON_CHAIN_VIEW_CONTRACT: ${{ steps.originate-contracts-mondaynet.outputs.knownOnChainViewContractAddress }}
run: npm run test:mondaynet -- --maxWorkers=2
run: npm run test:weeklynet -- --maxWorkers=2
-
name: Slack Notification
if: always()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ CONFIGS().forEach(({ rpc }) => {
beforeAll(async () => {
if(rpc.includes('oxfordnet')){
Tezos = new TezosToolkit('https://rpc.tzkt.io/oxfordnet');
}
if(rpc.includes('ghostnet')){
} else if(rpc.includes('ghostnet')){
Tezos = new TezosToolkit('https://rpc.tzkt.io/ghostnet');
} else {
Tezos = new TezosToolkit(rpc);
}
Tezos.setSignerProvider(new InMemorySigner(aliceSKey));
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
import { TezosToolkit } from '@taquito/taquito';
import { CONFIGS } from '../../../config';

CONFIGS().forEach(({ lib, rpc, setup, createAddress }) => {

const Tezos = lib;

describe(`Test Update Consensus Key using: ${rpc}`, () => {
let pk: string;
let consensusPk: string;
let delegateAccount: TezosToolkit;
beforeAll(async () => {
await setup(true);

try {
const account = await createAddress();
pk = await account.signer.publicKey();
const pkh = await account.signer.publicKeyHash();
delegateAccount = await createAddress();

const fund = await Tezos.contract.transfer({ amount: 5, to: pkh });
const consensusAccount = await createAddress();
consensusPk = await consensusAccount.signer.publicKey();

const fund = await Tezos.contract.batch()
.withTransfer({ amount: 2, to: await delegateAccount.signer.publicKeyHash() })
.withTransfer({ amount: 2, to: await consensusAccount.signer.publicKeyHash()})
.send();
await fund.confirmation();

const register = await Tezos.contract.registerDelegate({});
const register = await delegateAccount.contract.registerDelegate({});
await register.confirmation();

} catch (e) {
Expand All @@ -27,7 +33,7 @@ CONFIGS().forEach(({ lib, rpc, setup, createAddress }) => {
});

it('should be able to inject update_consensus_key operation', async () => {
const op = await Tezos.contract.updateConsensusKey({ pk });
const op = await delegateAccount.contract.updateConsensusKey({ pk: consensusPk });
await op.confirmation();

expect(op.status).toBe('applied');
Expand Down
5 changes: 3 additions & 2 deletions integration-tests/__tests__/wallet/failing-noop.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ CONFIGS().forEach(({ rpc }) => {
beforeAll(async () => {
if(rpc.includes('oxfordnet')){
Tezos = new TezosToolkit('https://rpc.tzkt.io/oxfordnet');
}
if(rpc.includes('ghostnet')){
} else if(rpc.includes('ghostnet')){
Tezos = new TezosToolkit('https://rpc.tzkt.io/ghostnet');
} else {
Tezos = new TezosToolkit(rpc);
}
Tezos.setSignerProvider(new InMemorySigner(aliceSKey));
});
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const oxfordnetEphemeral: Config =
const oxfordnetSecretKey: Config =
{ ...oxfordnetEphemeral, ...{ signerConfig: defaultSecretKey }, ...{ defaultRpc: 'http://ecad-oxfordnet-full:8732' } };

const nairobinetSecretKey: Config =
const nairobinetSecretKey: Config =
defaultConfig({
networkName: 'NAIROBINET',
protocol: Protocols.PtNairobi,
Expand All @@ -154,13 +154,13 @@ const ghostnetEphemeral: Config =
defaultConfig({
networkName: 'GHOSTNET',
protocol: Protocols.ProxfordY,
defaultRpc: 'http://ecad-ghostnet-rolling:8732',
defaultRpc: 'http://ecad-ghostnet-rolling-2.i.tez.ie:8732',
knownContracts: knownContractsPtGhostnet,
signerConfig: defaultEphemeralConfig('https://keygen.ecadinfra.com/ghostnet')
});

const ghostnetSecretKey: Config =
{ ...ghostnetEphemeral, ...{ signerConfig: defaultSecretKey }, ...{ defaultRpc: 'http://ecad-ghostnet-rolling:8732' } };
{ ...ghostnetEphemeral, ...{ signerConfig: defaultSecretKey }, ...{ defaultRpc: 'http://ecad-ghostnet-rolling-2.i.tez.ie:8732' } };

const weeklynetEphemeral: Config =
defaultConfig({
Expand Down

0 comments on commit fb3f970

Please sign in to comment.