Skip to content
Snippets Groups Projects
Commit d9862e8a authored by Sergey Yakubov's avatar Sergey Yakubov
Browse files

fix tests

parent e20f2533
Branches
Tags
No related merge requests found
......@@ -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)));
......
......@@ -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,
......
......@@ -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 {
......
......@@ -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)
......@@ -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));
......
......@@ -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));
......
......@@ -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));
}
......
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)
......
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment