Skip to content

Commit 1c1e51b

Browse files
committed
fix: E2E DB cleanup をデータコレクションのみに限定
ブロックリストではなくホワイトリスト方式に変更。 entities, subscriptions 等のデータコレクションのみクリアし、 auth 関連コレクション(users, tenants, policies 等)を保持する。
1 parent 2301faa commit 1c1e51b

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

tests/e2e/support/hooks.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,17 @@ BeforeAll(async function () {
4242
});
4343

4444
Before(async function (this: GdbWorld) {
45-
// DB cleanup for scenario isolation — delete documents but preserve collections/indexes
46-
// and skip auth-related collections (users) to avoid server-side cache inconsistencies
45+
// DB cleanup for scenario isolation — only clear data collections.
46+
// Auth-related collections (users, tenants, policies, etc.) are preserved
47+
// to avoid server-side cache inconsistencies that cause 401 errors.
4748
const db = mongoClient.db();
48-
const skipCollections = new Set(["users"]);
49+
const dataCollections = new Set([
50+
"entities", "subscriptions", "csourceRegistrations",
51+
"temporalEntities", "rules", "custom-data-models", "snapshots",
52+
]);
4953
const collections = await db.listCollections().toArray();
5054
for (const c of collections) {
51-
if (!c.name.startsWith("system.") && !skipCollections.has(c.name)) {
55+
if (dataCollections.has(c.name)) {
5256
await db.collection(c.name).deleteMany({});
5357
}
5458
}

0 commit comments

Comments
 (0)