tests - init cors and fix example_data path for autoconf

This commit is contained in:
bunkerity 2022-07-20 15:07:54 +02:00
parent d8c8ceab36
commit 2033974442
No known key found for this signature in database
GPG key ID: 3D80806F12602A7C
6 changed files with 70 additions and 1 deletions

12
examples/cors/setup-docker.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/bash
if [ $(id -u) -ne 0 ] ; then
echo "❌ Run me as root"
exit 1
fi
chown -R root:101 bw-data
chmod -R 770 bw-data
chown -R 33:101 ./bw-data/www
find ./bw-data/www -type f -exec chmod 0640 {} \;
find ./bw-data/www -type d -exec chmod 0750 {} \;

12
examples/cors/setup-linux.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/bash
if [ $(id -u) -ne 0 ] ; then
echo "❌ Run me as root"
exit 1
fi
chown -R www-data:nginx ./bw-data/www
find ./bw-data/www -type f -exec chmod 0640 {} \;
find ./bw-data/www -type d -exec chmod 0750 {} \;
cp -rp ./bw-data/www/* /opt/bunkerweb/www
cp variables.env /opt/bunkerweb/variables.env

26
examples/cors/tests.json Normal file
View file

@ -0,0 +1,26 @@
{
"name": "cors",
"kinds": [
"docker",
"autoconf",
"linux"
],
"timeout": 60,
"tests": [
{
"type": "string",
"url": "https://app1.example.com",
"string": "app1"
},
{
"type": "string",
"url": "https://app2.example.com",
"string": "app2"
},
{
"type": "string",
"url": "https://app3.example.com",
"string": "app3"
}
]
}

View file

@ -0,0 +1,19 @@
HTTP_PORT=80
HTTPS_PORT=443
DNS_RESOLVERS=8.8.8.8 8.8.4.4
MULTISITE=yes
# Replace with your domains
SERVER_NAME=app1.example.com app2.example.com app3.example.com
AUTO_LETS_ENCRYPT=yes
DISABLE_DEFAULT_SERVER=yes
USE_CLIENT_CACHE=yes
USE_GZIP=yes
app1.example.com_USE_CORS=yes
app1.example.com_CORS_ALLOW_ORIGIN=https://app2.example.com
app1.example.com_ALLOWED_METHODS=GET|POST|HEAD|OPTIONS
app1.example.com_REMOTE_PHP=myapp1
app1.example.com_REMOTE_PHP_PATH=/app
app2.example.com_REMOTE_PHP=myapp2
app2.example.com_REMOTE_PHP_PATH=/app
app3.example.com_REMOTE_PHP=myapp3
app3.example.com_REMOTE_PHP_PATH=/app

View file

@ -76,7 +76,7 @@ class AutoconfTest(Test) :
super()._setup_test()
test = "/tmp/tests/" + self._name
compose = "/tmp/tests/" + self._name + "/autoconf.yml"
example_data = "./examples/" + self._name + "/bw-data"
example_data = "/tmp/tests/" + self._name + "/bw-data"
Test.replace_in_file(compose, r"bunkerity/bunkerweb:.*$", "10.20.1.1:5000/bw-tests:latest")
Test.replace_in_file(compose, r"\./bw\-data:/", "/tmp/bw-data:/")
Test.replace_in_file(compose, r"\- bw_data:/", "- /tmp/bw-data:/")