Skip to content

Commit

Permalink
Test debian package
Browse files Browse the repository at this point in the history
  • Loading branch information
ctz committed Apr 30, 2024
1 parent 610cff7 commit e9461b7
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
11 changes: 11 additions & 0 deletions rustls-libssl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ target/VERSION: ALWAYS
echo "This is rustls-libssl `git describe --always`\nDate: `date`\nIncorporating:" > $@
$(CARGO) tree >> $@

test-package-deb: package-deb
mkdir -p target/dist/test/ubuntu-22
cp target/dist/rustls-libssl_*.deb \
dist/test/deb-ubuntu-22/* \
test-ca/rsa/server.key \
test-ca/rsa/server.cert \
test-ca/rsa/ca.cert \
target/dist/test/ubuntu-22
docker build -t $@ target/dist/test/ubuntu-22
cd target/dist/test/ubuntu-22 && ./run-test.sh $@

ALWAYS: ;

.PHONY: all clean test integration format format-check package package-deb
14 changes: 14 additions & 0 deletions rustls-libssl/dist/test/deb-ubuntu-22/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y curl nginx
ADD rustls-libssl_*.deb /root
ADD --chown=nobody:nogroup server.cert /
ADD --chown=nobody:nogroup server.key /
ADD ca.cert /root
ADD nginx.conf /etc/nginx/sites-enabled/default
RUN dpkg -i /root/rustls-libssl_*.deb

# nb, this only affects systemd runs, but check it works at least
RUN rustls-libssl-nginx enable

CMD /usr/bin/with-rustls-libssl nginx -g 'env LD_LIBRARY_PATH; daemon off;'
10 changes: 10 additions & 0 deletions rustls-libssl/dist/test/deb-ubuntu-22/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
server {
listen 443 ssl;
ssl_certificate /server.cert;
ssl_certificate_key /server.key;
server_name localhost;

location = / {
return 200 "hello world\n";
}
}
14 changes: 14 additions & 0 deletions rustls-libssl/dist/test/deb-ubuntu-22/run-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

set -e
TAG=$1

docker run -i -p 8443:443 $1 &
DOCKER_ID=$!
sleep 2

curl --cacert ca.cert https://localhost:8443/ > output.got
echo 'hello world' > output.want

kill $DOCKER_ID
diff -su output.want output.got

0 comments on commit e9461b7

Please sign in to comment.