Skip to content

Kong cli based test flow [Informal spec] #411

@murderteeth

Description

@murderteeth

Kong cli based test flow [Informal spec]

kong manual test flow based on cli:

  • [optional] setup new testcase under config/testcases
  • start kong using the new kong cli, for example bun run cli --testcase [testcasename] --fanout --refresh-rest-apis

cli is defined in package.json using concurrently

...
  "scripts": {
    ...
    "cli": "concurrently \"docker compose up -d redis\" \"docker compose up -d postgres\" \"cd packages/web && PORT=$${PORT:-3001} bun dev\" \"cd packages/ingest && bun dev\" \"sleep 6 && (cd packages/db && bun migrate up) && PGPASSWORD=password psql --host=localhost --port=5432 --username=user --dbname=user\" \"cd packages/cli bun main.ts\""
  },
...

notice at the end it calls packages/cli/main.ts. this is where the actual cli bootstraps and takes in parameters like --fanout. main.ts needs a simple way to know things like how to send a fanout job to redis, wait for it to finish, then refresh the rest cache. all logging goes to concurrently's single stdout.

users can use a separate terminal to do things like inspect the database using psql or a rest endpoint.

for example

PGPASSWORD=password psql -h localhost -U user -d user -c "
SELECT address, component
FROM output
WHERE label = 'yvusd-estimated-apr'
  AND block_time > NOW() - INTERVAL '7 days'
ORDER BY address, component;
"

or

curl -s http://localhost:3001/api/rest/snapshot/1/0x696d02Db93291651ED510704c9b286841d506987 \
  | jq '{
      vault: .performance.estimated,
      compounder: (
        .composition[]
        | select(.address | ascii_downcase == "0x0e297de4005883c757c9f09fdf7cf1363c20e626")
        | .performance.estimated
      )
    }'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions