diff --git a/CMakeModules/prepare_asapo.cmake b/CMakeModules/prepare_asapo.cmake index 7ef66d96fc259d1a812691f43e245a7d2205164f..66c7e52517e3af216024fe3c1b3896d0ce37ddac 100644 --- a/CMakeModules/prepare_asapo.cmake +++ b/CMakeModules/prepare_asapo.cmake @@ -27,6 +27,8 @@ function(prepare_asapo) configure_file(${CMAKE_SOURCE_DIR}/tests/automatic/settings/authorizer_settings.json.tpl.win authorizer.json.tpl COPYONLY) configure_file(${CMAKE_SOURCE_DIR}/tests/automatic/common_scripts/start_services.bat start_services.bat COPYONLY) configure_file(${CMAKE_SOURCE_DIR}/tests/automatic/common_scripts/stop_services.bat stop_services.bat COPYONLY) + configure_file(${CMAKE_SOURCE_DIR}/tests/automatic/common_scripts/start_authorizer.bat start_authorizer.bat COPYONLY) + configure_file(${CMAKE_SOURCE_DIR}/tests/automatic/common_scripts/stop_authorizer.bat stop_authorizer.bat COPYONLY) configure_file(${CMAKE_SOURCE_DIR}/config/nomad/receiver_tcp.nmd.in receiver_tcp.nmd @ONLY) configure_file(${CMAKE_SOURCE_DIR}/config/nomad/nginx_kill_win.nmd nginx_kill.nmd @ONLY) diff --git a/tests/automatic/broker/get_last/check_windows.bat b/tests/automatic/broker/get_last/check_windows.bat index 6ffe451b5789577ee2de913cf9ca6fbb56d28d0a..0de73dda41882495abd00f018a2f24ca87aaf9cc 100644 --- a/tests/automatic/broker/get_last/check_windows.bat +++ b/tests/automatic/broker/get_last/check_windows.bat @@ -7,10 +7,7 @@ echo db.data_default.insert({"_id":2}) | %mongo_exe% %database_name% || goto :e set full_name="%1" set short_name="%~nx1" -c:\opt\consul\nomad run authorizer.nmd -c:\opt\consul\nomad run nginx.nmd - -ping 192.0.2.1 -n 1 -w 2000 > nul +call start_authorizer.bat start /B "" "%full_name%" -config settings.json @@ -53,6 +50,4 @@ exit /b 1 Taskkill /IM "%short_name%" /F echo db.dropDatabase() | %mongo_exe% %database_name% del /f groupid -c:\opt\consul\nomad stop authorizer -c:\opt\consul\nomad stop nginx -c:\opt\consul\nomad run nginx_kill.nmd && c:\opt\consul\nomad stop -yes -purge nginx_kill +call stop_authorizer.bat diff --git a/tests/automatic/broker/get_meta/check_windows.bat b/tests/automatic/broker/get_meta/check_windows.bat index c5dab94bb7b03fb541d4e14e44d360a8171f3327..9e1e9e8d929aea59bf9183230cf6e3bc63acc993 100644 --- a/tests/automatic/broker/get_meta/check_windows.bat +++ b/tests/automatic/broker/get_meta/check_windows.bat @@ -6,10 +6,7 @@ echo db.meta.insert({"_id":0}) | %mongo_exe% %database_name% || goto :error set full_name="%1" set short_name="%~nx1" -c:\opt\consul\nomad run authorizer.nmd -c:\opt\consul\nomad run nginx.nmd - -ping 192.0.2.1 -n 1 -w 2000 > nul +call start_authorizer.bat start /B "" "%full_name%" -config settings.json @@ -32,6 +29,4 @@ exit /b 1 Taskkill /IM "%short_name%" /F echo db.dropDatabase() | %mongo_exe% %database_name% del /f groupid -c:\opt\consul\nomad stop authorizer -c:\opt\consul\nomad stop nginx -c:\opt\consul\nomad run nginx_kill.nmd && c:\opt\consul\nomad stop -yes -purge nginx_kill +call stop_authorizer.bat diff --git a/tests/automatic/broker/get_next/check_windows.bat b/tests/automatic/broker/get_next/check_windows.bat index 81330cd76affe7defc6a0a30e6ae57cdf1b03976..b32059d4fa1877cb5da876a37f3d6231f00c345b 100644 --- a/tests/automatic/broker/get_next/check_windows.bat +++ b/tests/automatic/broker/get_next/check_windows.bat @@ -9,10 +9,7 @@ set short_name="%~nx1" set token=%BT_DATA_TOKEN% -c:\opt\consul\nomad run authorizer.nmd -c:\opt\consul\nomad run nginx.nmd - -ping 192.0.2.1 -n 1 -w 2000 > nul +call start_authorizer.bat start /B "" "%full_name%" -config settings.json @@ -39,6 +36,4 @@ Taskkill /IM "%short_name%" /F echo db.dropDatabase() | %mongo_exe% %database_name% del /f token del /f groupid -c:\opt\consul\nomad stop authorizer -c:\opt\consul\nomad stop nginx -c:\opt\consul\nomad run nginx_kill.nmd && c:\opt\consul\nomad stop -yes -purge nginx_kill +call stop_authorizer.bat diff --git a/tests/automatic/common_scripts/start_authorizer.bat b/tests/automatic/common_scripts/start_authorizer.bat new file mode 100644 index 0000000000000000000000000000000000000000..de5ada62fd36bcc868e23b0831c2883fc0eb40c2 --- /dev/null +++ b/tests/automatic/common_scripts/start_authorizer.bat @@ -0,0 +1,24 @@ +c:\opt\consul\nomad run authorizer.nmd +c:\opt\consul\nomad run nginx.nmd + +ping 192.0.2.1 -n 1 -w 3000 > nul + +set i=0 +:repeat +set /a i=%i%+1 +echo %i% +if %i% EQU 20 ( + goto :error +) +ping 192.0.2.1 -n 1 -w 1000 >nul +curl --silent --data "" 127.0.0.1:8400/asapo-authorizer/authorize --stderr - | findstr /c:"Bad Request" || goto :repeat +echo asapo services ready + +goto :clean + +:error +echo error starting asapo services +call :clean +exit /b 1 + +:clean diff --git a/tests/automatic/common_scripts/start_services.bat b/tests/automatic/common_scripts/start_services.bat index cbe15b437378469b298ce4355f6bd4ffa592ef4b..452c5937b596e59ef8c4802d4ba8defb5eb4a495 100644 --- a/tests/automatic/common_scripts/start_services.bat +++ b/tests/automatic/common_scripts/start_services.bat @@ -20,3 +20,11 @@ curl --silent --fail 127.0.0.1:8400/asapo-discovery/v0.1/asapo-receiver?protocol curl --silent --fail 127.0.0.1:8400/asapo-discovery/v0.1/asapo-broker?protocol=v0.1 --stderr - | findstr 127.0.0.1 || goto :repeat curl --silent --fail 127.0.0.1:8400/asapo-discovery/v0.1/asapo-file-transfer?protocol=v0.1 --stderr - | findstr 127.0.0.1 || goto :repeat echo discovery ready + +goto :clean + +:error +echo error starting asapo services +exit /b 1 + +:clean diff --git a/tests/automatic/common_scripts/stop_authorizer.bat b/tests/automatic/common_scripts/stop_authorizer.bat new file mode 100644 index 0000000000000000000000000000000000000000..27b0b30b9ed382e7baee3527e78d392cddea5c1e --- /dev/null +++ b/tests/automatic/common_scripts/stop_authorizer.bat @@ -0,0 +1,3 @@ +c:\opt\consul\nomad stop authorizer +c:\opt\consul\nomad stop nginx +c:\opt\consul\nomad run nginx_kill.nmd && c:\opt\consul\nomad stop -yes -purge nginx_kill