fix: lint and format sh, set xtrace where necessary...

- Ignore grep in grep
- trim spaces
This commit is contained in:
Pratik Balar 2021-11-25 14:47:09 +05:30
parent dbc8a80b93
commit 84f7ce6458
10 changed files with 58 additions and 58 deletions

View File

@ -17,7 +17,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libpam0g-dev \
debhelper debootstrap devscripts make equivs \
libssl-dev vim valgrind cmake \
locales
locales; \
apt-get clean autoclean; \
apt-get autoremove --yes; \
rm -rf /var/lib/{apt,dpkg,cache,log}/
RUN mkdir -p /pdbuild && mkdir -p /pgbin && mv /root/odys/tmp /pdbuild

View File

@ -4,7 +4,7 @@ set -ex
export DEBIAN_FRONTEND=noninteractive
export TZ=Europe/Moskow
sudo bash -c "echo $TZ > /etc/timezone"
echo $TZ >/etc/timezone
/root/odys/docker/dpkg/tzdata.sh
@ -12,12 +12,11 @@ sudo bash -c "echo $TZ > /etc/timezone"
#======================================================================================================================================
cd /pdbuild/tmp
mk-build-deps --build-dep --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control
mk-build-deps --build-dep --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control
./configure --prefix=/pgbin && make -j12 && make install -j12
#======================================================================================================================================
#compile odyssey (Scalable postgresql connection pooler)
cd /root/odys
@ -29,7 +28,7 @@ VERSION=$VERSION BUILD_NUMBER=$BUILD_NUMBER timeout 300 cmake -S -DBUILD_DEBIAN=
#======================================================================================================================================
mk-build-deps --build-dep --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control
mk-build-deps --build-dep --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control
dpkg-buildpackage -us -uc

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -x
ldapadd -x -H ldap://192.168.233.16 -D "cn=admin,dc=example,dc=org" -wadmin -f /ldap/usr1.ldif
# wait for ldap server to do smt
@ -9,28 +9,28 @@ sleep 1
/usr/bin/odyssey /ldap/odyssey.conf
PGPASSWORD=lolol psql -h localhost -p 6432 -U user1 -c "select 1" ldap_db > /dev/null 2>&1 || {
PGPASSWORD=lolol psql -h localhost -p 6432 -U user1 -c "select 1" ldap_db >/dev/null 2>&1 || {
echo "error: failed to successfully auth with correct password"
ody-stop
cat /var/log/odyssey.log
exit 1
}
PGPASSWORD=notlolol psql -h localhost -p 6432 -U user1 -c "select 1" ldap_db > /dev/null 2>&1 && {
PGPASSWORD=notlolol psql -h localhost -p 6432 -U user1 -c "select 1" ldap_db >/dev/null 2>&1 && {
echo "error: successfully auth with incorrect password"
ody-stop
cat /var/log/odyssey.log
exit 1
}
PGPASSWORD=default psql -h localhost -p 6432 -U user3 -c "select 1" ldap_db > /dev/null 2>&1 && {
PGPASSWORD=default psql -h localhost -p 6432 -U user3 -c "select 1" ldap_db >/dev/null 2>&1 && {
echo "error: failed to successfully auth with correct password as default user"
ody-stop
cat /var/log/odyssey.log
exit 1
}
PGPASSWORD=notdefault psql -h localhost -p 6432 -U user3 -c "select 1" ldap_db > /dev/null 2>&1 && {
PGPASSWORD=notdefault psql -h localhost -p 6432 -U user3 -c "select 1" ldap_db >/dev/null 2>&1 && {
echo "error: successfully auth with incorrect password as default user"
ody-stop
cat /var/log/odyssey.log

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -x
/usr/bin/odyssey /scram/config.conf

View File

@ -1,26 +1,27 @@
#!/bin/bash -x
psql -h localhost -p 6432 -U backend_auth_with_incorrect_password -c "SELECT 1" scram_db > /dev/null 2>&1 && {
psql -h localhost -p 6432 -U backend_auth_with_incorrect_password -c "SELECT 1" scram_db >/dev/null 2>&1 && {
echo "ERROR: successfully backend auth with incorrect password"
cat /var/log/odyssey.log
echo "
"
cat /var/log/postgresql/postgresql-14-main.log
exit 1
}
psql -h localhost -p 6432 -U backend_auth_with_correct_password -c "SELECT 1" scram_db > /dev/null 2>&1 || {
psql -h localhost -p 6432 -U backend_auth_with_correct_password -c "SELECT 1" scram_db >/dev/null 2>&1 || {
echo "ERROR: failed backend auth with correct password"
cat /var/log/odyssey.log
echo "
"
cat /var/log/postgresql/postgresql-14-main.log
exit 1
}

View File

@ -1,23 +1,24 @@
#!/bin/bash -x
PGPASSWORD=incorrect_password psql -h localhost -p 6432 -U frontend_auth_plain -c "SELECT 1" scram_db > /dev/null 2>&1 && {
PGPASSWORD=incorrect_password psql -h localhost -p 6432 -U frontend_auth_plain -c "SELECT 1" scram_db >/dev/null 2>&1 && {
echo "ERROR: successfully auth with incorrect password and plain password in config"
ody-stop
exit 1
}
PGPASSWORD=correct_password psql -h localhost -p 6432 -U frontend_auth_plain -c "SELECT 1" scram_db > /dev/null 2>&1 || {
PGPASSWORD=correct_password psql -h localhost -p 6432 -U frontend_auth_plain -c "SELECT 1" scram_db >/dev/null 2>&1 || {
echo "ERROR: failed auth with correct password and plain password in config"
ody-stop
exit 1
}
PGPASSWORD=incorrect_password psql -h localhost -p 6432 -U frontend_auth_scram_secret -c "SELECT 1" scram_db > /dev/null 2>&1 && {
PGPASSWORD=incorrect_password psql -h localhost -p 6432 -U frontend_auth_scram_secret -c "SELECT 1" scram_db >/dev/null 2>&1 && {
echo "ERROR: successfully auth with incorrect password and scram secret in config"
ody-stop
exit 1
}
PGPASSWORD=correct_password psql -h localhost -p 6432 -U frontend_auth_scram_secret -c "SELECT 1" scram_db > /dev/null 2>&1 || {
PGPASSWORD=correct_password psql -h localhost -p 6432 -U frontend_auth_scram_secret -c "SELECT 1" scram_db >/dev/null 2>&1 || {
echo "ERROR: failed auth with correct password and scram secret in config"
ody-stop
exit 1

View File

@ -1,14 +1,13 @@
#!/bin/bash
#kill -9 $(ps aux | grep odyssey | awk '{print $2}')
#!/bin/bash -x
#kill -9 $(ps aux | grep odyssey | grpe -v grep | awk '{print $2}')
sleep 1
#ody-start
#./odyssey ./ody.conf
for _ in $(seq 1 4000000)
do
for _ in $(seq 1 4000000); do
for __ in $(seq 1 3000); do
# psql -U user1 -d postgres -h localhost -p 6432 -c 'SELECT 1/0' &
# psql -U user1 -d postgres -h localhost -p 6432 -c 'SELECT 1/0' &
psql -U user1 -d postgres -h localhost -p 6432 -c 'select pg_sleep(0.01)' &
done
done

View File

@ -1,12 +1,11 @@
#!/bin/bash
#kill -9 $(ps aux | grep odyssey | awk '{print $2}')
for _ in $(seq 1 40)
do
#!/bin/bash -x
#kill -9 $(ps aux | grep odyssey | grpe -v grep | awk '{print $2}')
for _ in $(seq 1 40); do
sleep 0.1
for __ in $(seq 1 10); do
PGPASSWORD=lolol psql -h localhost -p6432 -dpostgres2 -Uuser1 -c 'select 3' &
PGPASSWORD=lolol psql -h localhost -p6432 -dpostgres2 -Uuser1 -c 'select pg_sleep(1)' &
PGPASSWORD=lolol psql -h localhost -p6432 -dpostgres2 -Uuser1 -c 'select 3' &
PGPASSWORD=lolol psql -h localhost -p6432 -dpostgres2 -Uuser1 -c 'select pg_sleep(1)' &
done
done

View File

@ -1,28 +1,27 @@
#!/bin/bash
#kill -9 $(ps aux | grep odyssey | awk '{print $2}')
#!/bin/bash -x
#kill -9 $(ps aux | grep odyssey | grpe -v grep | awk '{print $2}')
sleep 1
#ody-start
./build/sources/odyssey ./odyssey-dev.conf
for _ in $(seq 1 40)
do
sleep 0.1
for _ in $(seq 1 40); do
sleep 0.1
for __ in $(seq 1 10); do
psql -U postgres -d postgres -h 0.0.0.0 -p 6432 -c 'select pg_sleep(39)' &
psql -U postgres -d postgres -h localhost -p 6432 -c 'select 1' &
psql -U postgres -d postgres -h 0.0.0.0 -p 6432 -c 'select pg_sleep(1)' &
done
for __ in $(seq 1 10); do
psql -U postgres -d postgres -h 0.0.0.0 -p 6432 -c 'select pg_sleep(39)' &
psql -U postgres -d postgres -h localhost -p 6432 -c 'select 1' &
psql -U postgres -d postgres -h 0.0.0.0 -p 6432 -c 'select pg_sleep(1)' &
done
#ody-restart
ps uax | grep odys
./build/sources/odyssey ./odyssey-dev.conf
#ody-restart
ps uax | grep odys
./build/sources/odyssey ./odyssey-dev.conf
for __ in $(seq 1 30); do
psql -U postgres -d postgres -h localhost -p 6432 -c 'select 1' &
psql -U postgres -d postgres -h 0.0.0.0 -p 6432 -c 'select pg_sleep(39)' &
psql -U postgres -d postgres -h 0.0.0.0 -p 6432 -c 'select pg_sleep(1)' &
done
for __ in $(seq 1 30); do
psql -U postgres -d postgres -h localhost -p 6432 -c 'select 1' &
psql -U postgres -d postgres -h 0.0.0.0 -p 6432 -c 'select pg_sleep(39)' &
psql -U postgres -d postgres -h 0.0.0.0 -p 6432 -c 'select pg_sleep(1)' &
done
done

View File

@ -1,11 +1,10 @@
#!/bin/bash
#kill -9 $(ps aux | grep odyssey | awk '{print $2}')
#!/bin/bash -x
#kill -9 $(ps aux | grep odyssey | grpe -v grep | awk '{print $2}')
sleep 1
#ody-start
for i in `seq 1 100`
do
for _ in $(eq 1 100); do
psql -h localhost -p 6432 -c 'select 1' -U user1 -d postgres &
psql -h 0.0.0.0 -p 6432 -c 'select pg_sleep(100)' -U user1 -d postgres &
done