-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into nc-feat/links-from-existing-cols
- Loading branch information
Showing
57 changed files
with
1,821 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Run BATS Tests | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'docker-compose/setup-script/noco.sh' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
prepare: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install jq | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y jq | ||
- name: Prepare matrix for test files | ||
id: set-matrix | ||
run: | | ||
BATS_FILES=$(find docker-compose/setup-script/tests -name '*.bats') | ||
MATRIX_JSON=$(echo $BATS_FILES | jq -Rsc 'split("\n") | map(select(. != ""))') | ||
echo "matrix=$MATRIX_JSON" >> $GITHUB_ENV | ||
test: | ||
needs: prepare | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
test: ${{fromJson(env.matrix)}} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install BATS | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y bats expect | ||
- name: Get working directory | ||
run: | | ||
WORKING_DIR="$(pwd)/docker-compose/setup-script/tests" | ||
echo "WORKING_DIR=$WORKING_DIR" >> $GITHUB_ENV | ||
- name: Run BATS test | ||
run: bats ${{ matrix.test }} | ||
env: | ||
WORKING_DIR: ${{ env.WORKING_DIR }} | ||
SKIP_TARE_DOWN: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bats | ||
|
||
NOCO_HOME="${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' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bats | ||
|
||
NOCO_HOME="${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' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bats | ||
|
||
NOCO_HOME="${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 ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/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 "$WORKING_DIR" || exit | ||
rm -rf "$NOCO_HOME" | ||
|
||
if [ "$1" = "setup" ]; then | ||
../noco.sh <<< $'\n\nN\n' | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bats | ||
|
||
NOCO_HOME="${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' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bats | ||
|
||
NOCO_HOME="${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 ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bats | ||
|
||
NOCO_HOME="${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 changes: 22 additions & 0 deletions
22
docker-compose/setup-script/tests/expects/configure/monitor.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 20 additions & 0 deletions
20
docker-compose/setup-script/tests/expects/configure/restart.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 23 additions & 0 deletions
23
docker-compose/setup-script/tests/expects/configure/scale.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 20 additions & 0 deletions
20
docker-compose/setup-script/tests/expects/configure/start.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.
464cc4f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR changes have been deployed. Please run the following command to verify: