Skip to content

Commit

Permalink
Use default demo credentials (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaspence authored Feb 28, 2023
1 parent f475b21 commit 96ab08d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 38 deletions.
18 changes: 3 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
23 changes: 1 addition & 22 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
services:
unifi:
image: "jacobalberty/unifi:${UNIFI_VERSION:?}"
image: "jacobalberty/unifi:${UNIFI_VERSION:-latest}"
init: true
restart: "always"
user: "unifi"
Expand All @@ -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
1 change: 0 additions & 1 deletion scripts/init.d/demo-mode
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 96ab08d

Please sign in to comment.