Improve app/p2p version testing

This commit is contained in:
Simon Warta 2020-09-21 11:20:49 +02:00
parent 72b573116a
commit ef944355f1
2 changed files with 21 additions and 3 deletions

View File

@ -133,13 +133,25 @@ function defaultTestSuite(rpcFactory: () => RpcClient, adaptor: Adaptor, expecte
const client = new Client(rpcFactory(), adaptor);
const status = await client.status();
// node info
expect(status.nodeInfo.protocolVersion).toEqual({
p2p: expected.p2pVersion,
block: expected.blockVersion,
app: expected.appVersion,
});
expect(status.nodeInfo.network).toMatch(chainIdMatcher);
expect(status.nodeInfo.other.size).toBeGreaterThanOrEqual(2);
expect(status.nodeInfo.other.get("tx_index")).toEqual("on");
expect(status.validatorInfo.pubkey).toBeTruthy();
expect(status.validatorInfo.votingPower).toBeGreaterThan(0);
// sync info
expect(status.syncInfo.catchingUp).toEqual(false);
expect(status.syncInfo.latestBlockHeight).toBeGreaterThanOrEqual(1);
// validator info
expect(status.validatorInfo.pubkey).toBeTruthy();
expect(status.validatorInfo.votingPower).toBeGreaterThan(0);
client.disconnect();
});
});
@ -239,7 +251,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, adaptor: Adaptor, expecte
header: jasmine.objectContaining({
version: {
block: expected.blockVersion,
app: 1,
app: expected.appVersion,
},
chainId: jasmine.stringMatching(chainIdMatcher),
}),

View File

@ -1,6 +1,8 @@
export interface ExpectedValues {
readonly appCreator: string;
readonly p2pVersion: number;
readonly blockVersion: number;
readonly appVersion: number;
}
export interface TendermintInstance {
@ -28,7 +30,9 @@ export const tendermintInstances: readonly TendermintInstance[] = [
version: "0.33.x",
expected: {
appCreator: "Cosmoshi Netowoko",
p2pVersion: 7,
blockVersion: 10,
appVersion: 1,
},
},
{
@ -36,7 +40,9 @@ export const tendermintInstances: readonly TendermintInstance[] = [
version: "0.34.x",
expected: {
appCreator: "Cosmoshi Netowoko",
p2pVersion: 8,
blockVersion: 11,
appVersion: 1,
},
},
];