Browse Source

test: test for configure/start

pull/8373/head
Rohit T P 7 months ago
parent
commit
f18655e9c1
  1. 18
      docker-compose/setup-script/tests/configure/setup.sh
  2. 27
      docker-compose/setup-script/tests/configure/start.bats
  3. 18
      docker-compose/setup-script/tests/expects/configure/start.sh
  4. 4
      docker-compose/setup-script/tests/install/default.bats
  5. 4
      docker-compose/setup-script/tests/install/ip.bats
  6. 4
      docker-compose/setup-script/tests/install/redis.bats
  7. 4
      docker-compose/setup-script/tests/install/scale.bats
  8. 0
      docker-compose/setup-script/tests/install/setup.sh
  9. 4
      docker-compose/setup-script/tests/install/watchtower.bats

18
docker-compose/setup-script/tests/configure/setup.sh

@ -0,0 +1,18 @@
#!/bin/bash
if [ -z "$NOCO_HOME" ]; then
NOCO_HOME="${HOME}/.nocodb"
fi
if [ -d "$NOCO_HOME" ]; then
cd "$NOCO_HOME" || exit
docker compose down
fi
cd /tmp || exit
rm -rf "$NOCO_HOME"
../noco.sh <<< $'\n\nN\n'
cd "$NOCO_HOME" || exit
docker compose down

27
docker-compose/setup-script/tests/configure/start.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
}
teardown() {
cd "${WORKING_DIR}" || exit 1
setup.sh
}
@test "Check Redis, WatchTower and NocoDB are up" {
../expects/configure/start.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'
}

18
docker-compose/setup-script/tests/expects/configure/start.sh

@ -0,0 +1,18 @@
#!/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 "1\r"
expect "Enter your choice: "
send "0\r"
expect EOF

4
docker-compose/setup-script/tests/install/default.bats

@ -7,12 +7,12 @@ WORKING_DIR="$(pwd)"
setup() {
cd "${WORKING_DIR}" || exit 1
../setup.sh
setup.sh
}
teardown() {
cd "${WORKING_DIR}" || exit 1
../setup.sh
setup.sh
}
@test "Check Redis, WatchTower and NocoDB are up" {

4
docker-compose/setup-script/tests/install/ip.bats

@ -7,12 +7,12 @@ WORKING_DIR="$(pwd)"
setup() {
cd "${WORKING_DIR}" || exit 1
../setup.sh
setup.sh
}
teardown() {
cd "${WORKING_DIR}" || exit 1
../setup.sh
setup.sh
}
@test "Check Redis, WatchTower and NocoDB are up with custom ip" {

4
docker-compose/setup-script/tests/install/redis.bats

@ -7,12 +7,12 @@ WORKING_DIR="$(pwd)"
setup() {
cd "${WORKING_DIR}" || exit 1
../setup.sh
setup.sh
}
teardown() {
cd "${WORKING_DIR}" || exit 1
../setup.sh
setup.sh
}
@test "Check Redis is enabled when specified" {

4
docker-compose/setup-script/tests/install/scale.bats

@ -7,12 +7,12 @@ WORKING_DIR="$(pwd)"
setup() {
cd "${WORKING_DIR}" || exit 1
../setup.sh
setup.sh
}
teardown() {
cd "${WORKING_DIR}" || exit 1
../setup.sh
setup.sh
}
@test "Check if two instances of NoCoDB can be run" {

0
docker-compose/setup-script/tests/setup.sh → docker-compose/setup-script/tests/install/setup.sh

4
docker-compose/setup-script/tests/install/watchtower.bats

@ -7,12 +7,12 @@ WORKING_DIR="$(pwd)"
setup() {
cd "${WORKING_DIR}" || exit 1
../setup.sh
setup.sh
}
teardown() {
cd "${WORKING_DIR}" || exit 1
../setup.sh
setup.sh
}
@test "Check WatchTower is enabled when specified" {

Loading…
Cancel
Save