From 68bf2464a4bbaaed404c9a79130f8ab1050e9a40 Mon Sep 17 00:00:00 2001
From: Sergey Yakubov <sergey.yakubov@desy.de>
Date: Wed, 27 Oct 2021 15:51:33 +0200
Subject: [PATCH] update influxdb clean-up in tests

---
 tests/automatic/broker/check_monitoring/check_linux.sh        | 4 ++--
 tests/automatic/full_chain/simple_chain/check_linux.sh        | 2 +-
 .../automatic/full_chain/simple_chain_dataset/check_linux.sh  | 2 +-
 .../simple_chain_filegen_readdata_cache/check_linux.sh        | 2 +-
 .../simple_chain_filegen_readdata_file/check_linux.sh         | 2 +-
 .../automatic/full_chain/simple_chain_metadata/check_linux.sh | 2 +-
 tests/automatic/full_chain/simple_chain_raw/check_linux.sh    | 2 +-
 .../full_chain/simple_chain_usermeta_python/check_linux.sh    | 2 +-
 tests/automatic/full_chain/two_beamlines/check_linux.sh       | 2 +-
 .../automatic/high_avail/broker_mongo_restart/check_linux.sh  | 2 +-
 tests/automatic/high_avail/services_restart/check_linux.sh    | 2 +-
 .../producer_receiver/check_monitoring/check_linux.sh         | 2 +-
 .../producer_receiver/transfer_datasets/check_linux.sh        | 2 +-
 .../producer_receiver/transfer_single_file/check_linux.sh     | 2 +-
 .../transfer_single_file_bypass_buffer/check_linux.sh         | 2 +-
 15 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/tests/automatic/broker/check_monitoring/check_linux.sh b/tests/automatic/broker/check_monitoring/check_linux.sh
index 734ffd75b..d0b81c6ee 100644
--- a/tests/automatic/broker/check_monitoring/check_linux.sh
+++ b/tests/automatic/broker/check_monitoring/check_linux.sh
@@ -9,10 +9,10 @@ trap Cleanup EXIT
 Cleanup() {
   set +e
 	echo cleanup
-	influx -execute "drop database ${database_name}"
+  influx -database ${database_name} -execute "drop series from statistics, RequestsRate"
 }
 
-! influx -execute "drop database ${database_name}"
+! influx -database ${database_name} -execute "drop series from statistics, RequestsRate"
 
 
 token=$BT_DATA_TOKEN
diff --git a/tests/automatic/full_chain/simple_chain/check_linux.sh b/tests/automatic/full_chain/simple_chain/check_linux.sh
index a442e63f4..ac9a737c6 100755
--- a/tests/automatic/full_chain/simple_chain/check_linux.sh
+++ b/tests/automatic/full_chain/simple_chain/check_linux.sh
@@ -25,7 +25,7 @@ Cleanup() {
     rm -rf ${receiver_root_folder}
     rm -rf out
     echo "db.dropDatabase()" | mongo ${beamtime_id}_detector
-    influx -execute "drop database ${monitor_database_name}"
+    influx -database ${monitor_database_name} -execute "drop series from statistics, RequestsRate"
 }
 
 token=`$asapo_tool_bin token -endpoint http://localhost:8400/asapo-authorizer -secret admin_token.key -types read $beamtime_id`
diff --git a/tests/automatic/full_chain/simple_chain_dataset/check_linux.sh b/tests/automatic/full_chain/simple_chain_dataset/check_linux.sh
index 165f48f54..15964cc6e 100644
--- a/tests/automatic/full_chain/simple_chain_dataset/check_linux.sh
+++ b/tests/automatic/full_chain/simple_chain_dataset/check_linux.sh
@@ -26,7 +26,7 @@ Cleanup() {
     rm -rf ${receiver_root_folder}
     rm -rf out
     echo "db.dropDatabase()" | mongo ${beamtime_id}_detector
-    influx -execute "drop database ${monitor_database_name}"
+    influx -database ${monitor_database_name} -execute "drop series from statistics, RequestsRate"
 }
 
 token=`$asapo_tool_bin token -endpoint http://localhost:8400/asapo-authorizer -secret admin_token.key -types read $beamtime_id`
diff --git a/tests/automatic/full_chain/simple_chain_filegen_readdata_cache/check_linux.sh b/tests/automatic/full_chain/simple_chain_filegen_readdata_cache/check_linux.sh
index 7c22a733b..00391dff4 100644
--- a/tests/automatic/full_chain/simple_chain_filegen_readdata_cache/check_linux.sh
+++ b/tests/automatic/full_chain/simple_chain_filegen_readdata_cache/check_linux.sh
@@ -40,7 +40,7 @@ Cleanup() {
     kill -9 $producerid
     rm -rf /tmp/asapo/test_in
     rm -rf ${receiver_folder}
-    influx -execute "drop database ${monitor_database_name}"
+    influx -database ${monitor_database_name} -execute "drop series from statistics, RequestsRate"
     echo "db.dropDatabase()" | mongo ${beamtime_id}_detector
     rm out.txt
 }
