diff --git a/docker-compose/setup-script/tests/configure/scale.bats b/docker-compose/setup-script/tests/configure/scale.bats new file mode 100755 index 0000000000..89da5a308f --- /dev/null +++ b/docker-compose/setup-script/tests/configure/scale.bats @@ -0,0 +1,25 @@ +#!/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 "Check NocoDB is scaled to 3 instances" { + ../expects/configure/scale.sh + + cd "${NOCO_HOME}" || exit 1 + + result=$(docker-compose ps | grep -c "nocodb/nocodb") + [ "${result}" -eq 3 ] +} diff --git a/docker-compose/setup-script/tests/expects/configure/scale.sh b/docker-compose/setup-script/tests/expects/configure/scale.sh new file mode 100755 index 0000000000..d51b9221da --- /dev/null +++ b/docker-compose/setup-script/tests/expects/configure/scale.sh @@ -0,0 +1,21 @@ +#!/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 "6\r" + +expect "How many instances of NocoDB do you want to run*" +send "3\r" + +expect "Enter your choice: " +send "0\r" + +expect EOF \ No newline at end of file diff --git a/docker-compose/setup-script/tests/install/scale.bats b/docker-compose/setup-script/tests/install/scale.bats index 3adb94e95a..e64a7bf16f 100755 --- a/docker-compose/setup-script/tests/install/scale.bats +++ b/docker-compose/setup-script/tests/install/scale.bats @@ -26,6 +26,6 @@ teardown() { cd "${NOCO_HOME}" # Get scale from docker compose ps - scale=$(docker compose ps | grep nocodb | awk '{print $1}') + scale=$(docker compose ps | grep -c "nocodb/nocodb") [ "$scale" -eq 2 ] }