From 493b1b6a53093a63c59439afeb6c67850175a900 Mon Sep 17 00:00:00 2001 From: Alexandre Rossi Date: Mon, 7 Oct 2024 16:28:53 +0200 Subject: [PATCH] integration tests: add basic test for Ruby rack --- .github/workflows/test.yml | 3 ++- buildconf/integration-tests.ini | 2 +- t/rack/app.ru | 9 +++++++++ t/runner | 15 +++++++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 t/rack/app.ru diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ae43183de..83e476188 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,7 +30,8 @@ jobs: sudo apt install --no-install-recommends -qqyf \ libpcre2-dev libjansson-dev libcap2-dev \ php-dev libphp-embed libargon2-dev libsodium-dev \ - pypy3 default-jdk-headless libperl-dev + pypy3 default-jdk-headless libperl-dev \ + ruby-dev ruby-rack - uses: actions/checkout@v4 - name: Set env run: echo "PROFILE=integration-tests" >> $GITHUB_ENV diff --git a/buildconf/integration-tests.ini b/buildconf/integration-tests.ini index c5295af20..cf92e64a0 100644 --- a/buildconf/integration-tests.ini +++ b/buildconf/integration-tests.ini @@ -1,4 +1,4 @@ [uwsgi] inherit = base main_plugin = -plugins = notfound,python,php,pypy,jvm,jwsgi,psgi,cgi +plugins = notfound,python,php,pypy,jvm,jwsgi,psgi,cgi,rack diff --git a/t/rack/app.ru b/t/rack/app.ru new file mode 100644 index 000000000..6a4323e18 --- /dev/null +++ b/t/rack/app.ru @@ -0,0 +1,9 @@ +class App + + def call(environ) + [200, {'Content-Type' => 'text/html'}, ['Hello']] + end + +end + +run App.new diff --git a/t/runner b/t/runner index 92933fc1f..0a052e62b 100755 --- a/t/runner +++ b/t/runner @@ -191,6 +191,7 @@ class UwsgiTest(unittest.TestCase): def test_psgi_helloworld(self): self.start_listen_server( [ + "--need-app=0", "--plugins", "0:cgi", "--cgi", @@ -201,6 +202,20 @@ class UwsgiTest(unittest.TestCase): with requests.get(f"http://{UWSGI_HTTP}/foobar/say_hello") as r: self.assertEqual(r.text, "Hello world!\nPATH_INFO=/foobar/say_hello\n") + @unittest.skipUnless(*plugins_available(["rack"])) + def test_rack_helloworld(self): + self.start_listen_server( + [ + "--plugins", + "0:rack", + "--rack", + os.path.join(TESTS_DIR, "rack", "app.ru"), + ] + ) + + with requests.get(f"http://{UWSGI_HTTP}/") as r: + self.assertEqual(r.text, "Hello") + if __name__ == "__main__": unittest.main()