Add HTTP shared-tenancy broker variant for tests.#1245
Open
floitsch wants to merge 2 commits into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Shared config:
HTTP test broker server:
Tests: