From cc23307f6a61b779555bead5896f956b3e70d32a Mon Sep 17 00:00:00 2001
From: Sergey Yakubov <sergey.yakubov@desy.de>
Date: Fri, 17 Aug 2018 13:24:46 +0200
Subject: [PATCH] allow override files

---
 common/cpp/src/system_io/system_io.cpp                 |  2 +-
 .../check_mongo_restart/check_linux.sh                 | 10 +++++++++-
 .../system_io/write_data_to_file/CMakeLists.txt        |  2 +-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/common/cpp/src/system_io/system_io.cpp b/common/cpp/src/system_io/system_io.cpp
index f8dc19c31..630685b38 100644
--- a/common/cpp/src/system_io/system_io.cpp
+++ b/common/cpp/src/system_io/system_io.cpp
@@ -124,7 +124,7 @@ void asapo::SystemIO::CreateNewDirectory(const std::string& directory_name, Erro
 
 Error SystemIO::WriteDataToFile(const std::string& fname, const uint8_t* data, size_t length) const {
     Error err;
-    auto fd = Open(fname, IO_OPEN_MODE_CREATE_AND_FAIL_IF_EXISTS | IO_OPEN_MODE_RW, &err);
+    auto fd = Open(fname, IO_OPEN_MODE_CREATE | IO_OPEN_MODE_RW, &err);
     if (err) {
         return err;
     }
diff --git a/tests/automatic/producer_receiver/check_mongo_restart/check_linux.sh b/tests/automatic/producer_receiver/check_mongo_restart/check_linux.sh
index 6a60eeed6..e7a5dc5e5 100644
--- a/tests/automatic/producer_receiver/check_mongo_restart/check_linux.sh
+++ b/tests/automatic/producer_receiver/check_mongo_restart/check_linux.sh
@@ -32,8 +32,13 @@ database_name=db_test
 beamtime_id=asapo_test
 beamline=test
 
+receiver_root_folder=/tmp/asapo/receiver/files
+receiver_folder=${receiver_root_folder}/${beamline}/${beamtime_id}
+
+
 Cleanup() {
 	echo cleanup
+	rm -rf ${receiver_root_folder}
     nomad stop receiver
     nomad stop discovery
     nomad stop authorizer
@@ -50,7 +55,7 @@ wait_mongo
 echo "db.${beamtime_id}.insert({dummy:1})" | mongo --port 27016 ${beamtime_id}
 
 sed -i 's/27017/27016/g' receiver.json.tpl
-sed -i 's/"WriteToDisk":true/"WriteToDisk":false/g' receiver.json.tpl
+#sed -i 's/"WriteToDisk":true/"WriteToDisk":false/g' receiver.json.tpl
 
 
 nomad run authorizer.nmd
@@ -58,6 +63,9 @@ nomad run nginx.nmd
 nomad run receiver.nmd
 nomad run discovery.nmd
 
+mkdir -p ${receiver_folder}
+
+
 sleep 1
 
 nfiles=1000
diff --git a/tests/automatic/system_io/write_data_to_file/CMakeLists.txt b/tests/automatic/system_io/write_data_to_file/CMakeLists.txt
index fd034a4d2..8a576706d 100644
--- a/tests/automatic/system_io/write_data_to_file/CMakeLists.txt
+++ b/tests/automatic/system_io/write_data_to_file/CMakeLists.txt
@@ -15,6 +15,6 @@ set_target_properties(${TARGET_NAME} PROPERTIES LINKER_LANGUAGE CXX)
 ################################
 add_test_setup_cleanup(${TARGET_NAME})
 add_integration_test(${TARGET_NAME} writeok "test_file ok dummy" nomem)
-add_integration_test(${TARGET_NAME} writetwice "test_file error kFileAlreadyExists:test" nomem)
+add_integration_test(${TARGET_NAME} writetwice "test_file ok dummy" nomem)
 add_integration_test(${TARGET_NAME} dirnoaccess "test_noaccess/test_file error Permissiondenied:test_noaccess/test_file" nomem)
 
-- 
GitLab