diff --git a/producer/api/cpp/unittests/test_producer_impl.cpp b/producer/api/cpp/unittests/test_producer_impl.cpp index 8c0fda47f6e3651b6508047ce0fe6e13713e6c9f..c307cbf1d64e3a707018ca308b7d88b1e4383e3c 100644 --- a/producer/api/cpp/unittests/test_producer_impl.cpp +++ b/producer/api/cpp/unittests/test_producer_impl.cpp @@ -606,7 +606,7 @@ TEST_F(ProducerImplTests, GetVersionInfoWithServer) { R"({"softwareVersion":"21.06.0, build 7a9294ad","clientSupported":"no", "clientProtocol":{"versionInfo":"v0.4"}})"; EXPECT_CALL(*mock_http_client, Get_t(HasSubstr(expected_server_uri + - "/asapo-discovery/v0.1/version?client=producer&protocol=v0.4"), _, _)).WillOnce(DoAll( + "/asapo-discovery/v0.1/version?client=producer&protocol=v0.5"), _, _)).WillOnce(DoAll( SetArgPointee<1>(asapo::HttpCode::OK), SetArgPointee<2>(nullptr), Return(result))); diff --git a/producer/api/cpp/unittests/test_producer_request.cpp b/producer/api/cpp/unittests/test_producer_request.cpp index 7a48b685d332754b6c4bee9c99aefabd14b5a794..ae0e560cfa20250982c9cadd2de151a23ed33950 100644 --- a/producer/api/cpp/unittests/test_producer_request.cpp +++ b/producer/api/cpp/unittests/test_producer_request.cpp @@ -40,7 +40,7 @@ TEST(ProducerRequest, Constructor) { uint64_t expected_file_size = 1337; uint64_t expected_meta_size = 137; std::string expected_meta = "meta"; - std::string expected_api_version = "v0.4"; + std::string expected_api_version = "v0.5"; asapo::Opcode expected_op_code = asapo::kOpcodeTransferData; asapo::GenericRequestHeader header{expected_op_code, expected_file_id, expected_file_size, diff --git a/producer/api/cpp/unittests/test_receiver_discovery_service.cpp b/producer/api/cpp/unittests/test_receiver_discovery_service.cpp index c4103b8df771b76e27368df658a8678da3514541..9b8be27b06e82e02ec4f05a62d1dd81ee195dc6c 100644 --- a/producer/api/cpp/unittests/test_receiver_discovery_service.cpp +++ b/producer/api/cpp/unittests/test_receiver_discovery_service.cpp @@ -48,7 +48,7 @@ class ReceiversStatusTests : public Test { NiceMock<asapo::MockLogger> mock_logger; NiceMock<MockHttpClient>* mock_http_client; - std::string expected_endpoint{"endpoint/asapo-discovery/v0.1/asapo-receiver?protocol=v0.4"}; + std::string expected_endpoint{"endpoint/asapo-discovery/v0.1/asapo-receiver?protocol=v0.5"}; ReceiverDiscoveryService status{"endpoint", 20}; void SetUp() override { diff --git a/receiver/CMakeLists.txt b/receiver/CMakeLists.txt index af41e773a067d3b546a3c471cb2d4062f2fc6912..836a04f9b650155c7c41b7620838fda23f783ea1 100644 --- a/receiver/CMakeLists.txt +++ b/receiver/CMakeLists.txt @@ -135,13 +135,4 @@ set(TEST_SOURCE_FILES_RDS unittests/receiver_data_server/request_handler/test_request_handler_factory.cpp unittests/receiver_data_server/request_handler/test_request_handler.cpp ) -gtest(${TARGET_NAME}_RDS "${TEST_SOURCE_FILES_RDS}" "${TEST_LIBRARIES}" - ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/statistics/*.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/statistics/*.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/request_handler/*.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/request_handler/*.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/file_processors/*.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/file_processors/*.h - ) +gtest(${TARGET_NAME}_RDS "${TEST_SOURCE_FILES_RDS}" "${TEST_LIBRARIES}" nocov) diff --git a/receiver/unittests/request_handler/file_processors/test_receive_file_processor.cpp b/receiver/unittests/request_handler/file_processors/test_receive_file_processor.cpp index 4a129be53629b96b613fbd73079116bc14fd2ffe..0fe70c057a2890bc0cb0a01fe5c8d7aabb419014 100644 --- a/receiver/unittests/request_handler/file_processors/test_receive_file_processor.cpp +++ b/receiver/unittests/request_handler/file_processors/test_receive_file_processor.cpp @@ -11,32 +11,8 @@ #include "../../receiver_mocking.h" -using ::testing::Test; -using ::testing::Return; -using ::testing::ReturnRef; -using ::testing::_; -using ::testing::DoAll; -using ::testing::SetArgReferee; -using ::testing::Gt; -using ::testing::Eq; -using ::testing::Ne; -using ::testing::Mock; -using ::testing::NiceMock; -using ::testing::InSequence; -using ::testing::SetArgPointee; -using ::testing::AllOf; -using ::testing::HasSubstr; - - -using ::asapo::Error; -using ::asapo::ErrorInterface; -using ::asapo::FileDescriptor; -using ::asapo::SocketDescriptor; -using ::asapo::MockIO; -using asapo::Request; -using asapo::ReceiveFileProcessor; -using ::asapo::GenericRequestHeader; -using asapo::MockRequest; +using namespace testing; +using namespace asapo; namespace { @@ -63,6 +39,7 @@ class ReceiveFileProcessorTests : public Test { uint64_t expected_file_size = 10; bool expected_overwrite = false; std::string expected_root_folder = "root_folder"; + CustomRequestData expected_custom_data {kDefaultIngestMode, 0, 0}; std::string expected_full_path = expected_root_folder + asapo::kPathSeparator + expected_facility + asapo::kPathSeparator + "gpfs" + asapo::kPathSeparator + expected_beamline + @@ -101,6 +78,7 @@ void ReceiveFileProcessorTests::MockRequestData() { EXPECT_CALL(*mock_request, GetSourceType()).Times(2) .WillRepeatedly(Return(expected_source_type)); + EXPECT_CALL(*mock_request, GetCustomData_t()).WillRepeatedly(Return(expected_custom_data)); EXPECT_CALL(*mock_request, GetFileName()).Times(2) .WillRepeatedly(Return(expected_file_name)); diff --git a/receiver/unittests/request_handler/file_processors/test_write_file_processor.cpp b/receiver/unittests/request_handler/file_processors/test_write_file_processor.cpp index 02967f907b9120dfc063ce19ae0491ac585220b9..bead654171b2962415c58e6e9c28aa08c6c9d4b8 100644 --- a/receiver/unittests/request_handler/file_processors/test_write_file_processor.cpp +++ b/receiver/unittests/request_handler/file_processors/test_write_file_processor.cpp @@ -11,32 +11,8 @@ #include "../../receiver_mocking.h" -using ::testing::Test; -using ::testing::Return; -using ::testing::ReturnRef; -using ::testing::_; -using ::testing::DoAll; -using ::testing::SetArgReferee; -using ::testing::Gt; -using ::testing::Eq; -using ::testing::Ne; -using ::testing::Mock; -using ::testing::NiceMock; -using ::testing::InSequence; -using ::testing::SetArgPointee; -using ::testing::AllOf; -using ::testing::HasSubstr; - - -using ::asapo::Error; -using ::asapo::ErrorInterface; -using ::asapo::FileDescriptor; -using ::asapo::SocketDescriptor; -using ::asapo::MockIO; -using asapo::Request; -using asapo::WriteFileProcessor; -using ::asapo::GenericRequestHeader; -using asapo::MockRequest; +using namespace testing; +using namespace asapo; namespace { @@ -62,6 +38,7 @@ class WriteFileProcessorTests : public Test { uint64_t expected_file_size = 10; bool expected_overwrite = false; std::string expected_root_folder = "root_folder"; + CustomRequestData expected_custom_data {kDefaultIngestMode, 0, 0}; std::string expected_full_path = expected_root_folder + asapo::kPathSeparator + expected_facility + asapo::kPathSeparator + "gpfs" + asapo::kPathSeparator + expected_beamline + @@ -107,6 +84,8 @@ void WriteFileProcessorTests::MockRequestData(int times) { EXPECT_CALL(*mock_request, GetSourceType()).Times(times * 2) .WillRepeatedly(Return(expected_source_type)); + EXPECT_CALL(*mock_request, GetCustomData_t()).WillRepeatedly(Return(expected_custom_data)); + EXPECT_CALL(*mock_request, GetFileName()).Times(times * 2) .WillRepeatedly(Return(expected_file_name)); diff --git a/receiver/unittests/statistics/test_receiver_statistics.cpp b/receiver/unittests/statistics/test_receiver_statistics.cpp index 318acac37c904b146c1efe89586074a4d83f24a4..2956fb98014612bf82171a4b70cff5df6abc5441 100644 --- a/receiver/unittests/statistics/test_receiver_statistics.cpp +++ b/receiver/unittests/statistics/test_receiver_statistics.cpp @@ -73,7 +73,7 @@ void ReceiverStatisticTests::TestTimer(const StatisticEntity& entity) { auto stat = ExtractStat(); - ASSERT_THAT(stat.extra_entities[static_cast<size_t>(entity)].second, Ge(0.3)); + ASSERT_THAT(stat.extra_entities[static_cast<size_t>(entity)].second, Gt(0)); ASSERT_THAT(stat.extra_entities[static_cast<size_t>(entity)].second, Le(1.0)); } diff --git a/tests/automatic/producer_receiver/CMakeLists.txt b/tests/automatic/producer_receiver/CMakeLists.txt index 028133361356e2fc4d129bfc2b9de1e7b5b5dfb2..aae8d4bf65ba9db9753972c71493c900cb5a8310 100644 --- a/tests/automatic/producer_receiver/CMakeLists.txt +++ b/tests/automatic/producer_receiver/CMakeLists.txt @@ -1,6 +1,10 @@ add_subdirectory(transfer_single_file) add_subdirectory(transfer_single_file_bypass_buffer) -add_subdirectory(transfer_single_file_write_to_raw) + +if (BUILD_PYTHON) + add_subdirectory(transfer_single_file_write_to_raw) +endif() + add_subdirectory(transfer_datasets) diff --git a/tests/automatic/producer_receiver/transfer_single_file_write_to_raw/check_windows.bat b/tests/automatic/producer_receiver/transfer_single_file_write_to_raw/check_windows.bat index cb28a51243e187e5b581f4d0971925569bcb1320..5b9f488c3af7117c48fc4c56dc265c070811be20 100644 --- a/tests/automatic/producer_receiver/transfer_single_file_write_to_raw/check_windows.bat +++ b/tests/automatic/producer_receiver/transfer_single_file_write_to_raw/check_windows.bat @@ -11,14 +11,16 @@ mkdir %receiver_folder_online% set PYTHONPATH=%2 +echo test > file1 + "%1" "%3" %data_source% %beamtime_id% "127.0.0.1:8400" > out type out FOR /F "usebackq" %%A IN ('%receiver_folder%\raw\python\file1') DO set size=%%~zA -if %size% NEQ 5 goto :error +if %size% NEQ 7 goto :error FOR /F "usebackq" %%A IN ('%receiver_folder_online%\raw\python\file1') DO set size=%%~zA -if %size% NEQ 5 goto :error +if %size% NEQ 7 goto :error goto :clean @@ -27,7 +29,8 @@ call :clean exit /b 1 :clean -rmdir /S /Q %receiver_root_folder% %receiver_folder_online% +rmdir /S /Q %receiver_root_folder% +rmdir /S /Q %receiver_folder_online% echo db.dropDatabase() | %mongo_exe% %beamtime_id%_python