Add testing to controller script
This commit is contained in:
5
.gitattributes
vendored
5
.gitattributes
vendored
@@ -1,5 +1,9 @@
|
||||
* text=auto
|
||||
|
||||
*.go diff=golang
|
||||
|
||||
*.sh eol=lf
|
||||
|
||||
*.jar binary
|
||||
*.wt binary
|
||||
*.bson binary
|
||||
@@ -11,4 +15,3 @@ WiredTiger eol=lf
|
||||
WiredTiger.lock eol=lf
|
||||
WiredTiger.turtle eol=lf
|
||||
|
||||
*.go diff=golang
|
||||
|
||||
2
.github/workflows/go.yml
vendored
2
.github/workflows/go.yml
vendored
@@ -19,7 +19,7 @@ jobs:
|
||||
# TODO: convert this to `services`
|
||||
- name: Start Unifi controller
|
||||
run: |
|
||||
./controller.sh
|
||||
./controller.sh start
|
||||
|
||||
- name: Get dependencies
|
||||
run: |
|
||||
|
||||
@@ -1,20 +1,43 @@
|
||||
#! /bin/bash
|
||||
|
||||
set -eou pipefail
|
||||
|
||||
# Local Administrator
|
||||
# Username: tfacctest
|
||||
# Password: tfacctest1234
|
||||
# Email: tfacctest@example.com
|
||||
|
||||
docker run --rm --init -d \
|
||||
-p 8080:8080 \
|
||||
-p 8443:8443 \
|
||||
-p 3478:3478/udp \
|
||||
-p 10001:10001/udp \
|
||||
-e TZ='America/New_York' \
|
||||
-v $(pwd)/testdata/unifi:/unifi \
|
||||
--name unifi \
|
||||
jacobalberty/unifi:stable
|
||||
if test $# -eq 0; then
|
||||
echo "please specify either 'start' or 'test'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Waiting for login page..."
|
||||
timeout 300 bash -c 'while [[ "$(curl --insecure -s -o /dev/null -w "%{http_code}" https://localhost:8443/manage/account/login)" != "200" ]]; do sleep 5; done'
|
||||
echo "Controller running."
|
||||
case "$1" in
|
||||
"start")
|
||||
docker run --rm --init -d \
|
||||
-p 8080:8080 \
|
||||
-p 8443:8443 \
|
||||
-p 3478:3478/udp \
|
||||
-p 10001:10001/udp \
|
||||
-e TZ='America/New_York' \
|
||||
-v $(pwd)/testdata/unifi:/unifi \
|
||||
--name unifi \
|
||||
jacobalberty/unifi:stable
|
||||
|
||||
echo "Waiting for login page..."
|
||||
timeout 300 bash -c 'while [[ "$(curl --insecure -s -o /dev/null -w "%{http_code}" https://localhost:8443/manage/account/login)" != "200" ]]; do sleep 5; done'
|
||||
echo "Controller running."
|
||||
;;
|
||||
"test")
|
||||
TF_ACC=1 \
|
||||
UNIFI_USERNAME=tfacctest \
|
||||
UNIFI_PASSWORD=tfacctest1234 \
|
||||
UNIFI_API="https://localhost:8443/api/" \
|
||||
UNIFI_ACC_WLAN_CONCURRENCY="4" \
|
||||
go test -v -cover ./internal/provider
|
||||
;;
|
||||
*)
|
||||
echo "unrecognized command"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user