From d02faeb871a8e23c53d6c07d818f33d6a47a4a17 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Wed, 1 Mar 2023 00:22:09 +1100 Subject: [PATCH] Use default demo credentials (#320) --- Makefile | 18 +++--------------- docker-compose.yaml | 23 +---------------------- scripts/init.d/demo-mode | 1 - 3 files changed, 4 insertions(+), 38 deletions(-) diff --git a/Makefile b/Makefile index 3cb1f89..0621906 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,3 @@ -export UNIFI_VERSION ?= latest -export UNIFI_USERNAME ?= tfacctest -export UNIFI_EMAIL ?= tfacctest@example.com -export UNIFI_PASSWORD ?= tfacctest1234 - TEST ?= ./... TESTARGS ?= TEST_COUNT ?= 1 @@ -16,19 +11,12 @@ build: .PHONY: testacc testacc: - TF_ACC=1 UNIFI_ACC_WLAN_CONCURRENCY=3 UNIFI_API=https://localhost:8443 UNIFI_INSECURE=true go test $(TEST) -v -count=$(TEST_COUNT) $(TESTARGS) + TF_ACC=1 UNIFI_ACC_WLAN_CONCURRENCY=3 UNIFI_API=https://localhost:8443 UNIFI_INSECURE=true UNIFI_USERNAME=admin UNIFI_PASSWORD=admin go test $(TEST) -v -count=$(TEST_COUNT) $(TESTARGS) .PHONY: testacc-up testacc-up: - docker-compose up --detach unifi - - @echo -n "Waiting for container" - @until test -n "$$(docker ps --filter id=$$(docker-compose ps --quiet unifi) --filter health=healthy --quiet)"; do echo -n .; sleep 1; done - @echo - - @echo "Bootstrapping Unifi controller" - docker-compose up --abort-on-container-exit bootstrap + docker compose up --detach --wait .PHONY: testacc-down testacc-down: - docker-compose down + docker compose down diff --git a/docker-compose.yaml b/docker-compose.yaml index 520a78c..8cb2f8b 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,7 +1,7 @@ --- services: unifi: - image: "jacobalberty/unifi:${UNIFI_VERSION:?}" + image: "jacobalberty/unifi:${UNIFI_VERSION:-latest}" init: true restart: "always" user: "unifi" @@ -10,24 +10,3 @@ services: - "${UNIFI_HTTPS_PORT:-8443}:8443/tcp" volumes: - "./scripts/init.d:/usr/local/unifi/init.d:ro" - - bootstrap: - image: "alpine/httpie" - depends_on: - unifi: - condition: "service_healthy" - entrypoint: "/bin/sh" - command: - - "-c" - - | - alias http='http --quiet --check-status --verify=no --ignore-stdin' - - http https://unifi:8443/manage/account/login 2>/dev/null - case $$? in - 0) echo 'Unifi controller has already been setup' >&2; exit 0;; - 3) echo 'Bootstrapping Unifi controller';; - *) echo 'Unexpected HTTP response from Unifi controller' >&2; exit 1;; - esac - - http https://unifi:8443/api/cmd/sitemgr cmd=add-default-admin "name=${UNIFI_USERNAME:?}" "email=${UNIFI_EMAIL:?}" "x_password=${UNIFI_PASSWORD:?}" - http https://unifi:8443/api/cmd/system cmd=set-installed diff --git a/scripts/init.d/demo-mode b/scripts/init.d/demo-mode index 4148c16..cd70c1a 100755 --- a/scripts/init.d/demo-mode +++ b/scripts/init.d/demo-mode @@ -4,7 +4,6 @@ write_config() { echo "${1}=${2}" >> /usr/lib/unifi/data/system.properties } -write_config demo.skip_wizard false write_config is_simulation true # Increase the number of demo devices to allow more concurrent tests to be executed simultaneously.