Skip to content

Latest commit

 

History

History

README.md

aimeta — Tests

These tests cover deterministic output. Every assertion has a known correct answer that does not depend on LLM behaviour: compiler validation rules produce specific errors, REST handlers return exact bytes, CLI tier probing follows documented fallback logic, and the public API export shape is pinned. All suites complete in under two minutes end-to-end.

Suites

Suite Tests What it covers
tests/test.q 103 In-process: compiler validation rules, loader correctness, REST/qIPC handlers, ETag, golden-file regressions, performance, public API bind-check, init[] lifecycle (compile-on-boot, degradation chain, setlvl), IPC timeout config; delegates to test-cli.sh, test-rest.sh, and test-docs.sh as sub-suites
tests/test-samplerow.q 24 @sampleRow parser safety contract (17 must-reject cases: no arbitrary q execution) and positive type sanity checks
tests/test-cli.sh 27 CLI integration: kx-meta discover tier fallback (T1/T2/T3), -tables/-functions filters, compile subcommand, --check, --verbose, version, full compile → load → serve → discover pipeline
tests/test-rest.sh 26 HTTP surface: /meta, /openapi.json, /meta.schema.json, / (home doc), /.well-known/api-catalog — 200 + ETag, Content-Type, 304 conditional GET, 200 on mismatch, 404 on unknown path, 405 on POST, ETag format per RFC 7232, Linkset content-type
tests/test-docs.sh 10 Public API contract: use \kx.aimeta`export shape,init[]idempotency,compilereturn type,data[]/validateDirshapes,getTables/getFunctions/getReferencescolumn lists,docs/agent-guide.md` presence
tests/test-d3-automation.sh 8 D3 annotated-host: compile-on-boot, Tier 3 discovery, HTTP structure assertions (not byte-identity — D3 meta.json is gitignored), non-empty references[] path

Total: 198 tests

Prerequisites

  • q (kdb+) on $PATH — all suites
  • kx.ax installed at ~/.kx/mod/kx/ax — required by test.q, test-docs.sh, test-d3-automation.sh
  • kx.fusion installed under ~/.kx/mod/kx/ — required by the same suites
  • curl — required by test-rest.sh
  • python3 — required by test-cli.sh (bare-dot srcDir assertion)

See docs/install.md for the full development environment setup.

Running all tests

bash tests/run-tests.sh

Runs all suites (tests/test.q, test-samplerow.q, test-cli.sh, test-rest.sh, test-d3-automation.sh, test-docs.sh) in order and writes a self-contained HTML report to tests/reports/tests-<timestamp>.html. Exits 0 on all-pass, 1 on any failure.

Running individual suites

q tests/test.q
q tests/test-samplerow.q
bash tests/test-cli.sh
bash tests/test-rest.sh
bash tests/test-d3-automation.sh
bash tests/test-docs.sh

What a passing run looks like

=== aimeta Tests  ·  run 20260520-183213-22501 ===

  tests/test.q                                      PASS  (34s, 103 tests)
  tests/test-samplerow.q                            PASS  (1s, 24 tests)
  tests/test-cli.sh                                 PASS  (29s, 27 tests)
  tests/test-rest.sh                                PASS  (1s, 26 tests)
  tests/test-d3-automation.sh                       PASS  (4s, 8 tests)
  tests/test-docs.sh                                PASS  (0s, 10 tests)

=== 198 passed  0 failed  0 skipped  /  198 total  (100.0%)  in 1m 9s ===

Known failures

None at present. All tests are green.

Adding new tests

Shell suites (tests/test-cli.sh, tests/test-rest.sh, tests/test-docs.sh, test-d3-automation.sh): add a block following the existing pass/fail pattern. Test names are camelCase. Each block sets a local out variable, calls pass "name" on success or fail "name" "reason" on failure. The suite accumulates failures and exits 1 if any failed.

test.q: add a runTest[\name; {[] ... }]block. Signal failure with `` '"error message" `` — the runner catches it, marks the test failed, and continues. For golden-file assertions, add an expected.jsonundertests/golden/and callexpectGolden[name; actualBytes]`.

Reference implementations: tests/test-cli.sh, tests/test-d3-automation.sh