Skip to content

chore: Add functional tests for Kibana API commands #219

Description

@margaretjgu

Context

#195 introduced the elastic kb command group with 48 API namespaces generated from the Kibana OpenAPI spec. The implementation is covered by 20 unit tests for the KibanaClient layer and was validated E2E manually against Kibana 9.3.3 (data-views CRUD, alerting rules, connectors).

There are currently no automated functional tests (integration-level) for KB commands, unlike the ES side which generates bash tests from YAML fixtures.

What needs to happen

1. CI infrastructure

  • Add a Kibana Docker container to the Buildkite pipeline (Kibana requires ES to be running first)
  • Configure auth (reuse ES credentials with basic auth) and wait-for-ready health check (/api/status)

2. Hand-authored functional tests

  • Write bash functional tests for a representative subset of KB namespaces:
    • data-views: create, get, list, delete
    • spaces: create, get, list, delete
    • alerting: create rule, find rules, delete rule
    • connectors: list connector types, create connector, delete connector
    • saved-objects: export, import
  • Tests should follow the same set -euo pipefail + elastic --json + jq assertion pattern used by ES functional tests

3. Known issues to account for

  • Some generated commands have required params that should be optional (e.g. spaces get-spaces-space requires include_authorized_purposes) -- these are codegen issues to fix in elastic-client-generator-js before testing
  • Kibana API ordering dependencies are more complex than ES (e.g. connectors need a valid type, alerting rules need a valid rule type and action)

Out of scope (for now)

  • Auto-generating KB functional tests from a machine-readable spec (Kibana doesn't publish YAML test fixtures like ES does)
  • Full coverage of all 48 namespaces -- start with the 5 listed above, expand over time

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions