mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
merge(master): sync master into dev
This commit is contained in:
@@ -8,6 +8,7 @@ import { describe, it, expect, beforeAll, afterAll, vi } from "vitest";
|
||||
const originalDataDir = process.env.DATA_DIR;
|
||||
let tempDir;
|
||||
let db;
|
||||
let adminOwnerId;
|
||||
|
||||
beforeAll(async () => {
|
||||
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "9router-concurrent-"));
|
||||
@@ -15,6 +16,8 @@ beforeAll(async () => {
|
||||
vi.resetModules();
|
||||
db = await import("@/lib/db/index.js");
|
||||
await db.initDb();
|
||||
const admin = await db.createUser({ username: "concurrency-admin", password: "password", role: "admin" });
|
||||
adminOwnerId = admin.id;
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
@@ -102,6 +105,7 @@ describe("DB Concurrency — atomic safety", () => {
|
||||
const conn = await db.createProviderConnection({
|
||||
provider: "oauth-test", authType: "oauth", email: "x@y.com",
|
||||
accessToken: "initial", refreshToken: "rt-initial",
|
||||
ownerId: adminOwnerId,
|
||||
});
|
||||
|
||||
// 20 parallel updates each with a unique field
|
||||
|
||||
Reference in New Issue
Block a user