Skip to content

Commit c4a4448

Browse files
committed
Tests: adjust test parameters and broken modules
1 parent bfd4f3f commit c4a4448

File tree

4 files changed

+22
-24
lines changed

4 files changed

+22
-24
lines changed

.github/workflows/maintenance-unit-tests.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,13 @@ jobs:
104104

105105
- name: "Initialize systemd"
106106
run: |
107-
apt-get update
108-
apt-get install -y systemd-sysv wget
109107
# Start systemd in the container
110108
/sbin/init &
111109
sleep 5
112110
# Make the container appear as if systemd is PID 1
113111
export SYSTEMD_IGNORE_CHROOT=1
114112
export container=docker
115113
116-
- name: "Install dependencies"
117-
run: |
118-
apt-get install -y jq figlet curl ca-certificates tree procps lsb-release dialog sudo iproute2 whiptail debconf libtext-iconv-perl gpg xz-utils pv systemd
119-
120114
- name: "Checkout Armbian configuration tool"
121115
uses: actions/checkout@v6
122116
with:

tests/uptimekuma.conf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ RELEASE="noble"
33
TESTNAME="Uptimekuma install"
44

55
testcase() {(
6-
set -e
7-
./bin/armbian-config --api module_uptimekuma remove
6+
./bin/armbian-config --api module_uptimekuma purge
87
./bin/armbian-config --api module_uptimekuma install
98
./bin/armbian-config --api module_uptimekuma status
109
)}

tools/modules/software/module_docker.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ function module_docker() {
2626
# Install docker from distribution maintained packages
2727
pkg_update
2828
pkg_install docker.io docker-cli docker-compose
29-
29+
if pkg_installed docker-ce; then pkg_remove docker-ce; fi
30+
if pkg_installed docker-ce-cli; then pkg_remove docker-ce-cli; fi
31+
if pkg_installed containerd.io; then pkg_remove containerd.io; fi
32+
if pkg_installed docker-buildx-plugin; then pkg_remove docker-buildx-plugin; fi
33+
if pkg_installed docker-compose-plugin; then pkg_remove docker-compose-plugin; fi
34+
rm -f /etc/apt/sources.list.d/docker.list
3035
groupadd docker 2>/dev/null || true
3136
if [[ -n "${SUDO_USER}" ]]; then
3237
usermod -aG docker "${SUDO_USER}"

tools/modules/software/module_uptime-kuma.sh

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ function module_uptimekuma () {
1717
local title="uptimekuma"
1818
local condition=$(which "$title" 2>/dev/null)
1919

20-
if pkg_installed docker-ce; then
21-
local container=$(docker container ls -a | mawk '/uptime-kuma?( |$)/{print $1}')
22-
local image=$(docker image ls -a | mawk '/uptime-kuma?( |$)/{print $3}')
23-
fi
20+
pkg_installed docker.io || module_docker install
21+
local container=$(docker container ls -a --filter "name=uptime-kuma" --format '{{.ID}}')
22+
local image=$(docker image ls -a --format '{{.Repository}} {{.ID}}' | grep 'uptime-kuma '| awk '{print $2}')
2423

2524
local commands
2625
IFS=' ' read -r -a commands <<< "${module_options["module_uptimekuma,example"]}"
@@ -29,7 +28,6 @@ function module_uptimekuma () {
2928

3029
case "$1" in
3130
"${commands[0]}")
32-
pkg_installed docker-ce || module_docker install
3331
[[ -d "$UPTIMEKUMA_BASE" ]] || mkdir -p "$UPTIMEKUMA_BASE" || { echo "Couldn't create storage directory: $UPTIMEKUMA_BASE"; exit 1; }
3432
docker run -d \
3533
--net=lsio \
@@ -39,26 +37,28 @@ function module_uptimekuma () {
3937
-v "${UPTIMEKUMA_BASE}:/app/data" \
4038
louislam/uptime-kuma:1
4139
for i in $(seq 1 20); do
42-
if docker inspect -f '{{ index .Config.Labels "build_version" }}' uptime-kuma >/dev/null 2>&1 ; then
43-
break
44-
else
45-
sleep 3
40+
state="$(docker inspect -f '{{.State.Status}}' uptime-kuma 2>/dev/null || true)"
41+
if [[ "$state" == "running" ]]; then
42+
break
4643
fi
47-
if [ $i -eq 20 ] ; then
48-
echo -e "\nTimed out waiting for ${title} to start, consult your container logs for more info (\`docker logs uptimekuma\`)"
44+
sleep 3
45+
if [[ $i -eq 20 ]]; then
46+
echo -e "\nTimed out waiting for ${title} to start, consult logs (\`docker logs uptime-kuma\`)"
4947
exit 1
5048
fi
5149
done
5250
;;
5351
"${commands[1]}")
5452
if [[ "${container}" ]]; then
55-
docker container rm -f "$container" >/dev/null
56-
fi
57-
if [[ "${image}" ]]; then
58-
docker image rm "$image" >/dev/null
53+
echo "Removing container: $container"
54+
docker container rm -f "$container"
5955
fi
6056
;;
6157
"${commands[2]}")
58+
${module_options["module_uptimekuma,feature"]} ${commands[1]}
59+
if [[ "${image}" ]]; then
60+
docker image rm "$image"
61+
fi
6262
${module_options["module_uptimekuma,feature"]} ${commands[1]}
6363
if [[ -n "${UPTIMEKUMA_BASE}" && "${UPTIMEKUMA_BASE}" != "/" ]]; then
6464
rm -rf "${UPTIMEKUMA_BASE}"

0 commit comments

Comments
 (0)