-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ff69d3
commit 36735c0
Showing
8 changed files
with
50 additions
and
29 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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
ENABLED=true | ||
RELEASE="bookworm:noble" | ||
|
||
function testcase { | ||
./bin/armbian-config --api module_portainer remove | ||
testcase() {( | ||
set -e | ||
./bin/armbian-config --api module_portainer install | ||
./bin/armbian-config --api module_portainer status | ||
echo $? | ||
} | ||
)} |
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
ENABLED=false | ||
|
||
function testcase { | ||
testcase() {( | ||
set -e | ||
./bin/armbian-config --api module_mariadb install | ||
./bin/armbian-config --api module_mariadb status | ||
docker container ls -a | ||
} | ||
)} |
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
ENABLED=true | ||
RELEASE="bookworm" | ||
|
||
function testcase { | ||
function testcase {( | ||
set -e | ||
./bin/armbian-config --api module_openhab install | ||
systemctl is-active --quiet openhab.service | ||
} | ||
)} |
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
ENABLED=false | ||
RELEASE="bookworm" | ||
|
||
function testcase { | ||
testcase() {( | ||
set -e | ||
./bin/armbian-config --api module_haos install | ||
} | ||
./bin/armbian-config --api module_haos status | ||
)} |
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
ENABLED=true | ||
RELEASE="bookworm:noble" # run on specific or leave empty to run on all | ||
|
||
function testcase { | ||
./bin/armbian-config --api module_cockpit remove | ||
testcase() {( | ||
set -e | ||
./bin/armbian-config --api module_cockpit remove || true | ||
./bin/armbian-config --api module_cockpit install | ||
[ -f /usr/bin/cockpit-bridge ] | ||
} | ||
|
||
[[ -f /usr/bin/cockpit-bridge ]] | ||
)} |
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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
ENABLED=true | ||
RELEASE="bookworm:noble" | ||
|
||
function testcase { | ||
./bin/armbian-config --api module_uptimekuma remove | ||
testcase() {( | ||
set -e | ||
./bin/armbian-config --api module_uptimekuma remove || true | ||
./bin/armbian-config --api module_uptimekuma install | ||
./bin/armbian-config --api module_uptimekuma status | ||
./bin/armbian-config --api module_uptimekuma remove | ||
./bin/armbian-config --api module_uptimekuma status | ||
} | ||
! ./bin/armbian-config --api module_uptimekuma status | ||
)} |
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 |
---|---|---|
@@ -1,11 +1,10 @@ | ||
ENABLED=true | ||
RELEASE="bookworm:noble" | ||
|
||
function testcase { | ||
testcase() {( | ||
set -e | ||
./bin/armbian-config --api module_navidrome remove | ||
./bin/armbian-config --api module_navidrome install | ||
container=$(docker container ls -a | mawk '/navidrome?( |$)/{print $1}') | ||
if [[ -z "${container}" ]]; then | ||
exit 1 | ||
fi | ||
} | ||
[[ -n "$container" ]] | ||
)} |
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 |
---|---|---|
@@ -1,19 +1,36 @@ | ||
# Unit tests | ||
|
||
If function testcase returns 0, test is succesful. Put the code there. | ||
If the function `testcase()` returns 0, the test is succesful. Put the code there. | ||
|
||
- name of the the file is function ID.conf | ||
- ENABLED=false|true | ||
- RELEASE="bookworm:jammy:noble" run on specific or leave empty to run on all | ||
|
||
Example: | ||
|
||
``` | ||
```sh | ||
ENABLED=true | ||
RELEASE="bookworm:noble" | ||
|
||
function testcase { | ||
./bin/armbian-config --api module_cockpit install | ||
[ -f /usr/bin/cockpit-bridge ] | ||
testcase() { | ||
./bin/armbian-config --api module_cockpit install | ||
[ -f /usr/bin/cockpit-bridge ] | ||
} | ||
``` | ||
|
||
If you have multiple test conditions inside `testcase()` and you want the test | ||
to exit on the first failed statement, you can use the following technique: | ||
|
||
```sh | ||
testcase() {( | ||
set -e | ||
./bin/armbian-config --api pkg_install neovim | ||
./bin/armbian-config --api pkg_installed neovim | ||
./bin/armbian-config --api pkg_remove neovim | ||
! ./bin/armbian-config --api pkg_installed neovim | ||
)} | ||
``` | ||
|
||
Note the additional pair of `()` and the `set -e` command inside function body. | ||
These will cause test conditions to run inside a subshell with the -e option | ||
enabled (exit immediately if a pipeline returns non-zero status). |