Skip to content

Commit

Permalink
refactoring, change docker-compose-test
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaUnisikhin committed Mar 12, 2024
1 parent ff84839 commit 096dca0
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 83 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ run_test_prep: build_asan copy_asan_bin build_dbg copy_dbg_bin build_release cop
run_test:
# change dir, test would not work with absolute path
./cleanup-docker.sh
docker-compose -f ./docker-compose-test.yml up --exit-code-from odyssey
docker-compose -f ./docker-compose-test.yml up --exit-code-from odyssey odyssey openldapr

submit-cov:
mkdir cov-build && cd cov-build
Expand Down
12 changes: 12 additions & 0 deletions docker-compose-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ services:
networks:
od_net:
ipv4_address: 192.168.233.16

gorm-test:
build:
context: https://github.com/pg-sharding/gorm-spqr.git#main
environment:
DB_HOST: "odyssey"
DB_PORT: "6432"
DB_USER: "spqr-console"
DB_NAME: "spqr-console"
networks:
od_net:
ipv4_address: 192.168.233.17

networks:
od_net:
Expand Down
8 changes: 2 additions & 6 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libpq-dev \
vim \
postgresql-common \
postgresql-server-dev-14 \
git
postgresql-server-dev-14

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

RUN mkdir /gorm
RUN git clone https://github.com/pg-sharding/gorm-spqr.git /gorm/gorm-spqr
COPY ./docker/gorm /gorm

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

RUN mkdir test_dir
Expand All @@ -83,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
144 changes: 72 additions & 72 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,69 +2,69 @@

set -ex

# cd /test_dir/test && /usr/bin/odyssey_test
cd /test_dir/test && /usr/bin/odyssey_test

setup

# # odyssey rule-address test
# /rule-address/test.sh
# if [ $? -eq 1 ]
# then
# exit 1
# fi

# # odyssey target session attrs test
# /tsa/tsa.sh
# if [ $? -eq 1 ]
# then
# exit 1
# fi

# ody-start
# /config-validation
# ody-stop

# #ldap
# /ldap/test_ldap.sh
# if [ $? -eq 1 ]
# then
# exit 1
# fi

# # scram
# /scram/test_scram.sh
# if [ $? -eq 1 ]
# then
# exit 1
# fi

# # auth query
# /auth_query/test_auth_query.sh
# if [ $? -eq 1 ]
# then
# exit 1
# fi

# # odyssey hba test
# /hba/test.sh
# if [ $? -eq 1 ]
# then
# exit 1
# fi

# #prepared statements in transaction pooling
# /usr/bin/odyssey /etc/odyssey/pstmts.conf
# sleep 1
# /pstmts-test

# ody-stop

# # lag polling
# /lagpolling/test-lag.sh
# if [ $? -eq 1 ]
# then
# exit 1
# fi
# odyssey rule-address test
/rule-address/test.sh
if [ $? -eq 1 ]
then
exit 1
fi

# odyssey target session attrs test
/tsa/tsa.sh
if [ $? -eq 1 ]
then
exit 1
fi

ody-start
/config-validation
ody-stop

#ldap
/ldap/test_ldap.sh
if [ $? -eq 1 ]
then
exit 1
fi

# scram
/scram/test_scram.sh
if [ $? -eq 1 ]
then
exit 1
fi

# auth query
/auth_query/test_auth_query.sh
if [ $? -eq 1 ]
then
exit 1
fi

# odyssey hba test
/hba/test.sh
if [ $? -eq 1 ]
then
exit 1
fi

#prepared statements in transaction pooling
/usr/bin/odyssey /etc/odyssey/pstmts.conf
sleep 1
/pstmts-test

ody-stop

# lag polling
/lagpolling/test-lag.sh
if [ $? -eq 1 ]
then
exit 1
fi

# gorm
ody-start
Expand All @@ -75,19 +75,19 @@ then
fi
ody-stop

# /usr/bin/odyssey-asan /etc/odyssey/odyssey.conf
# ody-stop
/usr/bin/odyssey-asan /etc/odyssey/odyssey.conf
ody-stop

# # TODO: rewrite
# #/shell-test/test.sh
# /shell-test/console_role_test.sh
# /shell-test/parse_pg_options_test.sh
# /shell-test/override_pg_options_test.sh
# /shell-test/pool_size_test.sh
# ody-stop
# TODO: rewrite
#/shell-test/test.sh
/shell-test/console_role_test.sh
/shell-test/parse_pg_options_test.sh
/shell-test/override_pg_options_test.sh
/shell-test/pool_size_test.sh
ody-stop

# ody-start
# /ody-integration-test
# ody-stop
ody-start
/ody-integration-test
ody-stop

teardown
5 changes: 1 addition & 4 deletions docker/gorm/test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
docker network create gorm_test
docker network connect gorm_test odyssey_odyssey_1
docker build -t gorm-tests /gorm/gorm-spqr
docker run -e DB_HOST='odyssey' -e DB_PORT=6432 -e DB_USER='spqr-console' -e DB_NAME='spqr-console' --network=gorm_test gorm-tests
docker run -e DB_HOST='odyssey' -e DB_PORT=6432 -e DB_USER='spqr-console' -e DB_NAME='spqr-console' --network=odyssey_od_net gorm-tests

0 comments on commit 096dca0

Please sign in to comment.