Skip to content

Commit

Permalink
reuse test replayer script
Browse files Browse the repository at this point in the history
  • Loading branch information
dkijania committed Nov 10, 2023
1 parent 5d05e3b commit 3a66892
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 41 deletions.
42 changes: 3 additions & 39 deletions buildkite/scripts/replayer-test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

TEST_DIR=/workdir/src/app/replayer/test
PGPASSWORD=arbitraryduck
TEST_DIR=/workdir/src/app/replayer/

set -eox pipefail

Expand All @@ -10,9 +9,6 @@ sudo apt-get update
# Don't prompt for answers during apt-get install
export DEBIAN_FRONTEND=noninteractive

#remove any existing postgres installation
sudo apt-get -y remove postgresql postgresql-*

# time zone = US Pacific
/bin/echo -e "12\n10" | sudo apt-get install -y tzdata
sudo apt-get install -y git apt-transport-https ca-certificates curl wget
Expand All @@ -21,32 +17,6 @@ git config --global --add safe.directory /workdir

source buildkite/scripts/export-git-env-vars.sh

echo "Generating locale for Postgresql"

export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

locale-gen en_US.UTF-8


#download postgres 15

# Create the file repository configuration
echo "deb [trusted=yes] http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list

# Import the repository signing key
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/trusted.gpg.d/pgdg.asc &>/dev/null

# Update list of available packages
sudo apt update

# Download postgres
sudo apt install postgresql-15 postgresql-client-15 -y

# Check version
psql --version

echo "deb [trusted=yes] http://packages.o1test.net bullseye ${MINA_DEB_RELEASE}" | sudo tee /etc/apt/sources.list.d/mina.list
sudo apt-get update

Expand All @@ -58,12 +28,6 @@ sudo service postgresql start

echo "Postgres is up - executing command"

echo "Populating archive database"
cd ~postgres
sudo -u postgres psql -p 5433 < $TEST_DIR/archive_db.sql
echo "ALTER USER postgres PASSWORD '$PGPASSWORD';" | sudo -u postgres psql -p 5433
cd /workdir

echo "Running replayer"
mina-replayer --archive-uri postgres://postgres:$PGPASSWORD@localhost:5433/archive \
--input-file $TEST_DIR/input.json --output-file /dev/null

./scripts/replayer-test.sh -d $TEST_DIR -a mina-replayer
12 changes: 10 additions & 2 deletions scripts/replayer-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

# test replayer on known archive db

REPLAYER_DIR=src/app/replayer
DEFAULT_REPLAYER_DIR=src/app/replayer
DEFAULT_REPLAYER_APP=./_build/default/src/app/replayer/replayer.exe

while [[ "$#" -gt 0 ]]; do case $1 in
-d|--dir) REPLAYER_DIR="$2"; shift;;
-a|--app) REPLAYER_APP="$2"; shift;;
*) echo "Unknown parameter passed: $1"; exit 1;;
esac; shift; done

DB=archive

DOCKER_IMAGE=12.4-alpine
Expand Down Expand Up @@ -53,7 +61,7 @@ echo "Building replayer"
make replayer

echo "Running replayer"
./_build/default/src/app/replayer/replayer.exe --archive-uri $PG_CONN --input-file $REPLAYER_DIR/test/input.json
$REPLAYER_APP --archive-uri $PG_CONN --input-file $REPLAYER_DIR/test/input.json

RESULT=$?

Expand Down

0 comments on commit 3a66892

Please sign in to comment.