mirror of
https://github.com/shankar0123/certctl.git
synced 2026-06-08 07:38:57 +00:00
feat(m28+m29+m30): ACME ARI, email digest, and Helm chart
M28: ACME Renewal Information (RFC 9702) — CA-directed renewal timing with cert ID computation, directory endpoint discovery, graceful degradation for non-ARI CAs. 19 tests. M29: Email notifier wiring + scheduled certificate digest — SMTP connector bridged to service layer via NotifierAdapter, DigestService with HTML email template, 7th scheduler loop (24h), digest preview/send API endpoints and GUI card. 21 tests. M30: Production-ready Helm chart — server Deployment, PostgreSQL StatefulSet, agent DaemonSet, ConfigMaps, Secrets, Ingress, security contexts, health probes, example values for dev/prod/ACME scenarios. Also: OpenAPI spec updates, MCP tool additions, CI helm-lint job, documentation updates across 5 doc files and README. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -76,6 +76,8 @@ import {
|
||||
updateNetworkScanTarget,
|
||||
deleteNetworkScanTarget,
|
||||
triggerNetworkScan,
|
||||
previewDigest,
|
||||
sendDigest,
|
||||
} from './client';
|
||||
|
||||
// Mock global fetch
|
||||
@@ -966,4 +968,42 @@ describe('API Client', () => {
|
||||
expect(result.data[0].verified_at).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
// ─── Digest ─────────────────────────────
|
||||
|
||||
describe('Digest', () => {
|
||||
it('previewDigest fetches HTML preview', async () => {
|
||||
const html = '<html><body>Digest Preview</body></html>';
|
||||
mockFetch.mockReturnValueOnce(
|
||||
Promise.resolve({
|
||||
ok: true,
|
||||
status: 200,
|
||||
text: () => Promise.resolve(html),
|
||||
} as Response)
|
||||
);
|
||||
const result = await previewDigest();
|
||||
expect(mockFetch.mock.calls[0][0]).toBe('/api/v1/digest/preview');
|
||||
expect(result).toBe(html);
|
||||
});
|
||||
|
||||
it('previewDigest throws on error', async () => {
|
||||
mockFetch.mockReturnValueOnce(
|
||||
Promise.resolve({
|
||||
ok: false,
|
||||
status: 503,
|
||||
text: () => Promise.resolve('not configured'),
|
||||
} as Response)
|
||||
);
|
||||
await expect(previewDigest()).rejects.toThrow('Digest preview failed: 503');
|
||||
});
|
||||
|
||||
it('sendDigest sends POST request', async () => {
|
||||
mockFetch.mockReturnValueOnce(mockJsonResponse({ message: 'digest sent' }));
|
||||
const result = await sendDigest();
|
||||
const [url, init] = mockFetch.mock.calls[0];
|
||||
expect(url).toBe('/api/v1/digest/send');
|
||||
expect(init.method).toBe('POST');
|
||||
expect(result.message).toBe('digest sent');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -351,5 +351,19 @@ export const getIssuanceRate = (days = 30) =>
|
||||
export const getMetrics = () =>
|
||||
fetchJSON<MetricsResponse>(`${BASE}/metrics`);
|
||||
|
||||
// Digest
|
||||
export const previewDigest = () => {
|
||||
const headers: Record<string, string> = {};
|
||||
if (apiKey) headers['Authorization'] = `Bearer ${apiKey}`;
|
||||
return fetch(`${BASE}/digest/preview`, { headers })
|
||||
.then(r => {
|
||||
if (!r.ok) throw new Error(`Digest preview failed: ${r.status}`);
|
||||
return r.text();
|
||||
});
|
||||
};
|
||||
|
||||
export const sendDigest = () =>
|
||||
fetchJSON<{ message: string }>(`${BASE}/digest/send`, { method: 'POST' });
|
||||
|
||||
// Health
|
||||
export const getHealth = () => fetchJSON<{ status: string }>('/health');
|
||||
|
||||
Reference in New Issue
Block a user