diff options
Diffstat (limited to 'test/mocks/datafilecollector-testharness/simulator-group')
5 files changed, 38 insertions, 2 deletions
diff --git a/test/mocks/datafilecollector-testharness/simulator-group/README.md b/test/mocks/datafilecollector-testharness/simulator-group/README.md index 98b26bc86..545776a24 100644 --- a/test/mocks/datafilecollector-testharness/simulator-group/README.md +++ b/test/mocks/datafilecollector-testharness/simulator-group/README.md @@ -102,7 +102,7 @@ in the script need to be manually adapted to for each specific simulator behavio parameters. All simulators will be started with the generated docker-compose.yml file -To generate an ftp/http/https url with an IP different from localhost, set the SFTP_SIM_IP and/or FTPES_SIM_IP and/or HTTP_SIM_IP and/or HTTPS_SIM_IP and/or HTTPS_SIM_NO_AUTH_IP env variables to the address(es) of the ftp/http/https servers before starting. +To generate an ftp/http/https url with an IP different from localhost, set the SFTP_SIM_IP and/or FTPES_SIM_IP and/or HTTP_SIM_IP and/or HTTPS_SIM_IP and/or HTTPS_SIM_NO_AUTH_IP and/or HTTP_JWT_SIM_IP and/or HTTPS_JWT_SIM_IP env variables to the address(es) of the ftp/http/https servers before starting. So far, this only works when the simulator python script is started from the command line. Kill all the containers with `simulators-kill.se` diff --git a/test/mocks/datafilecollector-testharness/simulator-group/docker-compose-setup.sh b/test/mocks/datafilecollector-testharness/simulator-group/docker-compose-setup.sh index d5b36ec58..9f531f447 100755 --- a/test/mocks/datafilecollector-testharness/simulator-group/docker-compose-setup.sh +++ b/test/mocks/datafilecollector-testharness/simulator-group/docker-compose-setup.sh @@ -40,8 +40,10 @@ export BASIC_AUTH_PASSWORD=demo123456! export SFTP_SIMS="localhost:21,localhost:22,localhost:23,localhost:24,localhost:25" # Comma separated list for SFTP servers host:port export FTPES_SIMS="localhost:1022,localhost:1023,localhost:1024,localhost:1026,localhost:1026" # Comma separated list for FTPES servers host:port export HTTP_SIMS="localhost:81,localhost:82,localhost:83,localhost:84,localhost:85" # Comma separated list for HTTP servers host:port +export HTTP_JWT_SIMS="localhost:32001,localhost:32002,localhost:32003,localhost:32004,localhost:32005" # Comma separated list for HTTP JWT servers host:port export HTTPS_SIMS="localhost:444,localhost:445,localhost:446,localhost:447,localhost:448" # Comma separated list for HTTPS (enabling client certificate authorization and basic authorization) servers host:port export HTTPS_SIMS_NO_AUTH="localhost:8081,localhost:8082,localhost:8083,localhost:8084,localhost:8085" # Comma separated list for HTTPS (with no authorization) servers host:port +export HTTPS_JWT_SIMS="localhost:32101,localhost:32102,localhost:32103,localhost:32104,localhost:32105" # Comma separated list for HTTPS JWT servers host:port export DR_REDIR_SIM="localhost" # Hostname of DR redirect server diff --git a/test/mocks/datafilecollector-testharness/simulator-group/docker-compose-template.yml b/test/mocks/datafilecollector-testharness/simulator-group/docker-compose-template.yml index 537012afb..7193c6ce2 100644 --- a/test/mocks/datafilecollector-testharness/simulator-group/docker-compose-template.yml +++ b/test/mocks/datafilecollector-testharness/simulator-group/docker-compose-template.yml @@ -78,8 +78,10 @@ services: SFTP_SIMS: ${SFTP_SIMS} FTPES_SIMS: ${FTPES_SIMS} HTTP_SIMS: ${HTTP_SIMS} + HTTP_JWT_SIMS: ${HTTP_JWT_SIMS} HTTPS_SIMS: ${HTTPS_SIMS} HTTPS_SIMS_NO_AUTH: ${HTTPS_SIMS_NO_AUTH} + HTTPS_JWT_SIMS: ${HTTPS_JWT_SIMS} NUM_FTP_SERVERS: ${NUM_FTP_SERVERS} NUM_HTTP_SERVERS: ${NUM_HTTP_SERVERS} MR_GROUPS: ${MR_GROUPS} @@ -239,6 +241,8 @@ services: - "81:80" - "444:443" - "8081:8080" + - "32001:32000" + - "32101:32100" restart: on-failure volumes: - ./../certservice/generated-certs/apache-pem:/usr/local/apache2/certs/:rw @@ -252,6 +256,8 @@ services: - "82:80" - "445:443" - "8082:8080" + - "32002:32000" + - "32102:32100" restart: on-failure volumes: - ./../certservice/generated-certs/apache-pem:/usr/local/apache2/certs/:rw @@ -265,6 +271,8 @@ services: - "83:80" - "446:443" - "8083:8080" + - "32003:32000" + - "32103:32100" restart: on-failure volumes: - ./../certservice/generated-certs/apache-pem:/usr/local/apache2/certs/:rw @@ -278,6 +286,8 @@ services: - "84:80" - "447:443" - "8084:8080" + - "32004:32000" + - "32104:32100" restart: on-failure volumes: - ./../certservice/generated-certs/apache-pem:/usr/local/apache2/certs/:rw @@ -291,6 +301,8 @@ services: - "85:80" - "448:443" - "8085:8080" + - "32005:32000" + - "32105:32100" restart: on-failure volumes: - ./../certservice/generated-certs/apache-pem:/usr/local/apache2/certs/:rw diff --git a/test/mocks/datafilecollector-testharness/simulator-group/setup-http-files-for-image.sh b/test/mocks/datafilecollector-testharness/simulator-group/setup-http-files-for-image.sh index 9d54bc3ef..1a83dd143 100755 --- a/test/mocks/datafilecollector-testharness/simulator-group/setup-http-files-for-image.sh +++ b/test/mocks/datafilecollector-testharness/simulator-group/setup-http-files-for-image.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash # Script to create files for the HTTP server to return upon request. # The file names matches the files names in the events polled from the MR simulator. diff --git a/test/mocks/datafilecollector-testharness/simulator-group/simulators-start.sh b/test/mocks/datafilecollector-testharness/simulator-group/simulators-start.sh index 69d47354e..71767ffa9 100755 --- a/test/mocks/datafilecollector-testharness/simulator-group/simulators-start.sh +++ b/test/mocks/datafilecollector-testharness/simulator-group/simulators-start.sh @@ -45,6 +45,18 @@ http_https_server_check() { echo "Simulator " $1 " on localhost:$2 - no response" } +http_https_jwt_server_check() { + for i in {1..10}; do + res=$(curl $4 -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkZW1vIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjk5OTk5OTk5OTksIm5iZiI6MTUxNjIzOTAyMH0.vyktOJyCMVvJXEfImBuZCTaEifrvH0kXeAPpnHakffA' -s -o /dev/null -w "%{http_code}" $3://localhost:$2) + if [ $res -gt 199 ] && [ $res -lt 300 ]; then + echo "Simulator " $1 " on localhost:$2 responded ok" + return + fi + sleep 1 + done + echo "Simulator " $1 " on localhost:$2 - no response" +} + server_check_https() { for i in {1..10}; do res=$(curl -k -s -o /dev/null -w "%{http_code}" https://localhost:$2$3) @@ -199,6 +211,11 @@ http_https_basic_server_check "HTTP basic auth server 1" 82 http http_https_basic_server_check "HTTP basic auth server 2" 83 http http_https_basic_server_check "HTTP basic auth server 3" 84 http http_https_basic_server_check "HTTP basic auth server 4" 85 http +http_https_jwt_server_check "HTTP JWT server 0" 32001 http +http_https_jwt_server_check "HTTP JWT server 1" 32002 http +http_https_jwt_server_check "HTTP JWT server 2" 32003 http +http_https_jwt_server_check "HTTP JWT server 3" 32004 http +http_https_jwt_server_check "HTTP JWT server 4" 32005 http http_https_basic_server_check "HTTPS basic auth server 0" 444 https -k http_https_basic_server_check "HTTPS basic auth server 1" 445 https -k http_https_basic_server_check "HTTPS basic auth server 2" 446 https -k @@ -214,6 +231,11 @@ http_https_server_check "HTTPS no auth server 1" 8082 https -k http_https_server_check "HTTPS no auth server 2" 8083 https -k http_https_server_check "HTTPS no auth server 3" 8084 https -k http_https_server_check "HTTPS no auth server 4" 8085 https -k +http_https_jwt_server_check "HTTPS JWT server 0" 32101 https -k +http_https_jwt_server_check "HTTPS JWT server 1" 32102 https -k +http_https_jwt_server_check "HTTPS JWT server 2" 32103 https -k +http_https_jwt_server_check "HTTPS JWT server 3" 32104 https -k +http_https_jwt_server_check "HTTPS JWT server 4" 32105 https -k echo "" |