|
|
@@ -26,3 +26,27 @@ TEST(CollectionRegistry, IsolatedPerProject) {
|
|
|
|
|
|
db->dropProject(pa); db->dropProject(pb);
|
|
|
}
|
|
|
+
|
|
|
+// Regression guard for issue #1: a freshly-constructed registry (as on a new
|
|
|
+// server process) must surface previously-stored entries for every project once
|
|
|
+// bootstrap() has re-opened them. The startup path warmed only the default
|
|
|
+// project before the fix, so named projects' collections went missing on restart.
|
|
|
+TEST(CollectionRegistry, BootstrapWarmsAllProjects) {
|
|
|
+ SVAPI_REQUIRE_DB(db);
|
|
|
+ const std::string pa = testutil::tmpName("bootA"), pb = testutil::tmpName("bootB");
|
|
|
+ db->ensureProject(pa); db->ensureProject(pb);
|
|
|
+ {
|
|
|
+ CollectionRegistry seed(*db);
|
|
|
+ seed.ensure(pa); seed.ensure(pb);
|
|
|
+ EXPECT_TRUE(seed.add(pa, {"alpha", "json", 0, "", 0}));
|
|
|
+ EXPECT_TRUE(seed.add(pb, {"beta", "vector", 8, "m", 0}));
|
|
|
+ }
|
|
|
+ CollectionRegistry fresh(*db);
|
|
|
+ fresh.bootstrap({pa, pb}); // the startup warm-up that fixes issue #1
|
|
|
+ EXPECT_EQ(fresh.list(pa).size(), 1u);
|
|
|
+ EXPECT_EQ(fresh.list(pb).size(), 1u);
|
|
|
+ EXPECT_TRUE(fresh.get(pa, "alpha").has_value());
|
|
|
+ EXPECT_TRUE(fresh.get(pb, "beta").has_value());
|
|
|
+
|
|
|
+ db->dropProject(pa); db->dropProject(pb);
|
|
|
+}
|