fix: address performance review feedback
This commit is contained in:
1 parent
7266e15356
commit
0b9c4d6375
8 files changed
+42
-12
No files matched your search
@@ -44,6 +44,7 @@ describe("proxy database pools", () => {
|
||||
vi.resetModules();
|
||||
vi.clearAllMocks();
|
||||
for (const key of Object.keys(mocks.dbEnv)) delete mocks.dbEnv[key];
|
||||
mocks.mysqlCreatePool.mockReturnValue({});
|
||||
});
|
||||
|
||||
it("bounds MySQL URL pools instead of falling back to the driver defaults", async () => {
|
||||
@@ -108,4 +109,20 @@ describe("proxy database pools", () => {
|
||||
|
||||
expect(mocks.postgresPool).toHaveBeenCalledWith(expect.objectContaining({ max: 1 }));
|
||||
});
|
||||
|
||||
it("retries initialization after a transient driver failure", async () => {
|
||||
Object.assign(mocks.dbEnv, {
|
||||
DRIVER: "mysql2",
|
||||
URL: "mysql://homarr:test@localhost:3306/homarr",
|
||||
});
|
||||
mocks.mysqlCreatePool.mockImplementationOnce(() => {
|
||||
throw new Error("database unavailable");
|
||||
});
|
||||
|
||||
const { getOnboardingStepForProxyAsync } = await import("./proxy-reader");
|
||||
|
||||
await expect(getOnboardingStepForProxyAsync()).rejects.toThrow("database unavailable");
|
||||
await expect(getOnboardingStepForProxyAsync()).resolves.toBe("finish");
|
||||
expect(mocks.mysqlCreatePool).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user