mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-08 00:44:06 +00:00
Add config for query limit in compare CLI (#175)
* Add config for query limit in compare CLI * Fix JSON stringify bigint for GQL query params * Take last N entity ids to compare in GQL
This commit is contained in:
@@ -3,13 +3,14 @@
|
||||
gqlEndpoint2 = "http://localhost:3008/graphql"
|
||||
|
||||
[queries]
|
||||
queryDir = "../graph-test-watcher/src/gql/queries"
|
||||
queryDir = "../../graph-test-watcher/src/gql/queries"
|
||||
names = []
|
||||
blockDelayInMs = 250
|
||||
queryLimits = {}
|
||||
|
||||
[watcher]
|
||||
configPath = "../../graph-test-watcher/environments/local.toml"
|
||||
entitiesDir = "../../graph-test-watcher/src/entity"
|
||||
entitiesDir = "../../graph-test-watcher/dist/entity/*"
|
||||
endpoint = "gqlEndpoint2"
|
||||
verifyState = true
|
||||
derivedFields = []
|
||||
|
||||
@@ -120,6 +120,14 @@ export const main = async (): Promise<void> => {
|
||||
let resultDiff = '';
|
||||
|
||||
if (fetchIds) {
|
||||
const queryLimit = config.queries.queryLimits[queryName];
|
||||
|
||||
if (queryLimit) {
|
||||
// Take only last `queryLimit` entity ids to compare in GQL.
|
||||
const idsLength = updatedEntityIds[index].length;
|
||||
updatedEntityIds[index].splice(0, idsLength - queryLimit);
|
||||
}
|
||||
|
||||
for (const id of updatedEntityIds[index]) {
|
||||
const { diff, result1: result } = await compareQuery(
|
||||
clients,
|
||||
|
||||
@@ -36,6 +36,7 @@ interface QueryConfig {
|
||||
queryDir: string;
|
||||
names: string[];
|
||||
blockDelayInMs: number;
|
||||
queryLimits: { [queryName: string]: number }
|
||||
}
|
||||
|
||||
interface EntityDerivedFields {
|
||||
|
||||
Reference in New Issue
Block a user