Add unit test coverage for ArchiveReaders

This commit is contained in:
Joshua Hildred 2024-02-05 10:55:16 -08:00
parent eb4ec0e871
commit 1eb4cdf0f8
2 changed files with 9 additions and 3 deletions

View File

@ -298,8 +298,6 @@ public:
throw Exception(ErrorCodes::UNSUPPORTED_METHOD, "getPosition not supported when reading from archive");
}
off_t getPosition() override { throw Exception(ErrorCodes::UNSUPPORTED_METHOD, "getPosition not supported when reading from archive"); }
String getFileName() const override { return handle.getFileName(); }
size_t getFileSize() override { return handle.getFileInfo().uncompressed_size; }

View File

@ -219,6 +219,10 @@ TEST_P(ArchiveReaderAndWriterTest, TwoFilesInArchive)
ASSERT_TRUE(reader->fileExists("a.txt"));
ASSERT_TRUE(reader->fileExists("b/c.txt"));
// Get all files
auto files = reader->getAllFiles();
EXPECT_EQ(files.size(), 2);
EXPECT_EQ(reader->getFileInfo("a.txt").uncompressed_size, a_contents.size());
EXPECT_EQ(reader->getFileInfo("b/c.txt").uncompressed_size, c_contents.size());
@ -274,6 +278,10 @@ TEST_P(ArchiveReaderAndWriterTest, TwoFilesInArchive)
enumerator = reader->nextFile(std::move(in));
EXPECT_EQ(enumerator, nullptr);
}
// Get all files one last time
files = reader->getAllFiles();
EXPECT_EQ(files.size(), 2);
}