Repository navigation
Start the UniFi OS test controller from the tests with Testcontainers - #26
Open
ChrisonSimtian wants to merge 8 commits into
Open
ChrisonSimtian wants to merge 8 commits into
ChrisonSimtian wants to merge 8 commits into
Conversation
UnifiNetwork models about 12 of a live network's ~63 fields and
rest/networkconf/{id} is a full replacement, so a typed update would reset
the rest. Add ListNetworksRawAsync, GetNetworkRawAsync (exactly one row or
throw) and ReplaceNetworkRawAsync (body sent verbatim) over JsonObject, and
NetworkDhcpDns to read or change only dhcpd_dns_enabled and dhcpd_dns_1..4.
There is deliberately no UpdateNetworkAsync(UnifiNetwork).
UnifiLegacySession gains an internal handler seam so unit tests can assert
the bytes on the wire.
Creates a scratch network, writes DHCP DNS through NetworkDhcpDns.With, asserts only the DNS keys moved, restores the saved object and asserts every key matches its JSON text, and checks no other network changed. Skips without UNIFI_LEGACY_BASE_URL + UNIFI_USERNAME + UNIFI_PASSWORD and refuses any host but localhost / 127.0.0.1 / ::1.
The legacy write tests now share one container per run, started from the compose.yml image and settings, set up through /api/setup and removed at the end. They read no UNIFI_* variable, so they cannot reach a real console. They skip when no container runtime is reachable, or with UNIFISHARP_SKIP_CONTAINER_TESTS=1. Refs #25
…l daemon only The readiness probe now logs in once and reuses the session, re-logging in only on 401 and backing off on 429; the shared session's logins (initial and 401 re-login) go through the same backoff. The image is pinned to 5.0.8 by digest. A remote Docker endpoint or non-loopback host override fails the run instead of starting a SYS_ADMIN container elsewhere. A refused first-run setup is surfaced, and cancellation during start reports the last probe status. UNIFISHARP_SKIP_CONTAINER_TESTS accepts 1/true/yes and rejects typos.
This branch has not been deployed
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.
dotnet testnow starts its own UniFi OS controller, runs the legacy write tests against it, and removes it afterwards. Stacked on #24 (raw network JSON).What changed
UnifiContainerFixture: one shared container per run on a random port, same settings as.containers/unifi/compose.yml, image pinned by tag and digest; first-run admin setup and readiness waitUNIFISHARP_SKIP_CONTAINER_TESTS(1/true/yes) opts out~/.testcontainers.properties, setDOCKER_HOSTVerification
Full suite against OrbStack: 115 passed, 7 skipped (env-gated read-only live tests), 0 failed; about 75 s to boot. No test container or Ryuk container left afterwards. CI is untested: the first boot downloads Ubiquiti's installer.
Closes #25