Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

test-and-fix-connector

БесплатноБез исполняемых скриптовНе проверен

Single step only: run the per-source pytest suite, diagnose failures, and fix the connector or simulator until everything passes. Branches on…

databrickslabsот databrickslabs★ 74 звезды на GitHub

Об этом скилле

Test and Fix the Connector

Goal

Validate the {{source_name}} connector by running its pytest suite and applying minimal fixes until everything passes. The skill operates in one of two modes; the invocation prompt tells you which.

Mode When Inputs Diagnostic posture
simulate Phase 1 (/develop-connector) Connector + endpoints.yaml exist; no creds Either the connector or the simulator spec/corpus could be wrong — judge each failure on the merits
record Phase 2 (/validate-connector) Live creds; cassette and live validator are authoritative Live-validator drift is the primary signal — prefer fixing the simulator spec/corpus over the connector

Read the mode you were given and follow only the sections marked for it.

0. Rules (both modes)

  • Write tests first, then run. Do NOT run exploratory scripts (e.g. python -c "...", which python, import checks) before the test file exists. Read the implementation source and reference test — that is sufficient.
  • Run pytest synchronously — never in background. Do not use sleep, poll loops, ps aux | grep pytest, wc -l, or tail on output files. Run pytest ... directly and block until it completes.
  • Only run standalone scripts to isolate a specific failing HTTP call after pytest has already failed and pointed to the problem.

1. Setup Test Files (both modes — skip if file already exists)

Create tests/unit/sources/{source_name}/test_{source_name}_lakeflow_connect.py. Always follow tests/unit/sources/example/test_example_lakeflow_connect.py as the primary example — it shows the correct pattern: subclass LakeflowConnectTests, set connector_class, set simulator_source = "{source_name}", set replay_config = {...} with stand-in credentials, and pass a small sample_records (e.g. 5).

Partitioned Connector Tests

If the connector implements SupportsPartition or SupportsPartitionedStream (check the connector class definition for these mixins), the test class must also inherit from SupportsPartitionedStreamTests alongside LakeflowConnectTests.

Write-back Tests (opt-in)

Write-back tests live in a separate mixin (tests/unit/sources/test_write_back_suite.LakeflowConnectWriteBackTests) and require CONNECTOR_TEST_MODE=live against a real source. Do not mix it in for read-only connectors — the default LakeflowConnectTests is enough. Write-back support is set up in a different step (see write-back-testing skill).


SIMULATE MODE

You're in this mode when the invocation says mode=simulate. Skip this whole section if you're in record mode.

S1. Confirm Inputs

Verify these exist before running anything:

  • src/databricks/labs/community_connector/sources/{source_name}/{source_name}.py
  • src/databricks/labs/community_connector/source_simulator/specs/{source_name}/endpoints.yaml

If endpoints.yaml is missing, that's a connector-dev defect — report and stop. Do not author it yourself.

S2. Bootstrap the Corpus from TABLE_SCHEMAS

source .venv/bin/activate 2>/dev/null || (python3.10 -m venv .venv && source .venv/bin/activate && pip install -e ".[dev]" -q)

Then synthesize a corpus from the connector's Spark schemas:

python -c "
from pathlib import Path
from databricks.labs.community_connector.sources.{source_name}.{source_name} import {SourceName}LakeflowConnect
from databricks.labs.community_connector.source_simulator.tools.corpus_from_schema import write_corpus_from_schemas
connector = {SourceName}LakeflowConnect({{...stand-in creds matching test class replay_config...}})
write_corpus_from_schemas(
    connector=connector,
    output_dir=Path('src/databricks/labs/community_connector/source_simulator/specs/{source_name}/corpus'),
    records_per_table=5,
)
"

Records are shape-correct but synthetic. They're enough for shape-level tests; record mode replaces them with real data later.

S3. Run Simulate-Mode Tests

pytest tests/unit/sources/{source_name}/ -v

No CONNECTOR_TEST_MODE env var (default = simulate). No credentials, no network.

S4. Diagnose and Fix

Failures in simulate mode could mean:

  • Connector bug — wrong method signature, malformed request shape, off-by-one in pagination logic, schema mismatch with what read_table actually yields.
  • Spec bug — endpoints.yaml declares wrong wrapper.records_key, wrong pagination_style, missing param role, or missing endpoint.
  • **C
Полный SKILL.md на GitHub

Установить test-and-fix-connector в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл test-and-fix-connector?

Single step only: run the per-source pytest suite, diagnose failures, and fix the connector or simulator until everything passes. Branches on mode={simulate|record}. Do NOT use for full connector creation — use the create-connector agent instead.

Как установить скилл test-and-fix-connector?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл test-and-fix-connector запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить test-and-fix-connector с