Container Registration Testing (test)

Use test when you want an explicit registration validation run against a mock config-hub.

Command

npx worker-cli test <worker-dir> <image-name>

Example:

npx worker-cli test ./workers/opc-reader registry.example.com/myteam/opc-reader:1.4.2

What happens

  1. Starts local mock hub HTTP service.
  2. Runs your container with test runtime env vars.
  3. Waits for worker registration payloads.
  4. Reads registration box versions.
  5. Fails if versions differ from worker project version.
  6. Validates each registration document against the SDK contract (see below).

Registration schema validation

Each registration payload is validated against the SDK contract (sdk/typescript/src/flowbox-registration-info.ts, FlowBoxRegistrationInfo). The mock hub still answers HTTP 200; failures are enforced CLI-side.

Hard errors (test fails with exit code 1; during build this fails the build):

  • id, displayName, currentVersion, icon, agent, workerId, workerDataConnectionString must be strings
  • type must be source, sink, or pipe
  • ioInterfaces.inputs and ioInterfaces.outputs must be arrays; each entry needs name (string) and supportedFormats (array of json or msgpack)
  • uiConfig must contain defaultOptions and implementation keys
  • documentation, when present, must have summary, brief, and detail strings

Warnings (do not fail):

  • id doesn't follow the lowercase prefix/name convention
  • documentation is missing

Unknown extra fields are ignored (forward compatibility).

Key tuning variables

CONFIG_HUB_MOCK_PORT=3120
MOCK_HUB_HOST_IP=172.17.0.1
TIMEOUT=60

Troubleshooting example

If a worker never registers:

# try explicit host IP and longer timeout
MOCK_HUB_HOST_IP=172.17.0.1 TIMEOUT=90 npx worker-cli test ./workers/opc-reader registry.example.com/myteam/opc-reader:1.4.2

[NOTE!lightbulb/ROLE BOUNDARIES] This validates container-to-hub registration/version behavior and the registration document structure against the SDK contract. It does not validate your business payload correctness or protocol-specific output semantics.

References

  • sdk/worker/repo-management/src/commands/test-container.ts
  • sdk/worker/repo-management/src/lib/mock-hub.ts
  • sdk/worker/repo-management/src/lib/registration-schema.ts