aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-03-12 17:24:35 +0100
committerEgor Tensin <Egor.Tensin@gmail.com>2023-03-12 17:25:54 +0100
commit7e4f1beb007916840bc8639acdcc2752539b230b (patch)
treeb942cc13475f22778aa9178309184c95b7d21844 /test
parentcheck_api.sh: refactoring (diff)
downloadwg-api-web-7e4f1beb007916840bc8639acdcc2752539b230b.tar.gz
wg-api-web-7e4f1beb007916840bc8639acdcc2752539b230b.zip
test: add check_web.sh
Diffstat (limited to 'test')
-rwxr-xr-xtest/check_web.sh31
-rwxr-xr-xtest/host/test.sh1
2 files changed, 32 insertions, 0 deletions
diff --git a/test/check_web.sh b/test/check_web.sh
new file mode 100755
index 0000000..b011f5d
--- /dev/null
+++ b/test/check_web.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+set -o errexit -o nounset -o pipefail
+shopt -s inherit_errexit lastpipe
+
+readonly base_url='http://127.0.0.1:8090/'
+
+run_curl() {
+ curl -sS -D - --connect-timeout 3 "$@"
+}
+
+call_web_method() {
+ local method
+ for method; do
+ echo ------------------------------------------------------------------
+ echo "Checking /api/$method"
+ echo ------------------------------------------------------------------
+ run_curl -- "$base_url/api/$method"
+ done
+}
+
+check_web() {
+ call_web_method ListPeers
+ call_web_method GetDeviceInfo
+}
+
+main() {
+ check_web
+}
+
+main
diff --git a/test/host/test.sh b/test/host/test.sh
index 25d5a87..0e497bc 100755
--- a/test/host/test.sh
+++ b/test/host/test.sh
@@ -142,6 +142,7 @@ main() {
add_devices
build_services
"$script_dir/../check_api.sh"
+ "$script_dir/../check_web.sh"
}
main "$@"