From 621ab7c4888e8a2d289beaadbeed9aea14709abb Mon Sep 17 00:00:00 2001 From: Eitaro Fukamachi Date: Sun, 11 Aug 2024 14:18:33 +0000 Subject: [PATCH] Run testing also for HTTPS. --- .github/workflows/ci.yml | 4 ++++ .gitignore | 1 + t/generate-certificates.sh | 15 +++++++++++++++ t/woo.lisp | 8 ++++++++ 4 files changed, 28 insertions(+) create mode 100755 t/generate-certificates.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fda98ca..1d85415 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,8 @@ jobs: - uses: actions/checkout@v4 - name: Install dependencies from APT run: sudo apt-get install -y libev-dev gcc libc6-dev + - name: Generate server certificates + run: sh ./t/generate-certificates.sh - name: Install Roswell env: LISP: ${{ matrix.lisp }} @@ -24,6 +26,8 @@ jobs: run: ros -e '(ql-dist:install-dist "http://dist.ultralisp.org/" :prompt nil)' - name: Install Rove run: ros install rove + - name: Install the latest Clack (for HTTPS testing with clack-test) + run: ros install fukamachi/clack - name: Run tests env: LISP: ${{ matrix.lisp }} diff --git a/.gitignore b/.gitignore index 571c025..d80ccf3 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ benchmark/benchmark.log .qlot/ qlfile qlfile.lock +t/certs/ diff --git a/t/generate-certificates.sh b/t/generate-certificates.sh new file mode 100755 index 0000000..0a2a22f --- /dev/null +++ b/t/generate-certificates.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +mkdir t/certs +cd t/certs + +openssl genrsa -out localCA.key 2048 +openssl req -batch -new -key localCA.key -out localCA.csr \ + -subj "/C=JP/ST=Tokyo/L=Chuo-ku/O=\"Woo\"/OU=Development/CN=localhost" +openssl x509 -req -days 3650 -signkey localCA.key -in localCA.csr -out localCA.crt +openssl x509 -text -noout -in localCA.crt +openssl genrsa -out localhost.key 2048 +openssl req -batch -new -key localhost.key -out localhost.csr \ + -subj "/C=JP/ST=Tokyo/L=Chuo-ku/O=\"Woo\"/OU=Development/CN=localhost" +echo 'subjectAltName = DNS:localhost, DNS:localhost.localdomain, IP:127.0.0.1, DNS:app, DNS:app.localdomain' > localhost.csx +openssl x509 -req -days 1825 -CA localCA.crt -CAkey localCA.key -CAcreateserial -in localhost.csr -extfile localhost.csx -out localhost.crt diff --git a/t/woo.lisp b/t/woo.lisp index 04b4202..cb2a3f3 100644 --- a/t/woo.lisp +++ b/t/woo.lisp @@ -6,3 +6,11 @@ (deftest woo-server-tests (clack.test.suite:run-server-tests :woo)) + +(deftest woo-ssl-server-tests + (let ((clack.test:*clackup-additional-args* + '(:ssl-cert-file #P"t/certs/localhost.crt" + :ssl-key-file #P"t/certs/localhost.key")) + (dex:*not-verify-ssl* t) + (clack.test:*use-https* t)) + (clack.test.suite:run-server-tests :woo)))