Skip to content

Commit

Permalink
test(mariadb): add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Jun 22, 2024
1 parent 88aae75 commit f664aa2
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 5 deletions.
1 change: 1 addition & 0 deletions features/test/mariadb/alpine-mcr.sh
19 changes: 15 additions & 4 deletions features/test/mariadb/checks.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
#!/bin/bash

check "mariadb is running" sudo sh -c 'sv status mariadb | grep -E ^run:'
sudo sv stop mariadb
check "mariadb is stopped" sudo sh -c 'sv status mariadb | grep -E ^down:'
sudo sv start mariadb
if hash sv >/dev/null 2>&1; then
check "mariadb is running" sudo sh -c 'sv status mariadb | grep -E ^run:'
sudo sv stop mariadb
check "mariadb is stopped" sudo sh -c 'sv status mariadb | grep -E ^down:'
sudo sv start mariadb
else
check "mariadb is running" pgrep mariadbd
fi

second=0
while ! mysqladmin ping -u root -h 127.0.0.1 --silent && [[ "${second}" -lt 60 ]]; do
sleep 1
second=$((second+1))
done
check "MariaDB is online" mysqladmin ping -u root -h 127.0.0.1 --silent

# Microsoft's base images contain zsh. We don't want to run this check for MS images because we have no control over the installed services.
if test -d /etc/rc2.d && ! test -e /usr/bin/zsh; then
Expand Down
29 changes: 28 additions & 1 deletion features/test/mariadb/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,32 @@
"installDatabaseToWorkspaces": true
}
}
},

"ubuntu-mcr": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"entrypoints": {},
"mariadb": {
"install-runit-service": false
}
},
"overrideFeatureInstallOrder": [
"./entrypoints",
"./mariadb"
]
},
"alpine-mcr": {
"image": "mcr.microsoft.com/devcontainers/base:alpine",
"features": {
"entrypoints": {},
"mariadb": {
"install-runit-service": false
}
},
"overrideFeatureInstallOrder": [
"./entrypoints",
"./mariadb"
]
}
}
}
1 change: 1 addition & 0 deletions features/test/mariadb/ubuntu-mcr.sh

0 comments on commit f664aa2

Please sign in to comment.