From 3db999c3f4e4c8c0a371f881638f4d659b7c6ead Mon Sep 17 00:00:00 2001
From: Sergey Yakubov <sergey.yakubov@desy.de>
Date: Thu, 27 May 2021 19:50:27 +0200
Subject: [PATCH] update tests

---
 deploy/build_env/centos/Dockerfile.7.9.2009      |  2 +-
 .../simple_chain_filegen/check_linux.sh          |  1 +
 .../simple_chain_filegen_batches/check_linux.sh  |  2 ++
 .../check_linux.sh                               |  2 ++
 .../check_linux.sh                               | 16 ++++++++++++++++
 .../check_linux.sh                               |  1 +
 .../full_chain/two_beamlines/check_linux.sh      | 14 ++++++++++++++
 7 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/deploy/build_env/centos/Dockerfile.7.9.2009 b/deploy/build_env/centos/Dockerfile.7.9.2009
index 22c443a7b..a800bd13f 100644
--- a/deploy/build_env/centos/Dockerfile.7.9.2009
+++ b/deploy/build_env/centos/Dockerfile.7.9.2009
@@ -2,7 +2,7 @@ from centos:7.9.2009
 
 RUN yum update -y && yum install -y epel-release make g++ python python3 git wget rpm-build
 RUN yum -y install gcc gcc-c++ glibc-static libstdc++-static zlib-devel libcurl-devel python-pip python3-pip python-devel python3-devel numpy python3-numpy
-RUN pip install --upgrade pip
+#RUN pip install --upgrade pip
 RUN pip install cython
 RUN pip3 install cython
 
diff --git a/tests/automatic/full_chain/simple_chain_filegen/check_linux.sh b/tests/automatic/full_chain/simple_chain_filegen/check_linux.sh
index 574ecb648..b2e8905f5 100644
--- a/tests/automatic/full_chain/simple_chain_filegen/check_linux.sh
+++ b/tests/automatic/full_chain/simple_chain_filegen/check_linux.sh
@@ -41,6 +41,7 @@ sleep 1
 mkdir  /tmp/asapo/test_in/processed/test1
 mkdir  /tmp/asapo/test_in/processed/test2
 
+sleep 1
 
 echo hello > /tmp/asapo/test_in/processed/test1/file1
 echo hello > /tmp/asapo/test_in/processed/test1/file2
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 fa9bb6831..ca07ab0fe 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
@@ -44,6 +44,8 @@ sleep 1
 mkdir  /tmp/asapo/test_in/processed/test1
 mkdir  /tmp/asapo/test_in/processed/test2
 
+sleep 1
+
 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/full_chain/simple_chain_filegen_multisource/check_linux.sh b/tests/automatic/full_chain/simple_chain_filegen_multisource/check_linux.sh
index 3667ba2ed..b3f7a47ac 100644
--- a/tests/automatic/full_chain/simple_chain_filegen_multisource/check_linux.sh
+++ b/tests/automatic/full_chain/simple_chain_filegen_multisource/check_linux.sh
@@ -50,6 +50,8 @@ sleep 1
 mkdir -p /tmp/asapo/test_in1/processed/test1
 mkdir -p /tmp/asapo/test_in2/processed/test2
 
+sleep 1
+
 echo hello > /tmp/asapo/test_in1/processed/test1/file1
 echo hello > /tmp/asapo/test_in1/processed/test1/file2
 echo hello > /tmp/asapo/test_in2/processed/test2/file1
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 75f55f13a..7c22a733b 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
@@ -29,6 +29,13 @@ Cleanup() {
     if [[ $network_type == "fabric" ]]; then
       nomad stop receiver
       nomad run receiver_tcp.nmd
+      while true
+      do
+        sleep 1
+        curl --silent 127.0.0.1:8400/asapo-discovery/v0.1/asapo-receiver?protocol=v0.1 --stderr - | grep 127.0.0.1  || continue
+        echo recevier started
+        break
+      done
     fi
     kill -9 $producerid
     rm -rf /tmp/asapo/test_in
@@ -41,6 +48,13 @@ Cleanup() {
 if [[ $network_type == "fabric" ]]; then
     nomad stop receiver
     nomad run receiver_fabric.nmd
+    while true
+    do
+      sleep 1
+      curl --silent 127.0.0.1:8400/asapo-discovery/v0.1/asapo-receiver?protocol=v0.1 --stderr - | grep 127.0.0.1  || continue
+      echo recevier started
+      break
+    done
 fi
 
 token=`$3 token -endpoint http://localhost:8400/asapo-authorizer -secret admin_token.key -types read $beamtime_id`
@@ -54,6 +68,8 @@ sleep 1
 mkdir  /tmp/asapo/test_in/processed/test1
 mkdir  /tmp/asapo/test_in/processed/test2
 
+sleep 1
+
 echo -n hello1 > /tmp/asapo/test_in/processed/test1/file1
 echo -n hello2 > /tmp/asapo/test_in/processed/test1/file2
 echo -n hello3 > /tmp/asapo/test_in/processed/test2/file1
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 5cfa9a4e7..e3f49565c 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
@@ -43,6 +43,7 @@ producerid=`echo $!`
 sleep 1
 mkdir  /tmp/asapo/test_in/processed/test1
 mkdir  /tmp/asapo/test_in/processed/test2
+sleep 1
 
 echo -n hello1 > /tmp/asapo/test_in/processed/test1/file1
 echo -n hello2 > /tmp/asapo/test_in/processed/test1/file2
diff --git a/tests/automatic/full_chain/two_beamlines/check_linux.sh b/tests/automatic/full_chain/two_beamlines/check_linux.sh
index eaa344330..057dd44c0 100644
--- a/tests/automatic/full_chain/two_beamlines/check_linux.sh
+++ b/tests/automatic/full_chain/two_beamlines/check_linux.sh
@@ -32,6 +32,13 @@ Cleanup() {
     if [[ $network_type == "fabric" ]]; then
       nomad stop receiver
       nomad run receiver_tcp.nmd
+      while true
+      do
+        sleep 1
+        curl --silent 127.0.0.1:8400/asapo-discovery/v0.1/asapo-receiver?protocol=v0.1 --stderr - | grep 127.0.0.1  || continue
+        echo recevier started
+        break
+      done
     fi
     rm -rf ${receiver_root_folder}
     echo "db.dropDatabase()" | mongo ${beamtime_id1}_${data_source}
@@ -42,6 +49,13 @@ Cleanup() {
 if [[ $network_type == "fabric" ]]; then
     nomad stop receiver
     nomad run receiver_fabric.nmd
+    while true
+    do
+      sleep 1
+      curl --silent 127.0.0.1:8400/asapo-discovery/v0.1/asapo-receiver?protocol=v0.1 --stderr - | grep 127.0.0.1  || continue
+      echo recevier started
+      break
+    done
 fi
 
 token1=`$asapo_tool_bin token -endpoint http://localhost:8400/asapo-authorizer -secret admin_token.key -types read $beamtime_id1`
-- 
GitLab