Skip to content

Commit

Permalink
Merge pull request #1076 from ainblockchain/hotfix/minsulee2/fix-inte…
Browse files Browse the repository at this point in the history
…gration-test

Hotfix integration test
  • Loading branch information
minsulee2 authored Jun 30, 2022
2 parents f693e91 + 0c01e43 commit c6129aa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions test/integration/he_sharding.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,10 @@ describe('HE Sharding', () => {
});

describe('Shard reporter node restart', () => {
before(() => {
ENV_VARIABLES[2].PEER_CANDIDATE_JSON_RPC_URL = "http://localhost:9092/json-rpc";
});

it('can resume reporting after missing some reports', async () => {
const latestBefore = parseOrLog(syncRequest(
'GET', parentServer + `/get_value?ref=${sharding.sharding_path}/.shard/latest_block_number`)
Expand All @@ -369,6 +373,10 @@ describe('HE Sharding', () => {
}
expect(latestAfter).to.be.greaterThan(latestBefore);
});

after(() => {
delete ENV_VARIABLES[2].PEER_CANDIDATE_JSON_RPC_URL;
});
});
});
})
9 changes: 8 additions & 1 deletion test/integration/sharding.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,10 @@ describe('Sharding', () => {
});

describe('Shard reporter node restart', () => {
before(() => {
ENV_VARIABLES[2].PEER_CANDIDATE_JSON_RPC_URL = "http://localhost:9002/json-rpc";
});

it('can resume reporting after missing some reports', async () => {
const latestBefore = parseOrLog(syncRequest(
'GET', parentServer + `/get_value?ref=${sharding.sharding_path}/.shard/latest_block_number`)
Expand All @@ -457,7 +461,6 @@ describe('Sharding', () => {
server1_proc.kill();
await waitForNewBlocks(server2, sharding.reporting_period * 3);
console.log(` --> Restarting server[0]...`);
ENV_VARIABLES[2].PEER_CANDIDATE_JSON_RPC_URL = "http://localhost:9002/json-rpc";
server1_proc = startServer(APP_SERVER, 'server1', ENV_VARIABLES[2]);
await waitUntilNodeSyncs(server1);
await waitForNewShardingReports(parentServer, sharding.sharding_path);
Expand All @@ -476,6 +479,10 @@ describe('Sharding', () => {
expect(latestAfter).to.be.greaterThan(latestBefore);
});
});

after(() => {
delete ENV_VARIABLES[2].PEER_CANDIDATE_JSON_RPC_URL;
});
});

describe('API tests', () => {
Expand Down

0 comments on commit c6129aa

Please sign in to comment.