Fix permission issues in tests core linux

This commit is contained in:
Théophile Diot 2023-09-20 13:43:50 +02:00
parent 91e5528a3f
commit c90cd7399a
No known key found for this signature in database
GPG key ID: 248FEA4BAE400D06
5 changed files with 21 additions and 24 deletions

View file

@ -215,7 +215,7 @@ do
if [ "$integration" == "docker" ] ; then
docker compose -f docker-compose.test.yml up --abort-on-container-exit --exit-code-from tests
else
python3 main.py
sudo python3 main.py
fi
if [ $? -ne 0 ] ; then

View file

@ -140,7 +140,7 @@ fi
if [ "$integration" == "docker" ] ; then
docker compose -f docker-compose.test.yml up --abort-on-container-exit --exit-code-from tests
else
python3 linux.py
sudo python3 linux.py
fi
if [ $? -ne 0 ] ; then

View file

@ -58,14 +58,14 @@ cleanup_stack () {
find . -type f -name 'docker-compose.*' -exec sed -i 's@CORS_ALLOW_METHODS: "GET, HEAD, POST, OPTIONS"@CORS_ALLOW_METHODS: "GET, POST, OPTIONS"@' {} \;
find . -type f -name 'docker-compose.*' -exec sed -i 's@CORS_ALLOW_HEADERS: "X-Test"@CORS_ALLOW_HEADERS: "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range"@' {} \;
else
sed -i 's@USE_CORS=.*$@USE_CORS=no@' /etc/bunkerweb/variables.env
sed -i 's@GENERATE_SELF_SIGNED_SSL=.*$@GENERATE_SELF_SIGNED_SSL=no@' /etc/bunkerweb/variables.env
sed -i 's@CORS_ALLOW_ORIGIN=.*$@CORS_ALLOW_ORIGIN=*@' /etc/bunkerweb/variables.env
sed -i 's@CORS_EXPOSE_HEADERS=.*$@CORS_EXPOSE_HEADERS=Content-Length,Content-Range@' /etc/bunkerweb/variables.env
sed -i 's@CORS_MAX_AGE=.*$@CORS_MAX_AGE=86400@' /etc/bunkerweb/variables.env
sed -i 's@CORS_ALLOW_CREDENTIALS=.*$@CORS_ALLOW_CREDENTIALS=no@' /etc/bunkerweb/variables.env
sed -i 's@CORS_ALLOW_METHODS=.*$@CORS_ALLOW_METHODS=GET, POST, OPTIONS@' /etc/bunkerweb/variables.env
sed -i 's@CORS_ALLOW_HEADERS=.*$@CORS_ALLOW_HEADERS=DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range@' /etc/bunkerweb/variables.env
sudo sed -i 's@USE_CORS=.*$@USE_CORS=no@' /etc/bunkerweb/variables.env
sudo sed -i 's@GENERATE_SELF_SIGNED_SSL=.*$@GENERATE_SELF_SIGNED_SSL=no@' /etc/bunkerweb/variables.env
sudo sed -i 's@CORS_ALLOW_ORIGIN=.*$@CORS_ALLOW_ORIGIN=*@' /etc/bunkerweb/variables.env
sudo sed -i 's@CORS_EXPOSE_HEADERS=.*$@CORS_EXPOSE_HEADERS=Content-Length,Content-Range@' /etc/bunkerweb/variables.env
sudo sed -i 's@CORS_MAX_AGE=.*$@CORS_MAX_AGE=86400@' /etc/bunkerweb/variables.env
sudo sed -i 's@CORS_ALLOW_CREDENTIALS=.*$@CORS_ALLOW_CREDENTIALS=no@' /etc/bunkerweb/variables.env
sudo sed -i 's@CORS_ALLOW_METHODS=.*$@CORS_ALLOW_METHODS=GET, POST, OPTIONS@' /etc/bunkerweb/variables.env
sudo sed -i 's@CORS_ALLOW_HEADERS=.*$@CORS_ALLOW_HEADERS=DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range@' /etc/bunkerweb/variables.env
unset USE_CORS
unset GENERATE_SELF_SIGNED_SSL
unset CORS_ALLOW_ORIGIN
@ -121,7 +121,7 @@ do
if [ "$integration" == "docker" ] ; then
find . -type f -name 'docker-compose.*' -exec sed -i 's@USE_CORS: "no"@USE_CORS: "yes"@' {} \;
else
sed -i 's@USE_CORS=.*$@USE_CORS=yes@' /etc/bunkerweb/variables.env
sudo sed -i 's@USE_CORS=.*$@USE_CORS=yes@' /etc/bunkerweb/variables.env
export USE_CORS="yes"
fi
elif [ "$test" = "allow_origin" ] ; then
@ -129,7 +129,7 @@ do
if [ "$integration" == "docker" ] ; then
find . -type f -name 'docker-compose.*' -exec sed -i 's@CORS_ALLOW_ORIGIN: "\*"@CORS_ALLOW_ORIGIN: "^http://app1\\\\.example\\\\.com$$"@' {} \;
else
sed -i 's@CORS_ALLOW_ORIGIN=.*$@CORS_ALLOW_ORIGIN=^http://app1\\.example\\.com$$@' /etc/bunkerweb/variables.env
sudo sed -i 's@CORS_ALLOW_ORIGIN=.*$@CORS_ALLOW_ORIGIN=^http://app1\\.example\\.com$$@' /etc/bunkerweb/variables.env
export CORS_ALLOW_ORIGIN="^http://app1\\.example\\.com\$"
fi
elif [ "$test" = "tweaked_settings" ] ; then
@ -143,13 +143,13 @@ do
find . -type f -name 'docker-compose.*' -exec sed -i 's@CORS_ALLOW_METHODS: "GET, POST, OPTIONS"@CORS_ALLOW_METHODS: "GET, HEAD, POST, OPTIONS"@' {} \;
find . -type f -name 'docker-compose.*' -exec sed -i 's@CORS_ALLOW_HEADERS: "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range"@CORS_ALLOW_HEADERS: "X-Test"@' {} \;
else
sed -i 's@GENERATE_SELF_SIGNED_SSL=.*$@GENERATE_SELF_SIGNED_SSL=yes@' /etc/bunkerweb/variables.env
sed -i 's@CORS_ALLOW_ORIGIN=.*$@CORS_ALLOW_ORIGIN=^https://app1\\.example\\.com\$@' /etc/bunkerweb/variables.env
sed -i 's@CORS_EXPOSE_HEADERS=.*$@CORS_EXPOSE_HEADERS=X-Test@' /etc/bunkerweb/variables.env
sed -i 's@CORS_MAX_AGE=.*$@CORS_MAX_AGE=3600@' /etc/bunkerweb/variables.env
sed -i 's@CORS_ALLOW_CREDENTIALS=.*$@CORS_ALLOW_CREDENTIALS=yes@' /etc/bunkerweb/variables.env
sed -i 's@CORS_ALLOW_METHODS=.*$@CORS_ALLOW_METHODS=GET, HEAD, POST, OPTIONS@' /etc/bunkerweb/variables.env
sed -i 's@CORS_ALLOW_HEADERS=.*$@CORS_ALLOW_HEADERS=X-Test@' /etc/bunkerweb/variables.env
sudo sed -i 's@GENERATE_SELF_SIGNED_SSL=.*$@GENERATE_SELF_SIGNED_SSL=yes@' /etc/bunkerweb/variables.env
sudo sed -i 's@CORS_ALLOW_ORIGIN=.*$@CORS_ALLOW_ORIGIN=^https://app1\\.example\\.com\$@' /etc/bunkerweb/variables.env
sudo sed -i 's@CORS_EXPOSE_HEADERS=.*$@CORS_EXPOSE_HEADERS=X-Test@' /etc/bunkerweb/variables.env
sudo sed -i 's@CORS_MAX_AGE=.*$@CORS_MAX_AGE=3600@' /etc/bunkerweb/variables.env
sudo sed -i 's@CORS_ALLOW_CREDENTIALS=.*$@CORS_ALLOW_CREDENTIALS=yes@' /etc/bunkerweb/variables.env
sudo sed -i 's@CORS_ALLOW_METHODS=.*$@CORS_ALLOW_METHODS=GET, HEAD, POST, OPTIONS@' /etc/bunkerweb/variables.env
sudo sed -i 's@CORS_ALLOW_HEADERS=.*$@CORS_ALLOW_HEADERS=X-Test@' /etc/bunkerweb/variables.env
export GENERATE_SELF_SIGNED_SSL="yes"
export CORS_ALLOW_ORIGIN="^https://app1\\.example\\.com\$"
export CORS_EXPOSE_HEADERS="X-Test"

View file

@ -43,10 +43,7 @@ try:
print(f" Connecting to database: {database_uri}", flush=True)
try:
sql_engine = create_engine(
database_uri,
future=True,
)
sql_engine = create_engine(database_uri, future=True)
except ArgumentError:
print(f"❌ Invalid database URI: {database_uri}", flush=True)
error = True

View file

@ -410,7 +410,7 @@ do
if [ "$integration" == "docker" ] ; then
docker compose -f docker-compose.test.yml up --abort-on-container-exit --exit-code-from tests
else
python3 main.py
sudo python3 main.py
fi
if [ $? -ne 0 ] ; then