3131#include " iceberg/table_identifier.h"
3232#include " iceberg/table_metadata.h"
3333#include " iceberg/test/matchers.h"
34+ #include " iceberg/test/mock_catalog.h"
35+ #include " iceberg/test/mock_io.h"
3436#include " iceberg/util/snapshot_util_internal.h"
3537#include " iceberg/util/timepoint.h"
3638
@@ -62,11 +64,11 @@ std::shared_ptr<Snapshot> CreateSnapshot(int64_t snapshot_id,
6264}
6365
6466// Helper to create table metadata with snapshots
65- std::unique_ptr <TableMetadata> CreateTableMetadataWithSnapshots (
67+ std::shared_ptr <TableMetadata> CreateTableMetadataWithSnapshots (
6668 int64_t base_snapshot_id, int64_t main1_snapshot_id, int64_t main2_snapshot_id,
6769 int64_t branch_snapshot_id, int64_t fork0_snapshot_id, int64_t fork1_snapshot_id,
6870 int64_t fork2_snapshot_id, TimePointMs base_timestamp) {
69- auto metadata = std::make_unique <TableMetadata>();
71+ auto metadata = std::make_shared <TableMetadata>();
7072 metadata->format_version = 2 ;
7173 metadata->table_uuid = " test-uuid-1234" ;
7274 metadata->location = " s3://bucket/test" ;
@@ -157,8 +159,11 @@ class SnapshotUtilTest : public ::testing::Test {
157159 fork0_snapshot_id_, fork1_snapshot_id_, fork2_snapshot_id_, base_timestamp_);
158160
159161 TableIdentifier table_ident{.ns = {}, .name = " test" };
160- table_ = std::make_unique<Table>(table_ident, std::move (metadata),
161- " s3://bucket/test/metadata.json" , nullptr , nullptr );
162+ auto io = std::make_shared<MockFileIO>();
163+ auto catalog = std::make_shared<MockCatalog>();
164+ table_ = std::move (Table::Make (table_ident, std::move (metadata),
165+ " s3://bucket/test/metadata.json" , io, catalog)
166+ .value ());
162167 }
163168
164169 TimePointMs base_timestamp_;
@@ -169,7 +174,7 @@ class SnapshotUtilTest : public ::testing::Test {
169174 int64_t fork0_snapshot_id_;
170175 int64_t fork1_snapshot_id_;
171176 int64_t fork2_snapshot_id_;
172- std::unique_ptr <Table> table_;
177+ std::shared_ptr <Table> table_;
173178};
174179
175180TEST_F (SnapshotUtilTest, IsParentAncestorOf) {
0 commit comments