feat(api): enhance health check and DNS management
quality / commitlint (push) Skipped
CD / update-wiki (push) Successful in 7s
quality / changes (push) Successful in 8s
quality / docker-check (push) Skipped
quality / web (push) Successful in 1m9s
quality / api (push) Successful in 40s
CD / quality (push) Successful in 2m0s
CD / publish (push) Successful in 2m38s
quality / commitlint (push) Skipped
CD / update-wiki (push) Successful in 7s
quality / changes (push) Successful in 8s
quality / docker-check (push) Skipped
quality / web (push) Successful in 1m9s
quality / api (push) Successful in 40s
CD / quality (push) Successful in 2m0s
CD / publish (push) Successful in 2m38s
- Added batch endpoint for health status queries to reduce the number of requests. - Improved DNS record management with caching and invalidation mechanisms. - Updated health check service to handle new configurations and improve performance. - Refactored certificate service to utilize concurrency for checks, enhancing efficiency. - Removed unused dependencies and optimized package configurations. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -513,7 +513,7 @@ describe("certificates", () => {
|
||||
await testApp.close();
|
||||
});
|
||||
|
||||
it("GET /certificates prunes stale rows without running check", async () => {
|
||||
it("runAllChecks prunes stale rows; GET /certificates is a plain read", async () => {
|
||||
const testApp = await buildApp({
|
||||
config: { ...loadConfig(), staticDir: null },
|
||||
memory: true,
|
||||
@@ -563,13 +563,21 @@ describe("certificates", () => {
|
||||
|
||||
expect(repos.listCertificates(testApp.db)).toHaveLength(2);
|
||||
|
||||
// Read path must not mutate: stale rows survive until the cron prune.
|
||||
const listRes = await testApp.inject({
|
||||
method: "GET",
|
||||
url: "/api/v1/certificates",
|
||||
headers,
|
||||
});
|
||||
expect(listRes.statusCode).toBe(200);
|
||||
expect(listRes.json()).toEqual([]);
|
||||
expect(listRes.json()).toHaveLength(2);
|
||||
|
||||
vi.spyOn(certificateService, "checkHostname").mockResolvedValue({
|
||||
expiresAt: null,
|
||||
error: "network unreachable",
|
||||
});
|
||||
await certificateService.runAllChecks(testApp.db);
|
||||
expect(repos.listCertificates(testApp.db)).toEqual([]);
|
||||
|
||||
await testApp.close();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user