Skip to content
Snippets Groups Projects
Commit 6d997cf1 authored by Sergey Yakubov's avatar Sergey Yakubov
Browse files

add test for raw source

parent 239b2a8e
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@ add_subdirectory(simple_chain_metadata)
add_subdirectory(two_beamlines)
add_subdirectory(two_streams)
add_subdirectory(simple_chain_filegen)
add_subdirectory(simple_chain_raw)
add_subdirectory(simple_chain_filegen_batches)
add_subdirectory(simple_chain_filegen_multisource)
add_subdirectory(simple_chain_filegen_readdata_cache)
......
set(TARGET_NAME full_chain_simple_chain_raw)
################################
# Testing
################################
prepare_asapo()
add_script_test("${TARGET_NAME}" "$<TARGET_FILE:dummy-data-producer> $<TARGET_FILE:getnext_broker> $<TARGET_PROPERTY:asapo,EXENAME>" nomem)
#!/usr/bin/env bash
set -e
trap Cleanup EXIT
beamtime_id=asapo_test
token=`$3 token -secret auth_secret.key $beamtime_id`
monitor_database_name=db_test
proxy_address=127.0.0.1:8400
beamline=test
receiver_root_folder=/tmp/asapo/receiver/files
facility=test_facility
year=2019
receiver_folder=${receiver_root_folder}/beamline/${beamline}/current
Cleanup() {
echo cleanup
rm -rf ${receiver_root_folder}
nomad stop nginx
nomad run nginx_kill.nmd && nomad stop -yes -purge nginx_kill
nomad stop receiver
nomad stop discovery
nomad stop broker
nomad stop authorizer
rm -rf out
# kill $producerid
# echo "db.dropDatabase()" | mongo ${beamtime_id}_detector
influx -execute "drop database ${monitor_database_name}"
}
echo "db.${beamtime_id}_detector.insert({dummy:1})" | mongo ${beamtime_id}_detector
echo "db.dropDatabase()" | mongo ${beamtime_id}_detector
nomad run nginx.nmd
nomad run authorizer.nmd
nomad run receiver.nmd
nomad run discovery.nmd
nomad run broker.nmd
sleep 1
#producer
mkdir -p ${receiver_folder}
$1 localhost:8400 ${beamtime_id} 100 1000 4 100 100
#producerid=`echo $!`
$2 ${proxy_address} ${receiver_folder} ${beamtime_id} 2 $token 5000 1 > out
cat out
cat out | grep "Processed 1000 file(s)"
SET mongo_exe="c:\Program Files\MongoDB\Server\4.2\bin\mongo.exe"
SET beamtime_id=asapo_test
SET beamline=test
SET receiver_root_folder=c:\tmp\asapo\receiver\files
SET receiver_folder="%receiver_root_folder%\beamline\%beamline%\current"
"%3" token -secret auth_secret.key %beamtime_id% > token
set /P token=< token
set proxy_address="127.0.0.1:8400"
echo db.%beamtime_id%_detector.insert({dummy:1}) | %mongo_exe% %beamtime_id%_detector
call start_services.bat
REM producer
mkdir %receiver_folder%
start /B "" "%1" %proxy_address% %beamtime_id% 100 1000 4 100 100
ping 1.0.0.0 -n 1 -w 100 > nul
REM consumer
"%2" %proxy_address% %receiver_folder% %beamtime_id% 2 %token% 5000 1 > out.txt
type out.txt
findstr /i /l /c:"Processed 1000 file(s)" out.txt || goto :error
goto :clean
:error
call :clean
exit /b 1
:clean
call stop_services.bat
rmdir /S /Q %receiver_root_folder%
del /f token
echo db.dropDatabase() | %mongo_exe% %beamtime_id%_detector
{
"Port": {{ env "NOMAD_PORT_authorizer" }},
"LogLevel":"debug",
"AlwaysAllowedBeamtimes":[{"beamtimeId":"asapo_test","beamline":"test","core-path":"/tmp/asapo/receiver/files/test_facility/gpfs/test/2019/data/asapo_test"},
"AlwaysAllowedBeamtimes":[{"beamtimeId":"asapo_test","beamline":"test","core-path":"/tmp/asapo/receiver/files/test_facility/gpfs/test/2019/data/asapo_test",
"beamline-path":"/tmp/asapo/receiver/files/beamline/test/current"},
{"beamtimeId":"asapo_test1","beamline":"test1","core-path":"/tmp/asapo/receiver/files/test_facility/gpfs/test1/2019/data/asapo_test1"},
{"beamtimeId":"asapo_test2","beamline":"test2","core-path":"/tmp/asapo/receiver/files/test_facility/gpfs/test2/2019/data/asapo_test2"}],
"SecretFile":"auth_secret.key",
......
{
"Port": {{ env "NOMAD_PORT_authorizer" }},
"LogLevel":"debug",
"AlwaysAllowedBeamtimes":[{"beamtimeId":"asapo_test","beamline":"test","core-path":"c:\\tmp\\asapo\\receiver\\files\\test_facility\\gpfs\\test\\2019\\data\\asapo_test"},
"AlwaysAllowedBeamtimes":[{"beamtimeId":"asapo_test","beamline":"test","core-path":"c:\\tmp\\asapo\\receiver\\files\\test_facility\\gpfs\\test\\2019\\data\\asapo_test",
"beamline-path":"c:\\tmp\\asapo\\receiver\\files\\beamline\\test\\current"}},
{"beamtimeId":"asapo_test1","beamline":"test1","core-path":"c:\\tmp\\asapo\\receiver\\files\\test_facility\\gpfs\\test1\\2019\\data\\asapo_test1"},
{"beamtimeId":"asapo_test2","beamline":"test2","core-path":"c:\\tmp\\asapo\\receiver\\files\\test_facility\\gpfs\\test2\\2019\\data\\asapo_test2"}],
"SecretFile":"auth_secret.key",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment