Move config to testutil.spec.ts
This commit is contained in:
parent
6dcb87aa90
commit
0d4d71471d
@ -1,58 +0,0 @@
|
||||
export interface ExpectedValues {
|
||||
/** The Tendermint version as reported by Tendermint itself */
|
||||
readonly version: string;
|
||||
readonly appCreator: string;
|
||||
readonly p2pVersion: number;
|
||||
readonly blockVersion: number;
|
||||
readonly appVersion: number;
|
||||
}
|
||||
|
||||
export interface TendermintInstance {
|
||||
readonly url: string;
|
||||
readonly version: string;
|
||||
/** rough block time in ms */
|
||||
readonly blockTime: number;
|
||||
/** Values we expect in the backend */
|
||||
readonly expected: ExpectedValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tendermint instances to be tested.
|
||||
*
|
||||
* Testing different versions: as a convention, the minor version number is encoded
|
||||
* in the port 111<version>, e.g. Tendermint 0.21.0 runs on port 11121. To start
|
||||
* a specific version use:
|
||||
* TENDERMINT_VERSION=0.29.2 TENDERMINT_PORT=11129 ./scripts/tendermint/start.sh
|
||||
*
|
||||
* When more than 1 instances of tendermint are running, stop them manually:
|
||||
* docker container ls | grep tendermint/tendermint
|
||||
* docker container kill <container id from 1st column>
|
||||
*/
|
||||
export const tendermintInstances: readonly TendermintInstance[] = [
|
||||
{
|
||||
url: "localhost:11133",
|
||||
version: "0.33.x",
|
||||
blockTime: 1000,
|
||||
expected: {
|
||||
version: "0.33.8",
|
||||
appCreator: "Cosmoshi Netowoko",
|
||||
p2pVersion: 7,
|
||||
blockVersion: 10,
|
||||
appVersion: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
url: "localhost:11134",
|
||||
version: "0.34.x",
|
||||
blockTime: 500,
|
||||
expected: {
|
||||
version: "182fa32", // srsly?
|
||||
appCreator: "Cosmoshi Netowoko",
|
||||
p2pVersion: 8,
|
||||
blockVersion: 11,
|
||||
appVersion: 1,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export const defaultInstance: TendermintInstance = tendermintInstances[0];
|
||||
@ -5,14 +5,15 @@ import { sleep } from "@cosmjs/utils";
|
||||
import { ReadonlyDate } from "readonly-date";
|
||||
import { Stream } from "xstream";
|
||||
|
||||
import { ExpectedValues, tendermintInstances } from "../config.spec";
|
||||
import { HttpClient, RpcClient, WebsocketClient } from "../rpcclients";
|
||||
import {
|
||||
buildKvTx,
|
||||
chainIdMatcher,
|
||||
ExpectedValues,
|
||||
pendingWithoutTendermint,
|
||||
randomString,
|
||||
tendermintEnabled,
|
||||
tendermintInstances,
|
||||
tendermintSearchIndexUpdated,
|
||||
} from "../testutil.spec";
|
||||
import { Adaptor } from "./adaptor";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { defaultInstance } from "../config.spec";
|
||||
import { createJsonRpcRequest } from "../jsonrpc";
|
||||
import { defaultInstance } from "../testutil.spec";
|
||||
import { HttpClient } from "./httpclient";
|
||||
|
||||
function pendingWithoutTendermint(): void {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { defaultInstance } from "../config.spec";
|
||||
import { createJsonRpcRequest } from "../jsonrpc";
|
||||
import { defaultInstance } from "../testutil.spec";
|
||||
import { HttpClient } from "./httpclient";
|
||||
import { instanceOfRpcStreamingClient } from "./rpcclient";
|
||||
import { WebsocketClient } from "./websocketclient";
|
||||
|
||||
@ -2,8 +2,8 @@ import { Uint53 } from "@cosmjs/math";
|
||||
import { toListPromise } from "@cosmjs/stream";
|
||||
import { Stream } from "xstream";
|
||||
|
||||
import { defaultInstance } from "../config.spec";
|
||||
import { createJsonRpcRequest } from "../jsonrpc";
|
||||
import { defaultInstance } from "../testutil.spec";
|
||||
import { SubscriptionEvent } from "./rpcclient";
|
||||
import { WebsocketClient } from "./websocketclient";
|
||||
|
||||
|
||||
@ -5,14 +5,15 @@ import { sleep } from "@cosmjs/utils";
|
||||
import { ReadonlyDate } from "readonly-date";
|
||||
import { Stream } from "xstream";
|
||||
|
||||
import { ExpectedValues, tendermintInstances } from "../config.spec";
|
||||
import { HttpClient, RpcClient, WebsocketClient } from "../rpcclients";
|
||||
import {
|
||||
buildKvTx,
|
||||
chainIdMatcher,
|
||||
ExpectedValues,
|
||||
pendingWithoutTendermint,
|
||||
randomString,
|
||||
tendermintEnabled,
|
||||
tendermintInstances,
|
||||
tendermintSearchIndexUpdated,
|
||||
} from "../testutil.spec";
|
||||
import { adaptor34 } from "./adaptors";
|
||||
|
||||
@ -1,6 +1,65 @@
|
||||
import { toAscii } from "@cosmjs/encoding";
|
||||
import { sleep } from "@cosmjs/utils";
|
||||
|
||||
export interface ExpectedValues {
|
||||
/** The Tendermint version as reported by Tendermint itself */
|
||||
readonly version: string;
|
||||
readonly appCreator: string;
|
||||
readonly p2pVersion: number;
|
||||
readonly blockVersion: number;
|
||||
readonly appVersion: number;
|
||||
}
|
||||
|
||||
export interface TendermintInstance {
|
||||
readonly url: string;
|
||||
readonly version: string;
|
||||
/** rough block time in ms */
|
||||
readonly blockTime: number;
|
||||
/** Values we expect in the backend */
|
||||
readonly expected: ExpectedValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tendermint instances to be tested.
|
||||
*
|
||||
* Testing different versions: as a convention, the minor version number is encoded
|
||||
* in the port 111<version>, e.g. Tendermint 0.21.0 runs on port 11121. To start
|
||||
* a specific version use:
|
||||
* TENDERMINT_VERSION=0.29.2 TENDERMINT_PORT=11129 ./scripts/tendermint/start.sh
|
||||
*
|
||||
* When more than 1 instances of tendermint are running, stop them manually:
|
||||
* docker container ls | grep tendermint/tendermint
|
||||
* docker container kill <container id from 1st column>
|
||||
*/
|
||||
export const tendermintInstances: readonly TendermintInstance[] = [
|
||||
{
|
||||
url: "localhost:11133",
|
||||
version: "0.33.x",
|
||||
blockTime: 1000,
|
||||
expected: {
|
||||
version: "0.33.8",
|
||||
appCreator: "Cosmoshi Netowoko",
|
||||
p2pVersion: 7,
|
||||
blockVersion: 10,
|
||||
appVersion: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
url: "localhost:11134",
|
||||
version: "0.34.x",
|
||||
blockTime: 500,
|
||||
expected: {
|
||||
version: "182fa32", // srsly?
|
||||
appCreator: "Cosmoshi Netowoko",
|
||||
p2pVersion: 8,
|
||||
blockVersion: 11,
|
||||
appVersion: 1,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export const defaultInstance: TendermintInstance = tendermintInstances[0];
|
||||
|
||||
export const chainIdMatcher = /^[-a-zA-Z0-9]{3,30}$/;
|
||||
|
||||
export function tendermintEnabled(): boolean {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user