feat(dns): Implement DNS preview records generation and enhance hostname preview functionality
quality / commitlint (push) Skipped
CD / update-wiki (push) Successful in 5s
quality / changes (push) Successful in 5s
quality / docker-check (push) Skipped
quality / web (push) Successful in 56s
quality / api (push) Successful in 43s
CD / quality (push) Successful in 1m46s
CD / publish (push) Successful in 1m40s
quality / commitlint (push) Skipped
CD / update-wiki (push) Successful in 5s
quality / changes (push) Successful in 5s
quality / docker-check (push) Skipped
quality / web (push) Successful in 56s
quality / api (push) Successful in 43s
CD / quality (push) Successful in 1m46s
CD / publish (push) Successful in 1m40s
- Added `buildDnsPreviewRecords` function to generate DNS records based on hostname, TTL, and provided IPv4/IPv6 addresses. - Updated `fleetRoutes` to utilize the new DNS records generation for hostname previews. - Enhanced frontend API calls to support IPv4, IPv6, and node ID parameters for more comprehensive hostname previews. - Updated UI components to display DNS preview information, including A, AAAA, and CNAME records.
This commit is contained in:
@@ -112,5 +112,44 @@ describe("fleet api", () => {
|
||||
});
|
||||
expect(topo.statusCode).toBe(200);
|
||||
expect(topo.json().nodes).toHaveLength(1);
|
||||
|
||||
const preview = await app.inject({
|
||||
method: "GET",
|
||||
url: `/api/v1/naming/preview?${new URLSearchParams({
|
||||
zoneId: zone.id,
|
||||
locationId: msk.id,
|
||||
role: "gw",
|
||||
indexNum: "2",
|
||||
ipv4: "198.51.100.10",
|
||||
ipv6: "2001:db8::10",
|
||||
nodeId: node.id,
|
||||
})}`,
|
||||
headers: authHeader,
|
||||
});
|
||||
expect(preview.statusCode).toBe(200);
|
||||
const body = preview.json() as {
|
||||
hostname: string;
|
||||
records: Array<{ type: string; name: string; content: string }>;
|
||||
};
|
||||
expect(body.hostname).toBe("msk-gw02.rtnt.top");
|
||||
expect(body.records).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
type: "A",
|
||||
name: "msk-gw02.rtnt.top",
|
||||
content: "198.51.100.10",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
type: "AAAA",
|
||||
name: "msk-gw02.rtnt.top",
|
||||
content: "2001:db8::10",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
type: "CNAME",
|
||||
name: "msk.rtnt.top",
|
||||
content: "msk-gw02.rtnt.top",
|
||||
}),
|
||||
]),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user