jobqueue: Introduce jobqueue backed by a postgres database

Co-authored-by: sanne <sanne.raymaekers@gmail.com>
This commit is contained in:
Lars Karlitski 2021-01-03 13:33:01 +01:00 committed by Tom Gundersen
parent 871c6e9cbb
commit 9c2c92f729
419 changed files with 98376 additions and 956 deletions

View file

@ -14,6 +14,7 @@ TEST_CASES=(
"osbuild-dnf-json-tests"
"osbuild-composer-cli-tests"
"osbuild-auth-tests"
"osbuild-composer-dbjobqueue-tests"
)
# Print out a nice test divider so we know when tests stop and start.
@ -43,6 +44,27 @@ run_test_case () {
# Provision the software under test.
/usr/libexec/osbuild-composer-test/provision.sh
# Set up a basic postgres db
sudo dnf install -y go postgresql postgresql-server postgresql-contrib
PWFILE=$(sudo -u postgres mktemp)
cat <<EOF | sudo -u postgres tee "$PWFILE"
foobar
EOF
PGSETUP_INITDB_OPTIONS="-A password -U postgres --pwfile=$PWFILE" \
sudo -E postgresql-setup --initdb --unit postgresql
sudo systemctl start postgresql
PGUSER=postgres PGPASSWORD=foobar PGHOST=localhost PGPORT=5432 \
sudo -E -u postgres psql -c "CREATE DATABASE osbuildcomposer;"
# Initialize a module in a temp dir so we can get tern without introducing
# vendoring inconsistency
pushd "$(mktemp -d)"
go mod init temp
go get github.com/jackc/tern
PGUSER=postgres PGPASSWORD=foobar PGDATABASE=osbuildcomposer PGHOST=localhost PGPORT=5432 \
go run github.com/jackc/tern migrate -m /usr/share/tests/osbuild-composer/schemas
popd
# Change to the working directory.
cd $WORKING_DIRECTORY