fix(integrations): не считать CNAME hostname за IP при sync
JOIN dns_record клал content CNAME в target_ips и блокировал разворот до origin IP / service IPs. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -108,4 +108,42 @@ describe("resolveBindingIpsForSync", () => {
|
||||
const ips = await resolveBindingIpsForSync(cname, ["198.51.100.7"], index);
|
||||
expect(ips).toEqual(["198.51.100.7"]);
|
||||
});
|
||||
|
||||
it("does not treat CNAME hostname in target_ips as an IP", async () => {
|
||||
const target = binding({
|
||||
id: 1,
|
||||
hostname: "ihome",
|
||||
zone_name: "rkns.top",
|
||||
target_ips: ["203.0.113.10"],
|
||||
});
|
||||
const cname = binding({
|
||||
id: 2,
|
||||
hostname: "imsk",
|
||||
zone_name: "rkns.top",
|
||||
cname_target: "ihome.rkns.top",
|
||||
// как в прод: JOIN dns_record кладёт CNAME content в target_ip → target_ips
|
||||
target_ips: ["ihome.rkns.top"],
|
||||
});
|
||||
const index = {
|
||||
byFqdn: new Map([
|
||||
["ihome.rkns.top", target],
|
||||
["imsk.rkns.top", cname],
|
||||
]),
|
||||
};
|
||||
const ips = await resolveBindingIpsForSync(cname, [], index);
|
||||
expect(ips).toEqual(["203.0.113.10"]);
|
||||
});
|
||||
|
||||
it("prefers service IPs over empty CNAME resolution chain", async () => {
|
||||
const cname = binding({
|
||||
id: 2,
|
||||
hostname: "mhome",
|
||||
zone_name: "rkns.top",
|
||||
cname_target: "macloud.rkns.top",
|
||||
target_ips: ["macloud.rkns.top"],
|
||||
});
|
||||
const index = { byFqdn: new Map([["mhome.rkns.top", cname]]) };
|
||||
const ips = await resolveBindingIpsForSync(cname, ["203.0.113.55"], index);
|
||||
expect(ips).toEqual(["203.0.113.55"]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user