Skip to content

Start the UniFi OS test controller from the tests with Testcontainers #25

Open

Description

@ChrisonSimtian

Problem

The legacy write tests need a local UniFi OS controller, started by hand with .containers/unifi/bootstrap.sh and wired in through environment variables. Without it they skip, so nobody runs them by default.

Outcome

dotnet test starts the controller itself, runs the legacy write tests against it, and removes it afterwards. The write tests can never reach a real console.

Acceptance criteria

  • A shared xunit fixture (Testcontainers for .NET) builds the container from the same image and settings as .containers/unifi/compose.yml (including cgroup: host and its capabilities), waits until the legacy API answers, and creates the first-run admin
  • The legacy live tests take their base URL and credentials from the fixture, not from environment variables; the fixture only ever points at its own container
  • The tests skip with a clear reason when no container runtime is available, and an opt-out variable skips them on purpose
  • The container is reused across test classes and removed at the end of the run
  • The byte-identical network write test from Read and replace a network as raw JSON #24 runs through the fixture
  • README explains local use and what CI needs

Notes

  • No Testcontainers module for UniFi exists; use the generic container builder.
  • Stacked on Read and replace a network as raw JSON #24 (raw network JSON). CI is a separate question: the first boot downloads Ubiquiti's installer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions