/glean-connector-builder:connector-testingfrom glean-connector-builder
Runs a connector through mock, integration/cache, and live end-to-end test phases using glean.indexing.testing SDK utilities. Validates document types and permissions across all phases.
Ships in glean-connector-builder. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use this skill after implementing or changing a connector. Exercise the connector with the public SDK testing layer under src/glean/indexing/testing/; do not test the SDK testing layer itself.
tests/ directory while using this skill. Those tests validate the SDK implementation and belong to SDK-maintainer CI, not the connector-building workflow.glean.indexing.testing, including TestHarness, TestConfig, static data clients, MockGleanClient, and run_connector.GLEAN_SERVER_URL / GLEAN_INSTANCE target and confirm with the user before proceeding. Live uploads can finalize replacement state and stale-delete documents omitted by a bounded crawl, so use only a disposable datasource. Only call run_end_to_end(confirm=True, allow_destructive=True) / run_end_to_end_async(confirm=True, allow_destructive=True) after both conditions are satisfied..env file if identified, to determine whether source and Glean credentials are present..env, or include recorded source data.Use these SDK files and their public exports:
src/glean/indexing/testing/harness/harness.py: TestHarnesssrc/glean/indexing/testing/harness/config.py: TestConfig, ClientConfigsrc/glean/indexing/testing/data_clients.py: static sync, streaming, and async clientssrc/glean/indexing/testing/mock_client.py: MockGleanClientsrc/glean/indexing/testing/runner.py: run_connector, run_connector_asyncsrc/glean/indexing/testing/harness/cache/: source recording and replaysrc/glean/indexing/testing/harness/permissions.py: permission-payload assertionssrc/glean/indexing/testing/validation.py: deterministic connector-output validationsrc/glean/indexing/push/status.py: shared one-shot and polling status checksEach phase is available from the CLI as well as from Python. Use the CLI when you just need the phase run and reported; use the harness directly when you need to assert on the returned client.
glean-idx test --phase mock # or integration, live
glean-idx test --phase all # every phase in order
--phase all stops at the first failure and skips any phase that cannot run,
reporting which. --max-items N caps what each data client yields.
Use static test data representative of every connector output type. Run:
glean-idx test --phase mock
or, to assert on the result:
harness.run_full_mock()
This phase must not call the source or Glean. Inspect the returned MockGleanClient for emitted documents, users, groups, memberships, and employees. Deterministic output validation runs automatically.
Register the connector's real source clients in TestHarness.clients, keep Glean mocked, and run:
glean-idx test --phase integration # add --refresh-cache to re-record
or, to assert on the result:
harness.run_integration_test()
The CLI discovers the connector's data clients by type, so TestHarness.clients
does not have to be spelled out when running it that way.
This phase fetches a bounded source sample on a cache miss and records it locally; later runs replay the cache. Verify source parsing, transformation, document counts, and permission payloads without calling Glean.
Use run_integration_test_async() for async streaming connectors.
Production safety: this phase uploads real documents to whichever Glean instance
GLEAN_SERVER_URL(orGLEAN_INSTANCE) resolves to, and there is no automated cleanup. Before running it, state the resolved target and confirm with the user before proceeding. See Cleaning up after a live run below for how to remove what it uploads.
The built-in live phase is document-only. It rejects people connectors and datasource connectors that override get_identities(), because the document cleanup command cannot restore replaced employee, user, group, or membership data. Validate those outputs with mock/integration tests or a purpose-built live smoke test with explicit identity cleanup.
Run only when source credentials and GLEAN_INDEXING_API_TOKEN plus GLEAN_SERVER_URL or GLEAN_INSTANCE are available:
glean-idx test --phase live --allow-destructive-live
This prompts for confirmation (showing the resolved target) unless --yes is passed. --yes only skips the prompt; it does not replace the required --allow-destructive-live acknowledgement. The CLI carries the confirmed target into the harness, which refuses to upload if the configured target changes before live execution.
or, to assert on the result:
harness.run_end_to_end(confirm=True, allow_destructive=True)
confirm=True confirms the target. The separate allow_destructive=True acknowledges replacement finalization and possible stale deletion; without it the harness raises UnsafeLiveEndToEndRunError. Use run_end_to_end_async() for async streaming connectors. This phase uses the current bounded source client and real Glean APIs; it never reads or writes integration fixtures.
After upload, the harness waits for normal indexing, requests processalldocuments once when needed, ignores a rate-limit response from that request, and polls status for a bounded period. If the result is PENDING, tell the user:
Source data was pulled successfully, and Glean accepted the document upload without validation errors. The documents are queued for asynchronous indexing, which may take longer.
Then determine the next step from the confirmed connector plan and ask whether they want to proceed. Do not treat pending asynchronous indexing as connector failure or generate connector-specific processing code.
If live credentials are unavailable, explicitly report that the live phase was skipped. Full-mock and integration results do not prove that Glean accepted or indexed the documents.
For checking document status during testing, use glean-idx document status --datasource <datasource> --document <object-type> <document-id> --poll; omit --poll for an ad-hoc single check. Repeat --document <object-type> <document-id> to check multiple documents.
When a document uploaded but never became searchable, glean-idx document events --datasource <datasource> --object-type <type> --id <id> shows its lifecycle, and glean-idx datasource status --datasource <datasource> compares uploaded against indexed counts.
A live end-to-end run has no automated cleanup. On success, the harness logs a glean-idx document delete --datasource <name> --document <object-type> <id> ... command naming every document it just uploaded -- run that command (or PushUploader.delete_document(...) from Python) to remove them. Do this whenever the live phase ran against anything other than a disposable test datasource.
After the selected phases finish, report:
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub gleanwork/glean-indexing-sdk --plugin glean-connector-builder8 skills in this plugin
/connector-api-explorationExplore third-party datasource API docs and read-only endpoints for a Glean Indexing SDK connector. Use before connector planning or generation to produce a cited API inventory and source investigation./connector-authPlan source API authentication for Glean Indexing SDK connectors. Use during connector planning and implementation to separate API-exploration credentials from production connector auth./connector-builderBuild Glean Indexing SDK connectors from source-system documentation. Use when planning, generating, validating, or evaluating a custom connector built with the Glean Indexing SDK./connector-deploymentPlan and operate customer-hosted deployment for Glean Indexing SDK connectors using glean-idx deploy. Use when the user wants deployment artifacts, cloud secrets, Kubernetes CronJobs, logs, status, or teardown for a generated connector./connector-observabilityPlan and implement logging, metrics, and evaluation visibility for Glean Indexing SDK connectors. Use when wiring connector runtime observability or deciding what to verify after a connector run./connector-pullImplement source-side pull logic for Glean Indexing SDK connectors. Use after API exploration when writing data clients that fetch from third-party APIs.Other plugins' skills for the same job