From f139003e2f60f8088384c2b1f976734e80eb8e58 Mon Sep 17 00:00:00 2001 From: Rohit T P Date: Thu, 2 May 2024 13:05:10 +0000 Subject: [PATCH] test: test for monitoring --- .../setup-script/tests/configure/monitor.bats | 27 +++++++++++++++++++ .../tests/expects/configure/monitor.sh | 20 ++++++++++++++ 2 files changed, 47 insertions(+) create mode 100755 docker-compose/setup-script/tests/configure/monitor.bats create mode 100755 docker-compose/setup-script/tests/expects/configure/monitor.sh diff --git a/docker-compose/setup-script/tests/configure/monitor.bats b/docker-compose/setup-script/tests/configure/monitor.bats new file mode 100755 index 0000000000..8a1c1df327 --- /dev/null +++ b/docker-compose/setup-script/tests/configure/monitor.bats @@ -0,0 +1,27 @@ +#!/usr/bin/env bats + +NOCO_HOME="${HOME}/.nocodb" +export NOCO_HOME + +WORKING_DIR="$(pwd)" + +setup() { + cd "${WORKING_DIR}" || exit 1 + ./setup.sh "setup" +} + +teardown() { + cd "${WORKING_DIR}" || exit 1 + ./setup.sh +} + +@test "Properly runs monitor script" { + ../expects/configure/restart.sh + + cd "${NOCO_HOME}" || exit 1 + + # Verify container is running + docker compose ps | grep -q 'redis' + docker compose ps | grep -q 'watchtower' + docker compose ps | grep -q 'nocodb' +} diff --git a/docker-compose/setup-script/tests/expects/configure/monitor.sh b/docker-compose/setup-script/tests/expects/configure/monitor.sh new file mode 100755 index 0000000000..710672a175 --- /dev/null +++ b/docker-compose/setup-script/tests/expects/configure/monitor.sh @@ -0,0 +1,20 @@ +#!/usr/bin/expect -f + +# Configure timeout for each expect command +set timeout 10 + +# Start your main script +spawn bash ../../noco.sh + +expect "Do you want to reinstall NocoDB*" +send "N\r" + +expect "Enter your choice: " +send "7\r" + +send \x03 + +expect "Enter your choice: " +send "0\r" + +expect EOF \ No newline at end of file