Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gorm tests #594

Merged
merged 27 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docker-compose-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ services:
context: .
environment:
CMAKE_BUILD_TYPE: "${CMAKE_BUILD_TYPE:-Debug}"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
od_net:
ipv4_address: 192.168.233.15
Expand Down
4 changes: 4 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
postgresql-common \
postgresql-server-dev-14

RUN curl -fsSL https://get.docker.com -o get-docker.sh && \
sudo sh get-docker.sh

COPY ./docker/pg/pg_hba-test.conf /etc/postgresql/14/main/pg_hba.conf

RUN mkdir test_dir
Expand All @@ -75,6 +78,7 @@ COPY ./docker/ldap /ldap
COPY ./docker/lagpolling /lagpolling
COPY ./docker/shell-test /shell-test
COPY ./docker/tsa /tsa
COPY ./docker/gorm /gorm

COPY ./docker/entrypoint.sh /usr/local/bin/entrypoint.sh

Expand Down
10 changes: 9 additions & 1 deletion docker/bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ sudo -u postgres /usr/bin/pg_basebackup -D /var/lib/postgresql/14/repl -R -h loc
sudo -u postgres /usr/lib/postgresql/14/bin/pg_ctl -D /var/lib/postgresql/14/repl/ -o '-p 5433' start

# Create databases
for database_name in db scram_db ldap_db auth_query_db db1 hba_db tsa_db addr_db; do
for database_name in db scram_db ldap_db auth_query_db db1 hba_db tsa_db addr_db "spqr-console"; do
sudo -u postgres createdb $database_name >> "$SETUP_LOG" 2>&1 || {
echo "ERROR: 'createdb $database_name' failed, examine the log"
cat "$SETUP_LOG"
Expand Down Expand Up @@ -135,6 +135,14 @@ psql -h localhost -p 5432 -U postgres -c "create user user_addr_correct passwor
exit 1
}

# Create users
psql -h localhost -p 5432 -U postgres -c "create user \"spqr-console\";" >> $SETUP_LOG 2>&1 || {
echo "ERROR: users creation failed, examine the log"
cat "$SETUP_LOG"
cat "$PG_LOG"
exit 1
}

for i in `seq 0 9`
do
# Create tables
Expand Down
5 changes: 5 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ cd /test_dir/test && /usr/bin/odyssey_test

setup

# gorm
ody-start
/gorm/test.sh
ody-stop

# odyssey rule-address test
/rule-address/test.sh
if [ $? -eq 1 ]
Expand Down
4 changes: 4 additions & 0 deletions docker/gorm/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
git clone https://github.com/pg-sharding/gorm-spqr.git /gorm/gorm-spqr
docker build -t gorm-tests /gorm/gorm-spqr
rm -rf /gorm/gorm-spqr
docker run -e DB_HOST='odyssey' -e DB_PORT=6432 -e DB_USER='spqr-console' -e DB_NAME='spqr-console' -e EXTRA_PARAMS='client_encoding=UTF8' --network=odyssey_od_net gorm-tests
2 changes: 1 addition & 1 deletion docker/odyssey.conf
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ database "console" {
pool "session"
storage "local"
}
}
}
Loading