Skip to content

Add HTTP shared-tenancy broker variant for tests.#1245

Open
floitsch wants to merge 2 commits into
floitsch/build-artemis-service.s-new.090from
floitsch/build-artemis-service.s-new.091
Open

Add HTTP shared-tenancy broker variant for tests.#1245
floitsch wants to merge 2 commits into
floitsch/build-artemis-service.s-new.090from
floitsch/build-artemis-service.s-new.091

Conversation

@floitsch

Copy link
Copy Markdown
Member

Mirrors the BrokerCliSupabase shared-tenancy path so the HTTP test broker can exercise the cross-table auth-side write that production shared-tenancy deployments rely on.

CLI:

  • BrokerCliHttpShared (subclass of BrokerCliHttp) overrides notify-created to send _hardware_id and _organization_id alongside _device_id/_state on the wire.
  • BrokerCli factory dispatches HTTP + TENANCY-SHARED to the shared variant; other HTTP configs keep the dedicated path.

Shared config:

  • ServerConfigHttp gains a 'with --tenancy/string' clone, matching the Supabase variant.

HTTP test broker server:

  • Stores auth-side device records in auth-devices_ when notify-created carries the extra fields. Rejects duplicate hardware-ids.
  • Exposes get-auth-device + insert-auth-device for the backdoor.

Tests:

  • with-broker recognizes 'http-toit-shared'; with-http-broker takes an optional --tenancy to opt into shared mode.
  • ToitHttpBackdoor carries the scoped ServerConfigHttp and mirrors the shared-tenancy auth-side insert in its create-device backdoor.
  • broker-test.toit asserts auth-side records are populated when running under http-toit-shared.
  • CMakeLists.txt adds --http-toit-shared-broker to BROKER_FLAGS so all BROKER tests exercise the shared HTTP variant.

floitsch added 2 commits May 23, 2026 19:05
Mirrors the BrokerCliSupabase shared-tenancy path so the HTTP test
broker can exercise the cross-table auth-side write that production
shared-tenancy deployments rely on.

CLI:
- BrokerCliHttpShared (subclass of BrokerCliHttp) overrides
  notify-created to send _hardware_id and _organization_id alongside
  _device_id/_state on the wire.
- BrokerCli factory dispatches HTTP + TENANCY-SHARED to the shared
  variant; other HTTP configs keep the dedicated path.

Shared config:
- ServerConfigHttp gains a 'with --tenancy/string' clone, matching the
  Supabase variant.

HTTP test broker server:
- Stores auth-side device records in auth-devices_ when notify-created
  carries the extra fields. Rejects duplicate hardware-ids.
- Exposes get-auth-device + insert-auth-device for the backdoor.

Tests:
- with-broker recognizes 'http-toit-shared'; with-http-broker takes an
  optional --tenancy to opt into shared mode.
- ToitHttpBackdoor carries the scoped ServerConfigHttp and mirrors the
  shared-tenancy auth-side insert in its create-device backdoor.
- broker-test.toit asserts auth-side records are populated when running
  under http-toit-shared.
- CMakeLists.txt adds --http-toit-shared-broker to BROKER_FLAGS so all
  BROKER tests exercise the shared HTTP variant.
Replace the three separate 'with --host', 'with --scope', 'with --tenancy'
overloads (per subclass) with a single 'with' that takes all updatable
fields as optional. Non-null params override 'this.field', null params
inherit it. Matches the FleetFile.with pattern already used elsewhere in
the codebase.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant