CI: test with postgres 15 (#2149)

Postgres 15 restricts the default privileges for the public schema. We set crowdsec_test as owner which is shorter than granting permissions explicitly.
This commit is contained in:
mmetc 2023-07-24 11:56:04 +02:00 committed by GitHub
parent 46fff0b544
commit 202112bcae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View file

@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
services:
database:
image: postgres:14
image: postgres:15
env:
POSTGRES_PASSWORD: "secret"
ports:
@ -30,6 +30,14 @@ jobs:
steps:
- name: "Install pg_dump v15"
# we can remove this when it's released on ubuntu-latest
run: |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/trusted.gpg.d/pgdg.asc &>/dev/null
sudo apt update
sudo apt -qq -y -o=Dpkg::Use-Pty=0 install postgresql-client-15
- name: "Force machineid"
run: |
sudo chmod +w /etc/machine-id

View file

@ -42,10 +42,9 @@ exec_sql() {
setup() {
exec_sql "DROP DATABASE IF EXISTS crowdsec_test;"
exec_sql "CREATE DATABASE crowdsec_test;"
exec_sql "DROP USER IF EXISTS 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 "CREATE DATABASE crowdsec_test OWNER crowdsec_test;"
}
dump() {