From d8c8ceab360a5eb4fe880d506f64e3dbd5893d45 Mon Sep 17 00:00:00 2001 From: bunkerity Date: Wed, 20 Jul 2022 14:47:23 +0200 Subject: [PATCH] tests - fix LinuxTest setup and init work on integrating examples with the new test system --- .../{docker-compose.yml => autoconf.yml} | 0 examples/autoconf-configs/tests.json | 24 +++++++++++++++++++ .../{docker-compose.yml => autoconf.yml} | 0 .../{setup.sh => setup-autoconf.sh} | 0 examples/autoconf-php/tests.json | 24 +++++++++++++++++++ .../{docker-compose.yml => autoconf.yml} | 0 examples/autoconf-reverse-proxy/tests.json | 24 +++++++++++++++++++ examples/behind-reverse-proxy/tests.json | 14 +++++++++++ tests/LinuxTest.py | 4 ++-- 9 files changed, 88 insertions(+), 2 deletions(-) rename examples/autoconf-configs/{docker-compose.yml => autoconf.yml} (100%) create mode 100644 examples/autoconf-configs/tests.json rename examples/autoconf-php/{docker-compose.yml => autoconf.yml} (100%) rename examples/autoconf-php/{setup.sh => setup-autoconf.sh} (100%) create mode 100644 examples/autoconf-php/tests.json rename examples/autoconf-reverse-proxy/{docker-compose.yml => autoconf.yml} (100%) create mode 100644 examples/autoconf-reverse-proxy/tests.json create mode 100644 examples/behind-reverse-proxy/tests.json diff --git a/examples/autoconf-configs/docker-compose.yml b/examples/autoconf-configs/autoconf.yml similarity index 100% rename from examples/autoconf-configs/docker-compose.yml rename to examples/autoconf-configs/autoconf.yml diff --git a/examples/autoconf-configs/tests.json b/examples/autoconf-configs/tests.json new file mode 100644 index 000000000..898fab247 --- /dev/null +++ b/examples/autoconf-configs/tests.json @@ -0,0 +1,24 @@ +{ + "name": "autoconf-configs", + "kinds": [ + "autoconf" + ], + "timeout": 60, + "tests": [ + { + "type": "string", + "url": "https://app1.example.com/hello", + "string": "app1" + }, + { + "type": "string", + "url": "https://app2.example.com/hello", + "string": "app2" + }, + { + "type": "string", + "url": "https://app3.example.com/hello", + "string": "app3" + } + ] +} \ No newline at end of file diff --git a/examples/autoconf-php/docker-compose.yml b/examples/autoconf-php/autoconf.yml similarity index 100% rename from examples/autoconf-php/docker-compose.yml rename to examples/autoconf-php/autoconf.yml diff --git a/examples/autoconf-php/setup.sh b/examples/autoconf-php/setup-autoconf.sh similarity index 100% rename from examples/autoconf-php/setup.sh rename to examples/autoconf-php/setup-autoconf.sh diff --git a/examples/autoconf-php/tests.json b/examples/autoconf-php/tests.json new file mode 100644 index 000000000..b883f828d --- /dev/null +++ b/examples/autoconf-php/tests.json @@ -0,0 +1,24 @@ +{ + "name": "autoconf-php", + "kinds": [ + "autoconf" + ], + "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" + } + ] +} \ No newline at end of file diff --git a/examples/autoconf-reverse-proxy/docker-compose.yml b/examples/autoconf-reverse-proxy/autoconf.yml similarity index 100% rename from examples/autoconf-reverse-proxy/docker-compose.yml rename to examples/autoconf-reverse-proxy/autoconf.yml diff --git a/examples/autoconf-reverse-proxy/tests.json b/examples/autoconf-reverse-proxy/tests.json new file mode 100644 index 000000000..68a03fbc8 --- /dev/null +++ b/examples/autoconf-reverse-proxy/tests.json @@ -0,0 +1,24 @@ +{ + "name": "autoconf-reverse-proxy", + "kinds": [ + "autoconf" + ], + "timeout": 60, + "tests": [ + { + "type": "string", + "url": "https://app1.example.com", + "string": "hello" + }, + { + "type": "string", + "url": "https://app2.example.com", + "string": "hello" + }, + { + "type": "string", + "url": "https://app3.example.com", + "string": "hello" + } + ] +} \ No newline at end of file diff --git a/examples/behind-reverse-proxy/tests.json b/examples/behind-reverse-proxy/tests.json new file mode 100644 index 000000000..aad171c55 --- /dev/null +++ b/examples/behind-reverse-proxy/tests.json @@ -0,0 +1,14 @@ +{ + "name": "behind-reverse-proxy", + "kinds": [ + "docker" + ], + "timeout": 60, + "tests": [ + { + "type": "string", + "url": "http://www.example.com", + "string": "hello" + } + ] +} \ No newline at end of file diff --git a/tests/LinuxTest.py b/tests/LinuxTest.py index 794f722f4..6a1ee83a5 100644 --- a/tests/LinuxTest.py +++ b/tests/LinuxTest.py @@ -88,10 +88,10 @@ class LinuxTest(Test) : Test.replace_in_files(test, "example.com", getenv("ROOT_DOMAIN")) setup = test + "/setup-linux.sh" if isfile(setup) : - proc = LinuxTest.docker_cp(self.__distro, test, "/opt/tests") + proc = LinuxTest.docker_cp(self.__distro, test, "/opt/" + self._name) if proc.returncode != 0 : raise(Exception("docker cp failed (linux stack)")) - proc = LinuxTest.docker_exec(self.__distro, "cd /opt/tests/ && ./setup-linux.sh") + proc = LinuxTest.docker_exec(self.__distro, "cd /opt/" + self._name + " && ./setup-linux.sh") if proc.returncode != 0 : raise(Exception("docker exec setup failed (linux stack)")) proc = LinuxTest.docker_exec(self.__distro, "systemctl restart bunkerweb")