From 6d5fc84693e6c0971e13aa481b9eedd0e4d72175 Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Sun, 16 Jul 2017 16:19:44 +0200 Subject: [PATCH 1/3] Add an icon to the webpages of example --- example/nginx/docker-compose.yml | 3 +-- example/nginx/html/icon.png | Bin 0 -> 1455 bytes example/nginx/{ => html}/index.html | 2 ++ example/nginx/{ => html}/secret.html | 1 + src/server/views/layout/layout.pug | 2 +- test/integration/docker-compose.yml | 3 +-- 6 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 example/nginx/html/icon.png rename example/nginx/{ => html}/index.html (96%) rename example/nginx/{ => html}/secret.html (75%) diff --git a/example/nginx/docker-compose.yml b/example/nginx/docker-compose.yml index 8857ee3bd..532c3a89a 100644 --- a/example/nginx/docker-compose.yml +++ b/example/nginx/docker-compose.yml @@ -3,8 +3,7 @@ services: nginx: image: nginx:alpine volumes: - - ./example/nginx/index.html:/usr/share/nginx/html/index.html - - ./example/nginx/secret.html:/usr/share/nginx/html/secret.html + - ./example/nginx/html:/usr/share/nginx/html - ./example/nginx/ssl:/etc/ssl - ./example/nginx/nginx.conf:/etc/nginx/nginx.conf ports: diff --git a/example/nginx/html/icon.png b/example/nginx/html/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1b341ee429fe9fa87612ed02574f5422fd5f0b1c GIT binary patch literal 1455 zcmV;g1yK5lP)b@` zH6eUZB72N6hA4(D2vG!UqM)dekXSKDaES2!H-=Dp*G zcE*-Y+nHKC$xG&)d+z`I&VBRFy^j$QLN&&i2p~_COKwV zKN8WcptM2-V2n+a4Thg0qGDna(;hK9PaUZQk$WezG#M8jSHY@#eTE?l~tmaW@JaY@PTk}OvMNPQqq5+rGhB+Kr+mzU6r zjhiVlI;NfDxK)E`bHP+E84SB7q^DcP#Koid)QRqfyR}8CqNEeiUk?IF^HK0ABl zaEC2C0`W=78i1S;0WiiA1W9DF(TJML>zb~4cN0;|aPz#Xx~;nMItKvJA<{IoK;Q&YayuLAvG1gla z0}xv0^1bFga|f8<`_Yn-Gm9hrP_H{5KxOaHolED>ahETg*8qqBT0;UD#{2+|;@{2y zumeELjNHjSKN0O?j2)z&3N#|}JQM(*xn^ds=NRS#n86s!W}}rf{4BY25&?W0E8ivdp$4|tVR0u<5>F` z;aO8RF0EdI=8_8m!zHfgC9qAHXag|8=MSnC2QoTWghZherOTa|Gc6XMu33y-YZjww z`_=)m4pBhC_^|Os`~NrcXFq}V+cnTtrJrA73>H3csu2Tpr%u74TmAQ= z^A%Narlo2j?8a33OHSQL`ZfIbkk8BI{$`3Ub7 z?t;4R7>xE3Oy0T!&djWkWJbIKXuS{P_j`bw*ANkD1E~t?zWfCBMaTXJfP1wt7QBtu z?A2)Akc6X~ve0pEFA85@fTo?>aC`3;{laz7pgY)z08HQR#0NPhYl0}eaF%y@t0Lev$0<@Xsl4%v>d z(E*^^8a$nB01LRg_gLoRX>eb?;=i{EJm!Rt5`fTtAE~w>vIB^9I^b?<3Q8~ZM-b$B zsP7)<@@hES>JAteavvb03EPjm@Oj0*+rO7_S7|w4uGCB z4{ejCp{ Home page +

Access the secret

diff --git a/example/nginx/secret.html b/example/nginx/html/secret.html similarity index 75% rename from example/nginx/secret.html rename to example/nginx/html/secret.html index d16936783..e40f3bd90 100644 --- a/example/nginx/secret.html +++ b/example/nginx/html/secret.html @@ -1,6 +1,7 @@ Secret + This is a very important secret!
diff --git a/src/server/views/layout/layout.pug b/src/server/views/layout/layout.pug index a085cb227..6c017100e 100644 --- a/src/server/views/layout/layout.pug +++ b/src/server/views/layout/layout.pug @@ -4,7 +4,7 @@ html head title Authelia - 2FA meta(name="viewport", content="width=device-width, initial-scale=1.0")/ - link(rel="icon", href="/img/icon.png" type="image/gif" sizes="32x32")/ + link(rel="icon", href="/img/icon.png" type="image/png" sizes="32x32")/ link(rel="stylesheet", type="text/css", href="/css/authelia.min.css")/ if redirection_url diff --git a/test/integration/docker-compose.yml b/test/integration/docker-compose.yml index 9303e2e9d..090a132bc 100644 --- a/test/integration/docker-compose.yml +++ b/test/integration/docker-compose.yml @@ -11,8 +11,7 @@ services: nginx-tests: image: nginx:alpine volumes: - - ./example/nginx/index.html:/usr/share/nginx/html/index.html - - ./example/nginx/secret.html:/usr/share/nginx/html/secret.html + - ./example/nginx/html:/usr/share/nginx/html - ./example/nginx/ssl:/etc/ssl - ./test/integration/nginx.conf:/etc/nginx/nginx.conf expose: From 7fd0f8e1442cdd99043ec4b04be4e68403054e03 Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Sun, 16 Jul 2017 16:20:26 +0200 Subject: [PATCH 2/3] Fix example deployment script --- scripts/example/deploy-example.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/example/deploy-example.sh b/scripts/example/deploy-example.sh index e804face0..4c50d935b 100755 --- a/scripts/example/deploy-example.sh +++ b/scripts/example/deploy-example.sh @@ -3,4 +3,4 @@ DC_SCRIPT=./scripts/example/dc-example.sh $DC_SCRIPT build -$DC_SCRIPT up -d +$DC_SCRIPT up -d redis openldap authelia nginx From c648a482d7b5e8d8dc88235994b20c6ed60892f7 Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Sun, 16 Jul 2017 16:20:59 +0200 Subject: [PATCH 3/3] Tests deployment commands provided to users in README --- scripts/example/check-services.sh | 14 ---- scripts/integration-tests.sh | 113 +++++++++++++++++++----------- 2 files changed, 74 insertions(+), 53 deletions(-) delete mode 100755 scripts/example/check-services.sh diff --git a/scripts/example/check-services.sh b/scripts/example/check-services.sh deleted file mode 100755 index 49a760698..000000000 --- a/scripts/example/check-services.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -service_count=`docker ps -a | grep "Up " | wc -l` - -if [ "${service_count}" -eq "5" ] -then - echo "Service are up and running." - exit 0 -else - echo "Some services exited..." - docker ps -a - exit 1 -fi - diff --git a/scripts/integration-tests.sh b/scripts/integration-tests.sh index 681f58580..4b33a6361 100755 --- a/scripts/integration-tests.sh +++ b/scripts/integration-tests.sh @@ -2,53 +2,88 @@ DC_SCRIPT=./scripts/example/dc-example.sh -run_services() { - $DC_SCRIPT up -d redis openldap - sleep 2 - $DC_SCRIPT up -d authelia nginx nginx-tests +start_services() { + $DC_SCRIPT up -d redis openldap authelia nginx nginx-tests sleep 3 } +shut_services() { + $DC_SCRIPT down +} + +expect_services_count() { + EXPECTED_COUNT=$1 + service_count=`docker ps -a | grep "Up " | wc -l` + + if [ "${service_count}" -eq "$EXPECTED_COUNT" ] + then + echo "Services are up and running." + else + echo "Some services exited..." + docker ps -a + exit 1 + fi +} + +run_integration_tests() { + echo "Prepare nginx-test configuration" + cat example/nginx/nginx.conf | sed 's/listen 443 ssl/listen 8080 ssl/g' | dd of="test/integration/nginx.conf" + + echo "Build services images..." + $DC_SCRIPT build + + echo "Start services..." + start_services + docker ps -a + + echo "Display services logs..." + $DC_SCRIPT logs redis + $DC_SCRIPT logs openldap + $DC_SCRIPT logs nginx + $DC_SCRIPT logs nginx-tests + $DC_SCRIPT logs authelia + + echo "Check number of services" + expect_services_count 5 + + echo "Run integration tests..." + $DC_SCRIPT run --rm integration-tests + + echo "Shutdown services..." + shut_services +} + +run_system_tests() { + echo "Start services..." + start_services + expect_services_count 5 + + ./node_modules/.bin/mocha --compilers ts:ts-node/register --recursive test/system + shut_services +} + +run_other_tests() { + echo "Test dev environment deployment (commands in README)" + npm install --only=dev + ./node_modules/.bin/grunt build-dist + ./scripts/example/deploy-example.sh + expect_services_count 4 +} + + + + + set -e echo "Make sure services are not already running" -$DC_SCRIPT down - +shut_services # Prepare & run integration tests - -echo "Prepare nginx-test configuration" -cat example/nginx/nginx.conf | sed 's/listen 443 ssl/listen 8080 ssl/g' | dd of="test/integration/nginx.conf" - -echo "Build services images..." -$DC_SCRIPT build - -echo "Start services..." -run_services -docker ps -a - -echo "Display services logs..." -$DC_SCRIPT logs redis -$DC_SCRIPT logs openldap -$DC_SCRIPT logs nginx -$DC_SCRIPT logs nginx-tests -$DC_SCRIPT logs authelia - -echo "Check number of services" -./scripts/example/check-services.sh - -echo "Run integration tests..." -$DC_SCRIPT run --rm integration-tests - -echo "Shutdown services..." -$DC_SCRIPT down +run_integration_tests # Prepare & test example from end user perspective +run_system_tests -echo "Start services..." -run_services - -./node_modules/.bin/mocha --compilers ts:ts-node/register --recursive test/system - -$DC_SCRIPT down - +# Other tests like executing the deployment script +run_other_tests