diff --git a/tests/automatic/full_chain/simple_chain_filegen_readdata_file/check_linux.sh b/tests/automatic/full_chain/simple_chain_filegen_readdata_file/check_linux.sh
index e3f49565c..36e82adc9 100644
--- a/tests/automatic/full_chain/simple_chain_filegen_readdata_file/check_linux.sh
+++ b/tests/automatic/full_chain/simple_chain_filegen_readdata_file/check_linux.sh
@@ -27,7 +27,7 @@ Cleanup() {
     kill -9 $producerid
     rm -rf /tmp/asapo/test_in
     rm -rf ${receiver_folder}
-    influx -execute "drop database ${monitor_database_name}"
+    influx -database ${monitor_database_name} -execute "drop series from statistics, RequestsRate"
     echo "db.dropDatabase()" | mongo ${beamtime_id}_detector
     rm out.txt
 }
diff --git a/tests/automatic/full_chain/simple_chain_metadata/check_linux.sh b/tests/automatic/full_chain/simple_chain_metadata/check_linux.sh
index c0707599e..b7594898e 100644
--- a/tests/automatic/full_chain/simple_chain_metadata/check_linux.sh
+++ b/tests/automatic/full_chain/simple_chain_metadata/check_linux.sh
@@ -25,7 +25,7 @@ Cleanup() {
     rm -rf ${receiver_root_folder}
     rm -rf out
     echo "db.dropDatabase()" | mongo ${beamtime_id}_detector
-    influx -execute "drop database ${monitor_database_name}"
+    influx -database ${monitor_database_name} -execute "drop series from statistics, RequestsRate"
 }
 
 token=`$asapo_tool_bin token -endpoint http://localhost:8400/asapo-authorizer -secret admin_token.key -types read $beamtime_id`
diff --git a/tests/automatic/full_chain/simple_chain_raw/check_linux.sh b/tests/automatic/full_chain/simple_chain_raw/check_linux.sh
index 109485d11..50214fb81 100644
--- a/tests/automatic/full_chain/simple_chain_raw/check_linux.sh
+++ b/tests/automatic/full_chain/simple_chain_raw/check_linux.sh
@@ -19,7 +19,7 @@ Cleanup() {
     echo cleanup
     rm -rf out /tmp/asapo/asap3 /tmp/asapo/beamline
     echo "db.dropDatabase()" | mongo ${beamtime_id}_detector
-    influx -execute "drop database ${monitor_database_name}"
+    influx -database ${monitor_database_name} -execute "drop series from statistics, RequestsRate"
 }
 
 echo "db.dropDatabase()" | mongo ${beamtime_id}_detector
diff --git a/tests/automatic/full_chain/simple_chain_usermeta_python/check_linux.sh b/tests/automatic/full_chain/simple_chain_usermeta_python/check_linux.sh
index 53a8e3485..4054fef28 100644
--- a/tests/automatic/full_chain/simple_chain_usermeta_python/check_linux.sh
+++ b/tests/automatic/full_chain/simple_chain_usermeta_python/check_linux.sh
@@ -24,7 +24,7 @@ Cleanup() {
     rm -rf ${receiver_root_folder}
     rm -rf out
     echo "db.dropDatabase()" | mongo ${beamtime_id}_detector
-    influx -execute "drop database ${monitor_database_name}"
+    influx -database ${monitor_database_name} -execute "drop series from statistics, RequestsRate"
 }
 
 token=`$asapo_tool_bin token -endpoint http://localhost:8400/asapo-authorizer -secret admin_token.key -types read $beamtime_id`
