Skip to content
Snippets Groups Projects
Commit 981ba360 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

TEST: Downloading files > 16kiB

parent 658562d7
No related branches found
No related tags found
No related merge requests found
Pipeline #12914 failed
......@@ -46,7 +46,7 @@ protected:
// fill the file that shall be uploaded
caosdb::transaction::FileWriter writer(test_upload_file_1);
std::string buffer(1024, 'c');
for (int i = 0; i < 8; i++) {
for (int i = 0; i < 20; i++) {
writer.write(buffer);
}
}
......
......@@ -96,6 +96,7 @@ public:
protected:
fs::path test_upload_file_1;
fs::path test_download_file_1;
size_t test_file_size_kib = 20; // We should test at least something over 16kiB
// Fixture methods //////////////////////////////////////////////////////////
......@@ -108,7 +109,7 @@ protected:
// fill the file that shall be uploaded
FileWriter writer(test_upload_file_1);
std::string buffer(1024, 'c');
for (int i = 0; i < 8; i++) {
for (int i = 0; i < test_file_size_kib; i++) {
writer.write(buffer);
}
}
......@@ -951,14 +952,20 @@ TEST_F(test_transaction, test_file_up_n_download) {
ASSERT_FALSE(downloaded_file.HasErrors());
EXPECT_EQ(downloaded_file.GetLocalPath().string(),
test_download_file_1.string());
EXPECT_EQ(fs::file_size(test_upload_file_1),
fs::file_size(test_download_file_1));
// test_download_file_1
FileReader reader_remote(test_upload_file_1);
FileReader reader_remote(test_download_file_1);
std::string buffer_local(1024, 'c');
std::string buffer_remote(1024, 'c');
for (int i = 0; i < 8; i++) {
std::cout << "Reading kiB chunk";
for (size_t i = 0; i < test_file_size_kib; i++) {
std::cout << " #" << i+1 << "/" << test_file_size_kib;
reader_remote.read(buffer_remote);
EXPECT_EQ(buffer_remote, buffer_local);
}
std::cout << std::endl;
}
/*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment