Skip to content

Commit

Permalink
integration tests: add basic test for Ruby rack
Browse files Browse the repository at this point in the history
  • Loading branch information
niol committed Oct 7, 2024
1 parent bed84a1 commit 493b1b6
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion buildconf/integration-tests.ini
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions t/rack/app.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class App

def call(environ)
[200, {'Content-Type' => 'text/html'}, ['Hello']]
end

end

run App.new
15 changes: 15 additions & 0 deletions t/runner
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ class UwsgiTest(unittest.TestCase):
def test_psgi_helloworld(self):
self.start_listen_server(
[
"--need-app=0",
"--plugins",
"0:cgi",
"--cgi",
Expand All @@ -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()

0 comments on commit 493b1b6

Please sign in to comment.