From c8f0b704193e6d3e73b8367c56baca9daf1ce5dc Mon Sep 17 00:00:00 2001
From: Sergey Yakubov <sergey.yakubov@desy.de>
Date: Mon, 14 Jun 2021 13:45:22 +0200
Subject: [PATCH] fix tests

---
 examples/consumer/getnext_python/check_linux.sh    | 2 +-
 examples/consumer/getnext_python/check_windows.bat | 2 +-
 tests/automatic/broker/get_meta/check_linux.sh     | 6 ++++--
 tests/automatic/broker/get_meta/check_windows.bat  | 6 ++++--
 4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/examples/consumer/getnext_python/check_linux.sh b/examples/consumer/getnext_python/check_linux.sh
index 9f6fb85bd..543137fc3 100644
--- a/examples/consumer/getnext_python/check_linux.sh
+++ b/examples/consumer/getnext_python/check_linux.sh
@@ -20,7 +20,7 @@ do
 	echo 'db.data_default.insert({"_id":'$i',"size":100,"name":"'$i'","timestamp":0,"source":"none","buf_id":0,"dataset_substream":0,"meta":{"test":10}})' | mongo ${database_name}
 done
 
-echo 'db.meta.insert({"_id":0,"meta_test":"test"})' | mongo ${database_name}
+echo 'db.meta.insert({"_id":"bt","meta_test":"test"})' | mongo ${database_name}
 
 sleep 1
 
diff --git a/examples/consumer/getnext_python/check_windows.bat b/examples/consumer/getnext_python/check_windows.bat
index e48e27bd8..f69c97c8e 100644
--- a/examples/consumer/getnext_python/check_windows.bat
+++ b/examples/consumer/getnext_python/check_windows.bat
@@ -10,7 +10,7 @@ set group_id=bif31l2uiddd4r0q6b40
 for /l %%x in (1, 1, 3) do echo db.data_default.insert({"_id":%%x,"size":100,"name":"%%x","timestamp":0,"source":"none","buf_id":0,"dataset_substream":0,"meta":{"test":10}}) | %mongo_exe% %database_name%  || goto :error
 
 
-echo db.meta.insert({"_id":0,"meta_test":"test"}) | %mongo_exe% %database_name%  || goto :error
+echo db.meta.insert({"_id":"bt","meta_test":"test"}) | %mongo_exe% %database_name%  || goto :error
 
 set PYTHONPATH=%1
 
diff --git a/tests/automatic/broker/get_meta/check_linux.sh b/tests/automatic/broker/get_meta/check_linux.sh
index 100138a7a..67186b746 100644
--- a/tests/automatic/broker/get_meta/check_linux.sh
+++ b/tests/automatic/broker/get_meta/check_linux.sh
@@ -11,7 +11,8 @@ Cleanup() {
 	echo "db.dropDatabase()" | mongo ${database_name}
 }
 
-echo 'db.meta.insert({"_id":0,"data":"test"})' | mongo ${database_name}
+echo 'db.meta.insert({"_id":"bt","data":"test_bt"})' | mongo ${database_name}
+echo 'db.meta.insert({"_id":"st_test","data":"test_st"})' | mongo ${database_name}
 
 token=$BT_TEST_TOKEN
 
@@ -19,6 +20,7 @@ broker=`curl --silent 127.0.0.1:8400/asapo-discovery/v0.1/asapo-broker?protocol=
 echo found broker at $broker
 
 
-curl -v  --silent $broker/v0.2/beamtime/test/detector/default/0/meta/0?token=$token --stderr - | tee /dev/stderr | grep '"data":"test"'
+curl -v  --silent $broker/v0.2/beamtime/test/detector/default/0/meta/0?token=$token --stderr - | tee /dev/stderr | grep '"data":"test_bt"'
+curl -v  --silent $broker/v0.2/beamtime/test/detector/test/0/meta/1?token=$token --stderr - | tee /dev/stderr | grep '"data":"test_st"'
 curl -v  --silent $broker/v0.2/beamtime/test/detector/default/0/meta/1?token=$token --stderr - | tee /dev/stderr | grep 'no documents'
 
diff --git a/tests/automatic/broker/get_meta/check_windows.bat b/tests/automatic/broker/get_meta/check_windows.bat
index d9b79672a..42287f984 100644
--- a/tests/automatic/broker/get_meta/check_windows.bat
+++ b/tests/automatic/broker/get_meta/check_windows.bat
@@ -1,7 +1,8 @@
 SET database_name=data_detector
 SET mongo_exe="c:\Program Files\MongoDB\Server\4.2\bin\mongo.exe"
 
-echo db.meta.insert({"_id":0}) | %mongo_exe% %database_name%  || goto :error
+echo db.meta.insert({"_id":"bt"}) | %mongo_exe% %database_name%  || goto :error
+echo db.meta.insert({"_id":"st_test"}) | %mongo_exe% %database_name%  || goto :error
 
 curl --silent 127.0.0.1:8400/asapo-discovery/v0.1/asapo-broker?protocol=v0.3 > broker
 set /P broker=< broker
@@ -9,7 +10,8 @@ set /P broker=< broker
 set token=%BT_DATA_TOKEN%
 
 
-C:\Curl\curl.exe -v  --silent %broker%/v0.2/beamtime/data/detector/default/0/meta/0?token=%token% --stderr - | findstr /c:\"_id\":0  || goto :error
+C:\Curl\curl.exe -v  --silent %broker%/v0.2/beamtime/data/detector/default/0/meta/0?token=%token% --stderr - | findstr /c:\"_id\":\"bt\"  || goto :error
+C:\Curl\curl.exe -v  --silent %broker%/v0.2/beamtime/data/detector/test/0/meta/1?token=%token% --stderr - | findstr /c:\"_id\":\"st_test\"  || goto :error
 C:\Curl\curl.exe -v  --silent %broker%/v0.2/beamtime/data/detector/default/0/meta/1?token=%token% --stderr - | findstr /c:"no documents"  || goto :error
 
 
-- 
GitLab