print db logs after tests (#1390)
This commit is contained in:
parent
7329a9d4b2
commit
2f18808d68
5
.github/workflows/ci_bats_mariadb.yaml
vendored
5
.github/workflows/ci_bats_mariadb.yaml
vendored
|
@ -61,3 +61,8 @@ jobs:
|
||||||
MYSQL_PORT: 3306
|
MYSQL_PORT: 3306
|
||||||
MYSQL_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
|
MYSQL_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
|
||||||
MYSQL_USER: root
|
MYSQL_USER: root
|
||||||
|
|
||||||
|
- name: "show mariadb logs"
|
||||||
|
run: docker logs "${{ job.services.mariadb .id }}"
|
||||||
|
if: ${{ always() }}
|
||||||
|
|
||||||
|
|
7
.github/workflows/ci_bats_mysql.yaml
vendored
7
.github/workflows/ci_bats_mysql.yaml
vendored
|
@ -14,7 +14,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
services:
|
services:
|
||||||
mariadb:
|
mysql:
|
||||||
image: mysql:latest
|
image: mysql:latest
|
||||||
env:
|
env:
|
||||||
MYSQL_ROOT_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
|
MYSQL_ROOT_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
|
||||||
|
@ -61,3 +61,8 @@ jobs:
|
||||||
MYSQL_PORT: 3306
|
MYSQL_PORT: 3306
|
||||||
MYSQL_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
|
MYSQL_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
|
||||||
MYSQL_USER: root
|
MYSQL_USER: root
|
||||||
|
|
||||||
|
- name: "show mysql logs"
|
||||||
|
run: docker logs "${{ job.services.mysql.id }}"
|
||||||
|
if: ${{ always() }}
|
||||||
|
|
||||||
|
|
7
.github/workflows/ci_bats_postgres.yaml
vendored
7
.github/workflows/ci_bats_postgres.yaml
vendored
|
@ -21,7 +21,7 @@ jobs:
|
||||||
ports:
|
ports:
|
||||||
- 5432:5432
|
- 5432:5432
|
||||||
options: >-
|
options: >-
|
||||||
--health-cmd pg_isready
|
--health-cmd pg_isready -u postgres
|
||||||
--health-interval 10s
|
--health-interval 10s
|
||||||
--health-timeout 5s
|
--health-timeout 5s
|
||||||
--health-retries 5
|
--health-retries 5
|
||||||
|
@ -84,3 +84,8 @@ jobs:
|
||||||
POSTGRES_PORT: 5432
|
POSTGRES_PORT: 5432
|
||||||
POSTGRES_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
|
POSTGRES_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
|
||||||
POSTGRES_USER: postgres
|
POSTGRES_USER: postgres
|
||||||
|
|
||||||
|
- name: "show postgres logs"
|
||||||
|
run: docker logs "${{ job.services.postgres.id }}"
|
||||||
|
if: ${{ always() }}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ about() {
|
||||||
}
|
}
|
||||||
|
|
||||||
check_postgres_client() {
|
check_postgres_client() {
|
||||||
if ! command -v psql >/dev/null; then
|
if ! command -v psql --version >/dev/null; then
|
||||||
die "missing required program 'psql' as a postgres client (package postgres-client-13 on debian like system)"
|
die "missing required program 'psql' as a postgres client (package postgres-client-13 on debian like system)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,14 +18,14 @@ about() {
|
||||||
}
|
}
|
||||||
|
|
||||||
check_postgres_client() {
|
check_postgres_client() {
|
||||||
if ! command -v psql >/dev/null; then
|
if ! command -v psql --version >/dev/null; then
|
||||||
die "missing required program 'psql' as a postgres client (package postgres-client-13 on debian like system)"
|
die "missing required program 'psql' as a postgres client (package postgres-client-13 on debian like system)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
exec_sql() {
|
exec_sql() {
|
||||||
cmd="${1?Missing required sql command}"
|
cmd="${1?Missing required sql command}"
|
||||||
PGPASSWORD="${POSTGRES_PASSWORD}" psql -h "${POSTGRES_HOST}" --user "${POSTGRES_USER}" "--port=${POSTGRES_PORT}" <<< "$cmd"
|
PGPASSWORD="${POSTGRES_PASSWORD}" psql --host "${POSTGRES_HOST}" --user "${POSTGRES_USER}" "--port=${POSTGRES_PORT}" <<< "$cmd"
|
||||||
}
|
}
|
||||||
|
|
||||||
requirements() {
|
requirements() {
|
||||||
|
@ -38,6 +38,8 @@ setup() {
|
||||||
exec_sql "DROP USER IF EXISTS crowdsec_test;"
|
exec_sql "DROP USER IF EXISTS crowdsec_test;"
|
||||||
exec_sql "CREATE USER crowdsec_test WITH ENCRYPTED PASSWORD 'crowdsec_test';"
|
exec_sql "CREATE USER crowdsec_test WITH ENCRYPTED PASSWORD 'crowdsec_test';"
|
||||||
exec_sql "GRANT ALL PRIVILEGES ON DATABASE crowdsec_test TO crowdsec_test;"
|
exec_sql "GRANT ALL PRIVILEGES ON DATABASE crowdsec_test TO crowdsec_test;"
|
||||||
|
# exec_sql "SET log_statement='all';"
|
||||||
|
# exec_sql "SELECT pg_reload_conf();"
|
||||||
}
|
}
|
||||||
|
|
||||||
dump() {
|
dump() {
|
||||||
|
|
Loading…
Reference in a new issue