Browse Source

Make who-are-you & cl-camp4 exercises work offline

pull/685/head
xpetit 4 years ago
parent
commit
93cc5e15b1
  1. 4
      sh/tests/Caddyfile
  2. 18
      sh/tests/Dockerfile
  3. 5
      sh/tests/cl-camp4_test.sh
  4. 5
      sh/tests/who-are-you_test.sh

4
sh/tests/Caddyfile

@ -0,0 +1,4 @@
{$DOMAIN}
tls internal
encode zstd gzip
file_server

18
sh/tests/Dockerfile

@ -1,6 +1,22 @@
FROM debian:10.5-slim FROM debian:10.5-slim
RUN apt-get update RUN apt-get update
RUN apt-get -y install jq curl git RUN apt-get -y install jq curl
WORKDIR /app/assets/superhero
RUN curl --remote-name --location https://demo.01-edu.org/assets/superhero/all.json
WORKDIR /tmp/installation
RUN curl --remote-name --location https://github.com/caddyserver/caddy/releases/download/v2.2.1/caddy_2.2.1_linux_amd64.tar.gz
RUN tar xf caddy_2.2.1_linux_amd64.tar.gz
RUN mv caddy /usr/local/bin
RUN apt-get -y install libcap2-bin
RUN setcap 'cap_net_bind_service=+ep' /usr/local/bin/caddy
WORKDIR /app
RUN rm -rf /tmp/installation
COPY . /app COPY . /app
ENTRYPOINT ["/app/entrypoint.sh"] ENTRYPOINT ["/app/entrypoint.sh"]

5
sh/tests/cl-camp4_test.sh

@ -5,6 +5,9 @@ set -euo pipefail
IFS=' IFS='
' '
echo insecure >> ~/.curlrc
caddy start &>/dev/null
challenge() { challenge() {
submitted=$(./student/myfamily.sh) submitted=$(./student/myfamily.sh)
expected=$(./solutions/myfamily.sh) expected=$(./solutions/myfamily.sh)
@ -14,3 +17,5 @@ challenge() {
HERO_ID=1 challenge HERO_ID=1 challenge
HERO_ID=70 challenge HERO_ID=70 challenge
caddy stop &>/dev/null

5
sh/tests/who-are-you_test.sh

@ -5,7 +5,12 @@ set -euo pipefail
IFS=' IFS='
' '
echo insecure >> ~/.curlrc
caddy start &>/dev/null
submitted=$(./student/who-are-you.sh) submitted=$(./student/who-are-you.sh)
expected=$(./solutions/who-are-you.sh) expected=$(./solutions/who-are-you.sh)
caddy stop &>/dev/null
diff <(echo "$submitted") <(echo "$expected") diff <(echo "$submitted") <(echo "$expected")

Loading…
Cancel
Save