mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-15 09:53:09 +00:00
ci(mariadb): address greptile review
This commit is contained in:
6
.github/helper/start-db.sh
vendored
6
.github/helper/start-db.sh
vendored
@@ -56,10 +56,14 @@ mariadbd --no-defaults --datadir="$DATADIR" --socket="$SOCK" --pid-file="$DATADI
|
|||||||
--innodb-flush-log-at-trx-commit=0 --sync-binlog=0 --skip-log-bin \
|
--innodb-flush-log-at-trx-commit=0 --sync-binlog=0 --skip-log-bin \
|
||||||
> "$HOME/mariadb.log" 2>&1 &
|
> "$HOME/mariadb.log" 2>&1 &
|
||||||
|
|
||||||
|
up=0
|
||||||
for _ in $(seq 1 60); do
|
for _ in $(seq 1 60); do
|
||||||
mariadb-admin --socket="$SOCK" ping --silent 2>/dev/null && break
|
if mariadb-admin --socket="$SOCK" ping --silent 2>/dev/null; then up=1; break; fi
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
# Fail loudly instead of letting the loop fall through (exit 0 of the last `sleep`) into SQL that
|
||||||
|
# would error with a vague socket-connection failure.
|
||||||
|
[ "$up" = "1" ] || { echo "mariadbd did not come up on $SOCK"; cat "$HOME/mariadb.log" 2>/dev/null; exit 1; }
|
||||||
|
|
||||||
if [ "$fresh" = "1" ]; then
|
if [ "$fresh" = "1" ]; then
|
||||||
# A fresh datadir has only a password-less root@localhost. Give it the password install.sh
|
# A fresh datadir has only a password-less root@localhost. Give it the password install.sh
|
||||||
|
|||||||
8
.github/workflows/server-tests-mariadb.yml
vendored
8
.github/workflows/server-tests-mariadb.yml
vendored
@@ -112,6 +112,9 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mariadb-admin -h 127.0.0.1 -P 3306 -u root -proot shutdown || true
|
mariadb-admin -h 127.0.0.1 -P 3306 -u root -proot shutdown || true
|
||||||
for _ in $(seq 1 30); do [ -f /home/ci/db-data/mysqld.pid ] || break; sleep 1; done
|
for _ in $(seq 1 30); do [ -f /home/ci/db-data/mysqld.pid ] || break; sleep 1; done
|
||||||
|
# Don't bake a dirty datadir — fail if mariadbd didn't finish stopping, rather than ship
|
||||||
|
# an inconsistent datadir the shards would have to crash-recover.
|
||||||
|
[ -f /home/ci/db-data/mysqld.pid ] && { echo "mariadbd did not shut down cleanly"; exit 1; }
|
||||||
mv /home/ci/db-data /home/ci/frappe-bench/mariadb-data
|
mv /home/ci/db-data /home/ci/frappe-bench/mariadb-data
|
||||||
|
|
||||||
# Package the whole bench (apps, venv, node_modules, sites, the DB dump, and hydrate.sh)
|
# Package the whole bench (apps, venv, node_modules, sites, the DB dump, and hydrate.sh)
|
||||||
@@ -164,12 +167,11 @@ jobs:
|
|||||||
tar xzpf "/opt/ci-bench-staging/${GITHUB_RUN_ID}.tar.gz" -C /home/ci
|
tar xzpf "/opt/ci-bench-staging/${GITHUB_RUN_ID}.tar.gz" -C /home/ci
|
||||||
ls -ld /home/ci/frappe-bench
|
ls -ld /home/ci/frappe-bench
|
||||||
|
|
||||||
- name: Hydrate (DB up + restore + bench start)
|
- name: Hydrate (start DB on baked datadir + bench start)
|
||||||
run: bash /home/ci/frappe-bench/hydrate.sh
|
run: bash /home/ci/frappe-bench/hydrate.sh
|
||||||
env:
|
env:
|
||||||
DB_HOST: 127.0.0.1
|
DB_HOST: 127.0.0.1
|
||||||
SKIP_SYSTEM_SETUP: "1"
|
SKIP_SYSTEM_SETUP: "1"
|
||||||
CI_BASELINE_BACKUP: /home/ci/frappe-bench/test_site-db.sql.gz
|
|
||||||
|
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
run: |
|
run: |
|
||||||
@@ -178,7 +180,7 @@ jobs:
|
|||||||
coverage_flag=""
|
coverage_flag=""
|
||||||
if [ "$WITH_COVERAGE" = "true" ]; then coverage_flag="--with-coverage"; fi
|
if [ "$WITH_COVERAGE" = "true" ]; then coverage_flag="--with-coverage"; fi
|
||||||
bench --site test_site run-parallel-tests --lightmode --app erpnext \
|
bench --site test_site run-parallel-tests --lightmode --app erpnext \
|
||||||
--total-builds 4 \
|
--total-builds ${{ strategy.job-total }} \
|
||||||
--build-number ${{ matrix.container }} \
|
--build-number ${{ matrix.container }} \
|
||||||
$coverage_flag
|
$coverage_flag
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
Reference in New Issue
Block a user