This is an automated email from the ASF dual-hosted git repository.
wgtmac pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-cpp.git
The following commit(s) were added to refs/heads/main by this push:
new 89e4c20f refactor(test): reuse manifest entry helpers in fast append
tests (#1102)
89e4c20f is described below
commit 89e4c20f47384cee23a5150a71614bd3e621a5c4
Author: Junwang Zhao <[email protected]>
AuthorDate: Mon Nov 9 09:55:49 2026 +0800
refactor(test): reuse manifest entry helpers in fast append tests (#1102)
Follow-up to #774.
---
src/iceberg/test/fast_append_test.cc | 32 ++++++++++----------------------
1 file changed, 10 insertions(+), 22 deletions(-)
diff --git a/src/iceberg/test/fast_append_test.cc
b/src/iceberg/test/fast_append_test.cc
index d75e1ef2..ff20b59b 100644
--- a/src/iceberg/test/fast_append_test.cc
+++ b/src/iceberg/test/fast_append_test.cc
@@ -39,7 +39,6 @@
#include "iceberg/exception.h"
#include "iceberg/expression/expressions.h"
#include "iceberg/manifest/manifest_entry.h"
-#include "iceberg/manifest/manifest_reader.h"
#include "iceberg/manifest/manifest_writer.h"
#include "iceberg/metrics/commit_report.h"
#include "iceberg/metrics/metrics_reporter.h"
@@ -175,14 +174,6 @@ class FastAppendTest : public UpdateTestBase {
return std::vector<ManifestFile>(manifests.begin(), manifests.end());
}
- Result<std::vector<ManifestEntry>> ReadEntries(const ManifestFile& manifest)
{
- ICEBERG_ASSIGN_OR_RAISE(
- auto spec,
table_->metadata()->PartitionSpecById(manifest.partition_spec_id));
- ICEBERG_ASSIGN_OR_RAISE(auto reader,
- ManifestReader::Make(manifest, file_io_, schema_,
spec));
- return reader->Entries();
- }
-
std::shared_ptr<PartitionSpec> spec_;
std::shared_ptr<Schema> schema_;
std::shared_ptr<DataFile> file_a_;
@@ -292,7 +283,7 @@ TEST_F(FastAppendTest, WriteManifestGroups) {
ASSERT_TRUE(manifests[group_index].added_files_count.has_value());
EXPECT_EQ(manifests[group_index].added_files_count.value(), kGroupSize);
- ICEBERG_UNWRAP_OR_FAIL(auto entries, ReadEntries(manifests[group_index]));
+ ICEBERG_UNWRAP_OR_FAIL(auto entries,
ReadManifestEntries(manifests[group_index]));
ASSERT_EQ(entries.size(), kGroupSize);
const size_t offset = group_index * kGroupSize;
for (size_t entry_index = 0; entry_index < entries.size(); ++entry_index) {
@@ -457,10 +448,7 @@ TEST_F(FastAppendTest, RebaseCopiesAppendManifestAgain) {
EXPECT_THAT(attempt_manifests,
::testing::Not(::testing::Contains(manifest_path)));
attempt_manifests.push_back(manifest_path);
attempt_lists.push_back(snapshot->manifest_list);
- ICEBERG_UNWRAP_OR_FAIL(auto entries, ReadEntries(manifests[0]));
- ASSERT_THAT(entries, ::testing::SizeIs(1));
- ASSERT_NE(entries[0].data_file, nullptr);
- EXPECT_EQ(entries[0].data_file->file_path, file_a_->file_path);
+ ExpectManifestEntries(manifests[0], {file_a_->file_path},
{ManifestStatus::kAdded});
});
ICEBERG_UNWRAP_OR_FAIL(txn, table_->NewTransaction());
ICEBERG_UNWRAP_OR_FAIL(auto fast_append, txn->NewFastAppend());
@@ -511,10 +499,10 @@ TEST_F(FastAppendTest,
AppendManifestWithSnapshotIdInheritance) {
ASSERT_THAT(manifests, ::testing::SizeIs(1));
EXPECT_EQ(manifests[0].manifest_path, path);
EXPECT_EQ(manifests[0].added_snapshot_id, snapshot->snapshot_id);
- ICEBERG_UNWRAP_OR_FAIL(auto entries, ReadEntries(manifests[0]));
- ASSERT_THAT(entries, ::testing::SizeIs(2));
- EXPECT_EQ(entries[0].snapshot_id, snapshot->snapshot_id);
- EXPECT_EQ(entries[1].snapshot_id, snapshot->snapshot_id);
+ ExpectManifestEntriesWithSnapshotIds(manifests[0],
+ {file_a_->file_path,
file_b_->file_path},
+ {ManifestStatus::kAdded,
ManifestStatus::kAdded},
+ {snapshot->snapshot_id,
snapshot->snapshot_id});
}
TEST_F(FastAppendTest, AppendManifestWithExplicitInvalidSnapshotIdIsCopied) {
@@ -533,10 +521,10 @@ TEST_F(FastAppendTest,
AppendManifestWithExplicitInvalidSnapshotIdIsCopied) {
ASSERT_THAT(manifests, ::testing::SizeIs(1));
EXPECT_NE(manifests[0].manifest_path, path);
EXPECT_EQ(manifests[0].added_snapshot_id, snapshot->snapshot_id);
- ICEBERG_UNWRAP_OR_FAIL(auto entries, ReadEntries(manifests[0]));
- ASSERT_THAT(entries, ::testing::SizeIs(2));
- EXPECT_EQ(entries[0].snapshot_id, snapshot->snapshot_id);
- EXPECT_EQ(entries[1].snapshot_id, snapshot->snapshot_id);
+ ExpectManifestEntriesWithSnapshotIds(manifests[0],
+ {file_a_->file_path,
file_b_->file_path},
+ {ManifestStatus::kAdded,
ManifestStatus::kAdded},
+ {snapshot->snapshot_id,
snapshot->snapshot_id});
}
TEST_F(FastAppendTest, AppendDuplicateFile) {