From 47aedbd271ce58c1bf99cb6da512545a3bf415da Mon Sep 17 00:00:00 2001
From: Carsten Patzke <carsten.patzke@desy.de>
Date: Sat, 18 Apr 2020 00:20:10 +0200
Subject: [PATCH] Fixed some tests

---
 tests/automatic/asapo_fabric/parallel_data_transfer.cpp      | 3 ++-
 tests/automatic/asapo_fabric/simple_data_transfer.cpp        | 1 +
 tests/automatic/asapo_fabric/timeout_test.cpp                | 1 +
 tests/automatic/asapo_fabric/wrong_memory_info.cpp           | 2 ++
 tests/automatic/consumer/consumer_api_python/consumer_api.py | 2 +-
 tests/automatic/high_avail/services_restart/check_linux.sh   | 2 +-
 6 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/tests/automatic/asapo_fabric/parallel_data_transfer.cpp b/tests/automatic/asapo_fabric/parallel_data_transfer.cpp
index aa8b34547..07c5fcc56 100644
--- a/tests/automatic/asapo_fabric/parallel_data_transfer.cpp
+++ b/tests/automatic/asapo_fabric/parallel_data_transfer.cpp
@@ -33,8 +33,9 @@ void ServerChildThread(FabricServer* server, std::atomic<int>* serverTotalReques
         // In order to run the tests more stable. Otherwise a timeout could occurred with valgrind
         int tries = 0;
         do {
+            err = nullptr;
             server->RecvAny(&clientAddress, &messageId, &request, sizeof(request), &err);
-        } while (err == IOErrorTemplates::kTimeout && tries++ < 2);
+        } while (err == IOErrorTemplates::kTimeout && tries++ < 4);
         M_AssertEq(nullptr, err, "server->RecvAny");
         M_AssertEq("Hello World", request.message);
         M_AssertEq(messageId / kEachInstanceRuns, request.data_id); // is client index
diff --git a/tests/automatic/asapo_fabric/simple_data_transfer.cpp b/tests/automatic/asapo_fabric/simple_data_transfer.cpp
index d5e4d9bda..00da5b38c 100644
--- a/tests/automatic/asapo_fabric/simple_data_transfer.cpp
+++ b/tests/automatic/asapo_fabric/simple_data_transfer.cpp
@@ -38,6 +38,7 @@ void ServerMasterThread(const std::string& hostname, uint16_t port, char* expect
                 // In order to run the tests more stable. Otherwise a timeout could occurred with valgrind
                 int tries = 0;
                 do {
+                    err = nullptr;
                     server->RecvAny(&clientAddress, &messageId, &request, sizeof(request), &err);
                 } while (err == IOErrorTemplates::kTimeout && tries++ < 2);
                 M_AssertEq(nullptr, err, "server->RecvAny");
diff --git a/tests/automatic/asapo_fabric/timeout_test.cpp b/tests/automatic/asapo_fabric/timeout_test.cpp
index d71ea1c3a..fc454fcb5 100644
--- a/tests/automatic/asapo_fabric/timeout_test.cpp
+++ b/tests/automatic/asapo_fabric/timeout_test.cpp
@@ -33,6 +33,7 @@ void ServerMasterThread(const std::string& hostname, uint16_t port) {
         // In order to run the tests more stable. Otherwise a timeout could occurred with valgrind
         int tries = 0;
         do {
+            err = nullptr;
             server->RecvAny(&clientAddress, &messageId, &dummyBuffer, sizeof(dummyBuffer), &err);
         } while (err == IOErrorTemplates::kTimeout && tries++ < 2);
         M_AssertEq(nullptr, err, "server->RecvAny");
diff --git a/tests/automatic/asapo_fabric/wrong_memory_info.cpp b/tests/automatic/asapo_fabric/wrong_memory_info.cpp
index 76988ddc4..8281b4ab0 100644
--- a/tests/automatic/asapo_fabric/wrong_memory_info.cpp
+++ b/tests/automatic/asapo_fabric/wrong_memory_info.cpp
@@ -49,6 +49,7 @@ void ServerMasterThread(const std::string& hostname, uint16_t port) {
     // Simulate correct memory details
     int tries = 0;
     do {
+        err = nullptr;
         server->RecvAny(&clientAddress, &messageId, &request, sizeof(request), &err);
     } while (err == IOErrorTemplates::kTimeout && tries++ < 2);
     M_AssertEq(nullptr, err, "server->RecvAny(2)");
@@ -62,6 +63,7 @@ void ServerMasterThread(const std::string& hostname, uint16_t port) {
     GenericRequestHeader request2{};
     tries = 0;
     do {
+        err = nullptr;
         server->RecvAny(&clientAddress, &messageId, &request2, sizeof(request2), &err);
     } while (err == IOErrorTemplates::kTimeout && tries++ < 2);
     M_AssertEq(nullptr, err, "server->RecvAny(3)");
diff --git a/tests/automatic/consumer/consumer_api_python/consumer_api.py b/tests/automatic/consumer/consumer_api_python/consumer_api.py
index 9a491dcea..65176c687 100644
--- a/tests/automatic/consumer/consumer_api_python/consumer_api.py
+++ b/tests/automatic/consumer/consumer_api_python/consumer_api.py
@@ -149,7 +149,7 @@ def check_single(broker,group_id_new):
     else:
         exit_on_noerr("wrong query")
 
-    broker = asapo_consumer.create_server_broker("bla",path, True, beamtime,"",token,1000)
+    broker = asapo_consumer.create_server_broker("bla",path, True, beamtime,"",token,1000,network_type)
     try:
         broker.get_last(group_id_new, meta_only=True)
     except asapo_consumer.AsapoUnavailableServiceError as err:
diff --git a/tests/automatic/high_avail/services_restart/check_linux.sh b/tests/automatic/high_avail/services_restart/check_linux.sh
index 434e13eb1..c47355c08 100644
--- a/tests/automatic/high_avail/services_restart/check_linux.sh
+++ b/tests/automatic/high_avail/services_restart/check_linux.sh
@@ -62,7 +62,7 @@ nomad run authorizer.nmd
 nomad run discovery.nmd
 nomad run receiver_$7.nmd
 
-if ["$4" = "receiver"]; then
+if [[ "$4" == "receiver" ]]; then
   nomad run $4_$7.nmd
 else
   nomad run $4.nmd
-- 
GitLab