mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-29 13:36:38 +00:00
update : refactor auto-upstall and installation methods
This commit is contained in:
31
docker-compose/1_Auto_Upstall/tests/configure/monitor.bats
Executable file
31
docker-compose/1_Auto_Upstall/tests/configure/monitor.bats
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
NOCO_HOME="./nocodb"
|
||||
export NOCO_HOME
|
||||
|
||||
|
||||
|
||||
setup() {
|
||||
cd "${WORKING_DIR}/configure" || exit 1
|
||||
./setup.sh "setup"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
if [ -n "$SKIP_TEARDOWN" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
cd "${WORKING_DIR}/install" || 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'
|
||||
}
|
||||
31
docker-compose/1_Auto_Upstall/tests/configure/restart.bats
Executable file
31
docker-compose/1_Auto_Upstall/tests/configure/restart.bats
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
NOCO_HOME="./nocodb"
|
||||
export NOCO_HOME
|
||||
|
||||
|
||||
|
||||
setup() {
|
||||
cd "${WORKING_DIR}/configure" || exit 1
|
||||
./setup.sh "setup"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
if [ -n "$SKIP_TEARDOWN" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
cd "${WORKING_DIR}/install" || exit 1
|
||||
./setup.sh
|
||||
}
|
||||
|
||||
@test "Check all containers are restarted" {
|
||||
../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'
|
||||
}
|
||||
33
docker-compose/1_Auto_Upstall/tests/configure/scale.bats
Executable file
33
docker-compose/1_Auto_Upstall/tests/configure/scale.bats
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
NOCO_HOME="./nocodb"
|
||||
export NOCO_HOME
|
||||
|
||||
|
||||
|
||||
setup() {
|
||||
cd "${WORKING_DIR}/configure" || exit 1
|
||||
./setup.sh "setup"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
if [ -n "$SKIP_TEARDOWN" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
cd "${WORKING_DIR}/install" || exit 1
|
||||
./setup.sh
|
||||
}
|
||||
|
||||
@test "Check NocoDB is scaled to 3 instances" {
|
||||
nproc() {
|
||||
echo 4
|
||||
}
|
||||
|
||||
../expects/configure/scale.sh
|
||||
|
||||
cd "${NOCO_HOME}" || exit 1
|
||||
|
||||
result=$(docker compose ps | grep -c "nocodb/nocodb")
|
||||
[ "${result}" -eq 3 ]
|
||||
}
|
||||
17
docker-compose/1_Auto_Upstall/tests/configure/setup.sh
Executable file
17
docker-compose/1_Auto_Upstall/tests/configure/setup.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$NOCO_HOME" ]; then
|
||||
NOCO_HOME="./nocodb"
|
||||
fi
|
||||
|
||||
if [ -d "$NOCO_HOME" ]; then
|
||||
cd "$NOCO_HOME" || exit
|
||||
docker compose down
|
||||
fi
|
||||
|
||||
cd "$WORKING_DIR" || exit
|
||||
rm -rf "$NOCO_HOME"
|
||||
|
||||
if [ "$1" = "setup" ]; then
|
||||
../noco.sh <<< $'\n\nN\n'
|
||||
fi
|
||||
31
docker-compose/1_Auto_Upstall/tests/configure/start.bats
Executable file
31
docker-compose/1_Auto_Upstall/tests/configure/start.bats
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
NOCO_HOME="./nocodb"
|
||||
export NOCO_HOME
|
||||
|
||||
|
||||
|
||||
setup() {
|
||||
cd "${WORKING_DIR}/configure" || exit 1
|
||||
./setup.sh "setup"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
if [ -n "$SKIP_TEARDOWN" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
cd "${WORKING_DIR}/install" || exit 1
|
||||
./setup.sh
|
||||
}
|
||||
|
||||
@test "Check all containers 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'
|
||||
}
|
||||
30
docker-compose/1_Auto_Upstall/tests/configure/stop.bats
Executable file
30
docker-compose/1_Auto_Upstall/tests/configure/stop.bats
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
NOCO_HOME="./nocodb"
|
||||
export NOCO_HOME
|
||||
|
||||
|
||||
|
||||
setup() {
|
||||
cd "${WORKING_DIR}/configure" || exit 1
|
||||
./setup.sh setup
|
||||
}
|
||||
|
||||
teardown() {
|
||||
if [ -n "$SKIP_TEARDOWN" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
cd "${WORKING_DIR}/install" || exit 1
|
||||
./setup.sh
|
||||
}
|
||||
|
||||
@test "Check all containers are down" {
|
||||
../expects/configure/stop.sh
|
||||
|
||||
cd "${NOCO_HOME}" || exit 1
|
||||
|
||||
# Verify container is not running
|
||||
count=$(docker compose ps -q | wc -l)
|
||||
[ "$count" -eq 0 ]
|
||||
}
|
||||
31
docker-compose/1_Auto_Upstall/tests/configure/upgrade.bats
Executable file
31
docker-compose/1_Auto_Upstall/tests/configure/upgrade.bats
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
NOCO_HOME="./nocodb"
|
||||
export NOCO_HOME
|
||||
|
||||
|
||||
|
||||
setup() {
|
||||
cd "${WORKING_DIR}/configure" || exit 1
|
||||
./setup.sh "setup"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
if [ -n "$SKIP_TEARDOWN" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
cd "${WORKING_DIR}/install" || exit 1
|
||||
./setup.sh
|
||||
}
|
||||
|
||||
@test "Check all containers are upgraded" {
|
||||
../expects/configure/upgrade.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'
|
||||
}
|
||||
22
docker-compose/1_Auto_Upstall/tests/expects/configure/monitor.sh
Executable file
22
docker-compose/1_Auto_Upstall/tests/expects/configure/monitor.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/expect -f
|
||||
|
||||
# Configure timeout for each expect command
|
||||
set timeout 10
|
||||
|
||||
# Start your main script
|
||||
set env(PATH) "$env(WORKING_DIR)/mocks:$env(PATH)"
|
||||
|
||||
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
|
||||
20
docker-compose/1_Auto_Upstall/tests/expects/configure/restart.sh
Executable file
20
docker-compose/1_Auto_Upstall/tests/expects/configure/restart.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/expect -f
|
||||
|
||||
# Configure timeout for each expect command
|
||||
set timeout 10
|
||||
|
||||
# Start your main script
|
||||
set env(PATH) "$env(WORKING_DIR)/mocks:$env(PATH)"
|
||||
|
||||
spawn bash ../../noco.sh
|
||||
|
||||
expect "Do you want to reinstall NocoDB*"
|
||||
send "N\r"
|
||||
|
||||
expect "Enter your choice: "
|
||||
send "4\r"
|
||||
|
||||
expect "Enter your choice: "
|
||||
send "0\r"
|
||||
|
||||
expect EOF
|
||||
23
docker-compose/1_Auto_Upstall/tests/expects/configure/scale.sh
Executable file
23
docker-compose/1_Auto_Upstall/tests/expects/configure/scale.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/expect -f
|
||||
|
||||
# Configure timeout for each expect command
|
||||
set timeout 10
|
||||
|
||||
# Start your main script
|
||||
set env(PATH) "$env(WORKING_DIR)/mocks:$env(PATH)"
|
||||
|
||||
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
|
||||
20
docker-compose/1_Auto_Upstall/tests/expects/configure/start.sh
Executable file
20
docker-compose/1_Auto_Upstall/tests/expects/configure/start.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/expect -f
|
||||
|
||||
# Configure timeout for each expect command
|
||||
set timeout 10
|
||||
|
||||
# Start your main script
|
||||
set env(PATH) "$env(WORKING_DIR)/mocks:$env(PATH)"
|
||||
|
||||
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
|
||||
20
docker-compose/1_Auto_Upstall/tests/expects/configure/stop.sh
Executable file
20
docker-compose/1_Auto_Upstall/tests/expects/configure/stop.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/expect -f
|
||||
|
||||
# Configure timeout for each expect command
|
||||
set timeout 10
|
||||
|
||||
# Start your main script
|
||||
set env(PATH) "$env(WORKING_DIR)/mocks:$env(PATH)"
|
||||
|
||||
spawn bash ../../noco.sh
|
||||
|
||||
expect "Do you want to reinstall NocoDB*"
|
||||
send "N\r"
|
||||
|
||||
expect "Enter your choice: "
|
||||
send "2\r"
|
||||
|
||||
expect "Enter your choice: "
|
||||
send "0\r"
|
||||
|
||||
expect EOF
|
||||
20
docker-compose/1_Auto_Upstall/tests/expects/configure/upgrade.sh
Executable file
20
docker-compose/1_Auto_Upstall/tests/expects/configure/upgrade.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/expect -f
|
||||
|
||||
# Configure timeout for each expect command
|
||||
set timeout 10
|
||||
|
||||
# Start your main script
|
||||
set env(PATH) "$env(WORKING_DIR)/mocks:$env(PATH)"
|
||||
|
||||
spawn bash ../../noco.sh
|
||||
|
||||
expect "Do you want to reinstall NocoDB*"
|
||||
send "N\r"
|
||||
|
||||
expect "Enter your choice: "
|
||||
send "5\r"
|
||||
|
||||
expect "Enter your choice: "
|
||||
send "0\r"
|
||||
|
||||
expect EOF
|
||||
21
docker-compose/1_Auto_Upstall/tests/expects/install/default.sh
Executable file
21
docker-compose/1_Auto_Upstall/tests/expects/install/default.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/expect -f
|
||||
|
||||
# Configure timeout for each expect command
|
||||
set timeout 10
|
||||
|
||||
# Start your main script
|
||||
set env(PATH) "$env(WORKING_DIR)/mocks:$env(PATH)"
|
||||
|
||||
spawn bash ../../noco.sh
|
||||
|
||||
# Respond to script prompts
|
||||
expect "Enter the IP address or domain name for the NocoDB instance (default: localhost):"
|
||||
send "\r"
|
||||
|
||||
expect "Show Advanced Options*"
|
||||
send "\r"
|
||||
|
||||
expect "Do you want to start the management menu*"
|
||||
send "N\r"
|
||||
|
||||
expect eof
|
||||
22
docker-compose/1_Auto_Upstall/tests/expects/install/ip.sh
Executable file
22
docker-compose/1_Auto_Upstall/tests/expects/install/ip.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/expect -f
|
||||
# shellcheck shell=bash
|
||||
|
||||
# Configure timeout for each expect command
|
||||
set timeout 10
|
||||
|
||||
# Start your main script
|
||||
set env(PATH) "$env(WORKING_DIR)/mocks:$env(PATH)"
|
||||
|
||||
spawn bash ../../noco.sh
|
||||
|
||||
# Respond to script prompts
|
||||
expect "Enter the IP address or domain name for the NocoDB instance (default: localhost):"
|
||||
send "192.168.1.10\r"
|
||||
|
||||
expect "Show Advanced Options*"
|
||||
send "\r"
|
||||
|
||||
expect "Do you want to start the management menu*"
|
||||
send "N\r"
|
||||
|
||||
expect eof
|
||||
39
docker-compose/1_Auto_Upstall/tests/expects/install/redis.sh
Executable file
39
docker-compose/1_Auto_Upstall/tests/expects/install/redis.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/expect -f
|
||||
|
||||
# Configure timeout for each expect command
|
||||
set timeout 10
|
||||
|
||||
# Start your main script
|
||||
set env(PATH) "$env(WORKING_DIR)/mocks:$env(PATH)"
|
||||
|
||||
spawn bash ../../noco.sh
|
||||
|
||||
# Respond to script prompts
|
||||
expect "Enter the IP address or domain name for the NocoDB instance (default: localhost):"
|
||||
send "\r"
|
||||
|
||||
expect "Show Advanced Options*"
|
||||
send "Y\r"
|
||||
|
||||
expect "Choose Community or Enterprise Edition*"
|
||||
send "\r"
|
||||
|
||||
expect "Do you want to enabled Redis for caching*"
|
||||
send "Y\r"
|
||||
|
||||
expect "Do you want to enable Minio for file storage*"
|
||||
send "\r"
|
||||
|
||||
expect "Enter the MinIO domain name*"
|
||||
send "\r"
|
||||
|
||||
expect "Do you want to enabled Watchtower for automatic updates*"
|
||||
send "\r"
|
||||
|
||||
expect "How many instances of NocoDB do you want to run*"
|
||||
send "\r"
|
||||
|
||||
expect "Do you want to start the management menu*"
|
||||
send "N\r"
|
||||
|
||||
expect eof
|
||||
39
docker-compose/1_Auto_Upstall/tests/expects/install/scale.sh
Executable file
39
docker-compose/1_Auto_Upstall/tests/expects/install/scale.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/expect -f
|
||||
|
||||
# Configure timeout for each expect command
|
||||
set timeout 10
|
||||
|
||||
# Start your main script
|
||||
set env(PATH) "$env(WORKING_DIR)/mocks:$env(PATH)"
|
||||
|
||||
spawn bash ../../noco.sh
|
||||
|
||||
# Respond to script prompts
|
||||
expect "Enter the IP address or domain name for the NocoDB instance (default: localhost):"
|
||||
send "\r"
|
||||
|
||||
expect "Show Advanced Options*"
|
||||
send "Y\r"
|
||||
|
||||
expect "Choose Community or Enterprise Edition*"
|
||||
send "\r"
|
||||
|
||||
expect "Do you want to enabled Redis for caching*"
|
||||
send "Y\r"
|
||||
|
||||
expect "Do you want to enable Minio for file storage*"
|
||||
send "Y\r"
|
||||
|
||||
expect "Enter the MinIO domain name*"
|
||||
send "\r"
|
||||
|
||||
expect "Do you want to enabled Watchtower for automatic updates*"
|
||||
send "\r"
|
||||
|
||||
expect "How many instances of NocoDB do you want to run*"
|
||||
send "2\r"
|
||||
|
||||
expect "Do you want to start the management menu*"
|
||||
send "N\r"
|
||||
|
||||
expect eof
|
||||
38
docker-compose/1_Auto_Upstall/tests/expects/install/ssl.sh
Executable file
38
docker-compose/1_Auto_Upstall/tests/expects/install/ssl.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/expect -f
|
||||
|
||||
# Configure timeout for each expect command
|
||||
set timeout 10
|
||||
|
||||
set random_number [lindex $argv 0]
|
||||
|
||||
# Start your main script
|
||||
set env(PATH) "$env(WORKING_DIR)/mocks:$env(PATH)"
|
||||
|
||||
spawn bash ../../noco.sh
|
||||
|
||||
# Respond to script prompts
|
||||
expect "Enter the IP address or domain name for the NocoDB instance (default: localhost):"
|
||||
send "${random_number}.ssl.nocodb.dev\r"
|
||||
|
||||
expect "Show Advanced Options*"
|
||||
send "y\r"
|
||||
|
||||
expect "Do you want to configure SSL*"
|
||||
send "y\r"
|
||||
|
||||
expect "Choose Community or Enterprise Edition*"
|
||||
send "\r"
|
||||
|
||||
expect "Do you want to enabled Redis for caching*"
|
||||
send "Y\r"
|
||||
|
||||
expect "Do you want to enabled Watchtower for automatic updates*"
|
||||
send "\r"
|
||||
|
||||
expect "How many instances of NocoDB do you want to run*"
|
||||
send "\r"
|
||||
|
||||
expect "Do you want to start the management menu*"
|
||||
send "N\r"
|
||||
|
||||
expect eof
|
||||
39
docker-compose/1_Auto_Upstall/tests/expects/install/watchtower.sh
Executable file
39
docker-compose/1_Auto_Upstall/tests/expects/install/watchtower.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/expect -f
|
||||
|
||||
# Configure timeout for each expect command
|
||||
set timeout 10
|
||||
|
||||
# Start your main script
|
||||
set env(PATH) "$env(WORKING_DIR)/mocks:$env(PATH)"
|
||||
|
||||
spawn bash ../../noco.sh
|
||||
|
||||
# Respond to script prompts
|
||||
expect "Enter the IP address or domain name for the NocoDB instance (default: localhost):"
|
||||
send "\r"
|
||||
|
||||
expect "Show Advanced Options*"
|
||||
send "Y\r"
|
||||
|
||||
expect "Choose Community or Enterprise Edition*"
|
||||
send "\r"
|
||||
|
||||
expect "Do you want to enabled Redis for caching*"
|
||||
send "\r"
|
||||
|
||||
expect "Do you want to enable Minio for file storage*"
|
||||
send "\r"
|
||||
|
||||
expect "Enter the MinIO domain name*"
|
||||
send "\r"
|
||||
|
||||
expect "Do you want to enabled Watchtower for automatic updates*"
|
||||
send "Y\r"
|
||||
|
||||
expect "How many instances of NocoDB do you want to run*"
|
||||
send "\r"
|
||||
|
||||
expect "Do you want to start the management menu*"
|
||||
send "N\r"
|
||||
|
||||
expect eof
|
||||
36
docker-compose/1_Auto_Upstall/tests/install/default.bats
Executable file
36
docker-compose/1_Auto_Upstall/tests/install/default.bats
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
NOCO_HOME="./nocodb"
|
||||
export NOCO_HOME
|
||||
|
||||
|
||||
|
||||
setup() {
|
||||
cd "${WORKING_DIR}/install" || exit 1
|
||||
./setup.sh
|
||||
}
|
||||
|
||||
teardown() {
|
||||
if [ -n "$SKIP_TEARDOWN" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
cd "${WORKING_DIR}/install" || exit 1
|
||||
./setup.sh
|
||||
}
|
||||
|
||||
@test "Check installation with all default options" {
|
||||
../expects/install/default.sh
|
||||
|
||||
cd "${NOCO_HOME}"
|
||||
|
||||
# Check Docker Compose file to verify configuration
|
||||
grep -q 'redis' docker-compose.yml
|
||||
grep -q 'watchtower' docker-compose.yml
|
||||
grep -q 'nocodb' docker-compose.yml
|
||||
|
||||
# Verify container is running
|
||||
docker compose ps | grep -q 'redis'
|
||||
docker compose ps | grep -q 'watchtower'
|
||||
docker compose ps | grep -q 'nocodb'
|
||||
}
|
||||
36
docker-compose/1_Auto_Upstall/tests/install/ip.bats
Executable file
36
docker-compose/1_Auto_Upstall/tests/install/ip.bats
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
NOCO_HOME="./nocodb"
|
||||
export NOCO_HOME
|
||||
|
||||
|
||||
|
||||
setup() {
|
||||
cd "${WORKING_DIR}/install" || exit 1
|
||||
./setup.sh
|
||||
}
|
||||
|
||||
teardown() {
|
||||
if [ -n "$SKIP_TEARDOWN" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
cd "${WORKING_DIR}/install" || exit 1
|
||||
./setup.sh
|
||||
}
|
||||
|
||||
@test "Check installation with custom ip" {
|
||||
../expects/install/ip.sh
|
||||
|
||||
cd "${NOCO_HOME}"
|
||||
|
||||
# Check Docker Compose file to verify configuration
|
||||
grep -q 'redis' docker-compose.yml
|
||||
grep -q 'watchtower' docker-compose.yml
|
||||
grep -q 'nocodb' docker-compose.yml
|
||||
|
||||
# Verify container is running
|
||||
docker compose ps | grep -q 'redis'
|
||||
docker compose ps | grep -q 'watchtower'
|
||||
docker compose ps | grep -q 'nocodb'
|
||||
}
|
||||
32
docker-compose/1_Auto_Upstall/tests/install/redis.bats
Executable file
32
docker-compose/1_Auto_Upstall/tests/install/redis.bats
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
NOCO_HOME="./nocodb"
|
||||
export NOCO_HOME
|
||||
|
||||
|
||||
|
||||
setup() {
|
||||
cd "${WORKING_DIR}/install" || exit 1
|
||||
./setup.sh
|
||||
}
|
||||
|
||||
teardown() {
|
||||
if [ -n "$SKIP_TEARDOWN" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
cd "${WORKING_DIR}/install" || exit 1
|
||||
./setup.sh
|
||||
}
|
||||
|
||||
@test "Check Redis is enabled when specified" {
|
||||
../expects/install/redis.sh
|
||||
|
||||
cd "${NOCO_HOME}"
|
||||
|
||||
# Check Docker Compose file to verify Redis configuration
|
||||
grep -q 'redis' docker-compose.yml
|
||||
|
||||
# Verify Redis container is running
|
||||
docker compose ps | grep -q 'redis'
|
||||
}
|
||||
30
docker-compose/1_Auto_Upstall/tests/install/scale.bats
Executable file
30
docker-compose/1_Auto_Upstall/tests/install/scale.bats
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
NOCO_HOME="./nocodb"
|
||||
export NOCO_HOME
|
||||
|
||||
|
||||
|
||||
setup() {
|
||||
cd "${WORKING_DIR}/install" || exit 1
|
||||
./setup.sh
|
||||
}
|
||||
|
||||
teardown() {
|
||||
if [ -n "$SKIP_TEARDOWN" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
cd "${WORKING_DIR}/install" || exit 1
|
||||
./setup.sh
|
||||
}
|
||||
|
||||
@test "Check if two instances of NoCoDB can be run" {
|
||||
../expects/install/scale.sh
|
||||
|
||||
cd "${NOCO_HOME}"
|
||||
|
||||
# Get scale from docker compose ps
|
||||
scale=$(docker compose ps | grep -c "nocodb/nocodb")
|
||||
[ "$scale" -eq 2 ]
|
||||
}
|
||||
12
docker-compose/1_Auto_Upstall/tests/install/setup.sh
Executable file
12
docker-compose/1_Auto_Upstall/tests/install/setup.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$NOCO_HOME" ]; then
|
||||
NOCO_HOME="./nocodb"
|
||||
fi
|
||||
|
||||
if [ -d "$NOCO_HOME" ]; then
|
||||
cd "$NOCO_HOME" || exit
|
||||
docker compose down
|
||||
fi
|
||||
|
||||
rm -rf "$NOCO_HOME"
|
||||
30
docker-compose/1_Auto_Upstall/tests/install/ssl.bats
Normal file
30
docker-compose/1_Auto_Upstall/tests/install/ssl.bats
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
|
||||
|
||||
RANDOM_NUMBER=$RANDOM
|
||||
|
||||
setup() {
|
||||
cd "${WORKING_DIR}/install" || exit 1
|
||||
./setup.sh
|
||||
}
|
||||
|
||||
teardown() {
|
||||
if [ -n "$SKIP_TEARDOWN" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
cd "${WORKING_DIR}/install" || exit 1
|
||||
./setup.sh
|
||||
}
|
||||
|
||||
@test "Should create SSL certificates" {
|
||||
if [ -z "$TEST_SSL" ]
|
||||
then
|
||||
skip "Skipping SSL tests"
|
||||
fi
|
||||
|
||||
../expects/install/ssl.sh "$RANDOM_NUMBER"
|
||||
|
||||
curl -ksS --head "https://${RANDOM_NUMBER}.ssl.nocodb.dev" > /dev/null
|
||||
}
|
||||
30
docker-compose/1_Auto_Upstall/tests/install/watchtower.bats
Executable file
30
docker-compose/1_Auto_Upstall/tests/install/watchtower.bats
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
NOCO_HOME="./nocodb"
|
||||
export NOCO_HOME
|
||||
|
||||
setup() {
|
||||
cd "${WORKING_DIR}/install" || exit 1
|
||||
./setup.sh
|
||||
}
|
||||
|
||||
teardown() {
|
||||
if [ -n "$SKIP_TEARDOWN" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
cd "${WORKING_DIR}/install" || exit 1
|
||||
./setup.sh
|
||||
}
|
||||
|
||||
@test "Check WatchTower is enabled when specified" {
|
||||
../expects/install/watchtower.sh
|
||||
|
||||
cd "${NOCO_HOME}"
|
||||
|
||||
# Check Docker Compose file to verify WatchTower configuration
|
||||
grep -q 'watchtower' docker-compose.yml
|
||||
|
||||
# Verify WatchTower container is running
|
||||
docker compose ps | grep -q 'watchtower'
|
||||
}
|
||||
3
docker-compose/1_Auto_Upstall/tests/mocks/clear
Executable file
3
docker-compose/1_Auto_Upstall/tests/mocks/clear
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "--- Clear Mock ---"
|
||||
3
docker-compose/1_Auto_Upstall/tests/mocks/nproc
Executable file
3
docker-compose/1_Auto_Upstall/tests/mocks/nproc
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo 4
|
||||
Reference in New Issue
Block a user