From 863e83bb762eab87f4ffddd358acdea34326e362 Mon Sep 17 00:00:00 2001 From: Sergey Yakubov <sergey.yakubov@desy.de> Date: Wed, 26 May 2021 20:55:25 +0200 Subject: [PATCH] fix test --- broker/src/asapo_broker/server/authorizer.go | 2 +- consumer/api/cpp/src/consumer_impl.cpp | 2 +- .../authorizer/check_authorize/check_windows.bat | 5 ----- .../consumer/consumer_api/check_windows.bat | 2 ++ .../consumer/consumer_api/consumer_api.cpp | 2 +- .../simple_chain_filegen_batches/check_linux.sh | 6 +++--- .../high_avail/broker_mongo_restart/check_linux.sh | 14 ++++++++++---- .../receiver_mongo_restart/check_linux.sh | 8 +++++--- 8 files changed, 23 insertions(+), 18 deletions(-) diff --git a/broker/src/asapo_broker/server/authorizer.go b/broker/src/asapo_broker/server/authorizer.go index 07cf4ddfe..4ff965d05 100644 --- a/broker/src/asapo_broker/server/authorizer.go +++ b/broker/src/asapo_broker/server/authorizer.go @@ -84,7 +84,7 @@ func (a * AsapoAuthorizer) doRequest(req *http.Request) (token Token, err error) } if resp.StatusCode != http.StatusOK { - return token, &HttpError{errors.New("returned " + resp.Status + ": " + string(body)),resp.StatusCode} + return token, &HttpError{errors.New("authorizer returned " + resp.Status + ": " + string(body)),resp.StatusCode} } err = json.Unmarshal(body, &token) diff --git a/consumer/api/cpp/src/consumer_impl.cpp b/consumer/api/cpp/src/consumer_impl.cpp index b6eb00b86..c8358a58c 100644 --- a/consumer/api/cpp/src/consumer_impl.cpp +++ b/consumer/api/cpp/src/consumer_impl.cpp @@ -111,7 +111,7 @@ Error ProcessRequestResponce(const RequestInfo &request, } if (err!=nullptr) { - std::string prefix = "Error processing request" + request.api; + std::string prefix = "Error processing request " + request.host+request.api; err->Prepend(prefix); } return err; diff --git a/tests/automatic/authorizer/check_authorize/check_windows.bat b/tests/automatic/authorizer/check_authorize/check_windows.bat index 45cf77495..66e7cb6d4 100644 --- a/tests/automatic/authorizer/check_authorize/check_windows.bat +++ b/tests/automatic/authorizer/check_authorize/check_windows.bat @@ -1,10 +1,6 @@ set full_name="%1" set short_name="%~nx1" -start /B "" "%full_name%" -config settings.json - -ping 192.0.2.1 -n 1 -w 1000 > nul - mkdir C:\tmp\asapo\asap3\petra3\gpfs\p00\2019\comissioning\c20180508-000-COM20181 mkdir C:\tmp\asapo\beamline\p07\current copy beamtime-metadata-11111111.json C:\tmp\asapo\beamline\p07\current\ /y @@ -25,6 +21,5 @@ call :clean exit /b 1 :clean -Taskkill /IM "%short_name%" /F rmdir /S /Q C:\tmp\asapo\asap3 rmdir /S /Q C:\tmp\asapo\beamline diff --git a/tests/automatic/consumer/consumer_api/check_windows.bat b/tests/automatic/consumer/consumer_api/check_windows.bat index 040bd17ee..edd7a8216 100644 --- a/tests/automatic/consumer/consumer_api/check_windows.bat +++ b/tests/automatic/consumer/consumer_api/check_windows.bat @@ -6,6 +6,8 @@ SET database_name=%beamtime_id%_%data_source% SET mongo_exe="c:\Program Files\MongoDB\Server\4.2\bin\mongo.exe" set token_test_run=%BT_TEST_RUN_RW_TOKEN% +c:\opt\consul\nomad status + for /l %%x in (1, 1, 10) do echo db.data_default.insert({"_id":%%x,"size":6,"name":"%%x","timestamp":0,"source":"none","buf_id":0,"dataset_substream":0,"meta":{"test":10}}) | %mongo_exe% %database_name% || goto :error for /l %%x in (1, 1, 5) do echo db.data_stream1.insert({"_id":%%x,"size":6,"name":"1%%x","timestamp":1000,"source":"none","buf_id":0,"dataset_substream":0,"meta":{"test":10}}) | %mongo_exe% %database_name% || goto :error diff --git a/tests/automatic/consumer/consumer_api/consumer_api.cpp b/tests/automatic/consumer/consumer_api/consumer_api.cpp index b973d0076..26230c932 100644 --- a/tests/automatic/consumer/consumer_api/consumer_api.cpp +++ b/tests/automatic/consumer/consumer_api/consumer_api.cpp @@ -327,7 +327,7 @@ void TestAll(const Args& args) { exit(EXIT_FAILURE); } - consumer->SetTimeout(10000); + consumer->SetTimeout(1000); auto group_id = consumer->GenerateNewGroupId(&err); if (args.datasets == "single") { diff --git a/tests/automatic/full_chain/simple_chain_filegen_batches/check_linux.sh b/tests/automatic/full_chain/simple_chain_filegen_batches/check_linux.sh index 08389b599..070a4bf75 100644 --- a/tests/automatic/full_chain/simple_chain_filegen_batches/check_linux.sh +++ b/tests/automatic/full_chain/simple_chain_filegen_batches/check_linux.sh @@ -35,9 +35,6 @@ echo "db.${beamtime_id}_detector.insert({dummy:1})" | mongo ${beamtime_id}_detec token=`$asapo_tool_bin token -endpoint http://localhost:8400/asapo-authorizer -secret admin_token.key -types read $beamtime_id` -mkdir /tmp/asapo/test_in/processed/test1 -mkdir /tmp/asapo/test_in/processed/test2 - #producer echo "Start producer" mkdir -p ${receiver_folder} @@ -46,6 +43,9 @@ producerid=`echo $!` sleep 1 +mkdir /tmp/asapo/test_in/processed/test1 +mkdir /tmp/asapo/test_in/processed/test2 + echo hello > /tmp/asapo/test_in/processed/test1/file1 echo hello > /tmp/asapo/test_in/processed/test1/file2 echo hello > /tmp/asapo/test_in/processed/test2/file1 diff --git a/tests/automatic/high_avail/broker_mongo_restart/check_linux.sh b/tests/automatic/high_avail/broker_mongo_restart/check_linux.sh index 302423c24..3c5a218c2 100755 --- a/tests/automatic/high_avail/broker_mongo_restart/check_linux.sh +++ b/tests/automatic/high_avail/broker_mongo_restart/check_linux.sh @@ -55,16 +55,22 @@ Cleanup() { influx -execute "drop database ${monitor_database_name}" kill_mongo 27015 || kill_mongo 27016 sed -i 's/27015/27017/g' discovery.json.tpl + nomad stop discovery + nomad run discovery.nmd } -sed -i 's/27017/27016/g' receiver_tcp.json.tpl -sed -i 's/27017/27016/g' discovery.json.tpl -sed -i 's/info/debug/g' broker.json.tpl - start_mongo 27016 wait_mongo 27016 +sed -i 's/27017/27016/g' discovery.json.tpl +nomad stop discovery +nomad run discovery.nmd +nomad stop broker +nomad run broker.nmd + +sleep 2 + token=`$asapo_tool_bin token -endpoint http://localhost:8400/asapo-authorizer -secret admin_token.key -types read $beamtime_id` diff --git a/tests/automatic/high_avail/receiver_mongo_restart/check_linux.sh b/tests/automatic/high_avail/receiver_mongo_restart/check_linux.sh index 1035ccddc..b01c925ef 100644 --- a/tests/automatic/high_avail/receiver_mongo_restart/check_linux.sh +++ b/tests/automatic/high_avail/receiver_mongo_restart/check_linux.sh @@ -28,7 +28,6 @@ function start_mongo { } -database_name=db_test beamtime_id=asapo_test beamline=test @@ -37,14 +36,15 @@ facility=test_facility year=2019 receiver_folder=${receiver_root_folder}/${facility}/gpfs/${beamline}/${year}/data/${beamtime_id} - - Cleanup() { echo cleanup set +e rm -rf ${receiver_root_folder} echo "db.dropDatabase()" | mongo --port 27016 ${beamtime_id}_detector kill_mongo + sed -i 's/27016/27017/g' discovery.json.tpl + nomad stop discovery + nomad run discovery.nmd } start_mongo @@ -55,6 +55,8 @@ wait_mongo echo "db.${beamtime_id}_detector.insert({dummy:1})" | mongo --port 27016 ${beamtime_id}_detector sed -i 's/27017/27016/g' discovery.json.tpl +nomad stop discovery +nomad run discovery.nmd mkdir -p ${receiver_folder} -- GitLab