lxy-9602 commented on code in PR #398:
URL: https://github.com/apache/paimon-cpp/pull/398#discussion_r4131030263
##########
src/paimon/core/table/source/table_scan_test.cpp:
##########
@@ -76,6 +77,59 @@ TEST(TableScanTest, TestNonExistTable) {
ASSERT_NOK_WITH_MSG(TableScan::Create(std::move(context)), "not found
latest schema");
}
+TEST(TableScanTest, TestStreamingSnapshotsRemoved) {
+ auto dir = UniqueTestDirectory::Create("local");
+ ASSERT_TRUE(dir);
+ ASSERT_TRUE(TestUtil::CopyDirectory(GetDataDir() +
"/orc/append_09.db/append_09", dir->Str()));
+ ScanContextBuilder builder(dir->Str());
+ builder.AddOption(Options::FILE_FORMAT, "orc")
+ .AddOption(Options::SCAN_MODE, "latest")
+ .WithStreamingMode(true);
+ ASSERT_OK_AND_ASSIGN(std::unique_ptr<ScanContext> context,
builder.Finish());
+ ASSERT_OK_AND_ASSIGN(std::unique_ptr<TableScan> table_scan,
+ TableScan::Create(std::move(context)));
+ ASSERT_OK_AND_ASSIGN(std::shared_ptr<Plan> initial_plan,
table_scan->CreatePlan());
+ ASSERT_TRUE(initial_plan->Splits().empty());
+ ASSERT_OK_AND_ASSIGN(std::shared_ptr<Plan> waiting_plan,
table_scan->CreatePlan());
+ ASSERT_TRUE(waiting_plan->Splits().empty());
+
+ LocalFileSystem fs;
+ ASSERT_OK(fs.Delete(dir->Str() + "/snapshot", /*recursive=*/true));
+ auto result = table_scan->CreatePlan();
+ ASSERT_FALSE(result.ok());
+ ASSERT_TRUE(result.status().IsInvalid());
+ ASSERT_NOK_WITH_MSG(result, "The next snapshot id is 6, while the latest
snapshot id is null");
Review Comment:
It should be sufficient to only assert
`ASSERT_NOK_WITH_MSG(table_scan->CreatePlan(), "The next snapshot id is 6,
while the latest snapshot id is null")`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]