diff --git a/tests/automatic/full_chain/two_beamlines/check_linux.sh b/tests/automatic/full_chain/two_beamlines/check_linux.sh
index 057dd44c0..75be4ed22 100644
--- a/tests/automatic/full_chain/two_beamlines/check_linux.sh
+++ b/tests/automatic/full_chain/two_beamlines/check_linux.sh
@@ -43,7 +43,7 @@ Cleanup() {
     rm -rf ${receiver_root_folder}
     echo "db.dropDatabase()" | mongo ${beamtime_id1}_${data_source}
     echo "db.dropDatabase()" | mongo ${beamtime_id2}_${data_source}
-    influx -execute "drop database ${monitor_database_name}"
+    influx -database ${monitor_database_name} -execute "drop series from statistics, RequestsRate"
 }
 
 if [[ $network_type == "fabric" ]]; then
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 fc8a1a486..a3a9895ec 100755
--- a/tests/automatic/high_avail/broker_mongo_restart/check_linux.sh
+++ b/tests/automatic/high_avail/broker_mongo_restart/check_linux.sh
@@ -52,7 +52,7 @@ Cleanup() {
     kill $producerid
     kill $workerid
     echo "db.dropDatabase()" | mongo --port 27015 ${beamtime_id}_detector || echo "db.dropDatabase()" | mongo --port 27016 ${beamtime_id}_detector
-    influx -execute "drop database ${monitor_database_name}"
+    influx -database ${monitor_database_name} -execute "drop series from statistics, RequestsRate"
     kill_mongo 27015 || kill_mongo 27016
     sed -i 's/27015/27017/g' discovery.json.tpl
     nomad stop discovery
diff --git a/tests/automatic/high_avail/services_restart/check_linux.sh b/tests/automatic/high_avail/services_restart/check_linux.sh
index fa784e08b..840d3e97c 100644
--- a/tests/automatic/high_avail/services_restart/check_linux.sh
+++ b/tests/automatic/high_avail/services_restart/check_linux.sh
@@ -26,7 +26,7 @@ Cleanup() {
     rm -rf ${receiver_folder}
     echo "db.dropDatabase()" | mongo ${beamtime_id}_detector
     set +e
-    influx -execute "drop database ${monitor_database_name}"
+    influx -database ${monitor_database_name} -execute "drop series from statistics, RequestsRate"
 }
 
 
diff --git a/tests/automatic/producer_receiver/check_monitoring/check_linux.sh b/tests/automatic/producer_receiver/check_monitoring/check_linux.sh
index cf0863c9b..8c08a2f3d 100644
--- a/tests/automatic/producer_receiver/check_monitoring/check_linux.sh
+++ b/tests/automatic/producer_receiver/check_monitoring/check_linux.sh
@@ -14,7 +14,7 @@ trap Cleanup EXIT
 
 Cleanup() {
 	echo cleanup
-	influx -execute "drop database ${database_name}"
+	influx -database ${database_name} -execute "drop series from statistics, RequestsRate"
     echo "db.dropDatabase()" | mongo ${beamtime_id}_detector
     rm -rf ${receiver_root_folder}
 }
diff --git a/tests/automatic/producer_receiver/transfer_datasets/check_linux.sh b/tests/automatic/producer_receiver/transfer_datasets/check_linux.sh
index 2207d5a30..1adb43573 100644
--- a/tests/automatic/producer_receiver/transfer_datasets/check_linux.sh
+++ b/tests/automatic/producer_receiver/transfer_datasets/check_linux.sh
@@ -17,7 +17,7 @@ Cleanup() {
 	echo cleanup
 	rm -rf ${receiver_root_folder}
     echo "db.dropDatabase()" | mongo ${beamtime_id}_detector
-    influx -execute "drop database ${database_name}"
+    influx -database ${database_name} -execute "drop series from statistics, RequestsRate"
 }
 
 mkdir -p ${receiver_folder}
diff --git a/tests/automatic/producer_receiver/transfer_single_file/check_linux.sh b/tests/automatic/producer_receiver/transfer_single_file/check_linux.sh
index 90d116c91..a02c953d9 100644
--- a/tests/automatic/producer_receiver/transfer_single_file/check_linux.sh
+++ b/tests/automatic/producer_receiver/transfer_single_file/check_linux.sh
@@ -17,7 +17,7 @@ Cleanup() {
 	echo cleanup
 	rm -rf ${receiver_root_folder}
   echo "db.dropDatabase()" | mongo ${beamtime_id}_detector
-  influx -execute "drop database ${database_name}"
+  influx -database ${database_name} -execute "drop series from statistics, RequestsRate"
 }
 
 mkdir -p ${receiver_folder}
diff --git a/tests/automatic/producer_receiver/transfer_single_file_bypass_buffer/check_linux.sh b/tests/automatic/producer_receiver/transfer_single_file_bypass_buffer/check_linux.sh
index 1da3b56b6..357c9185d 100644
--- a/tests/automatic/producer_receiver/transfer_single_file_bypass_buffer/check_linux.sh
+++ b/tests/automatic/producer_receiver/transfer_single_file_bypass_buffer/check_linux.sh
@@ -18,7 +18,7 @@ Cleanup() {
 	echo cleanup
 	rm -rf ${receiver_root_folder}
     echo "db.dropDatabase()" | mongo ${beamtime_id}_detector
-    influx -execute "drop database ${database_name}"
+    influx -database ${database_name} -execute "drop series from statistics, RequestsRate"
 }
 
 mkdir -p ${receiver_folder}
-- 
GitLab