Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions domainconnectzone/DomainConnectImpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,6 @@ def check_conflict_with_self(new_record, new_records):
if error:
raise InvalidData(f"Template record {new_record['type']} {new_record['name']} conflicts with other tempate record {zone_record['type']} {zone_record['name']}")

_RECORD_COMPARE_SKIP = {'_delete', '_replace', 'ttl'}

_CORE_TYPES = {'A', 'AAAA', 'CNAME', 'MX', 'NS', 'SRV', 'TXT', 'SPFM',
'REDIR301', 'REDIR302'}

Expand Down Expand Up @@ -687,6 +685,7 @@ def _normalise_record(record):
result[k] = v
return result

_RECORD_COMPARE_SKIP = {'_delete', '_replace', 'ttl', "_dc"}

def _find_identical_zone_record(new_record, zone_records):
"""Return the zone record identical to new_record, or None.
Expand Down
6 changes: 2 additions & 4 deletions test/harness_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
"priority", "protocol", "service", "weight", "port",
"_dc",
}
_DC_KEYS = {"id", "providerId", "serviceId", "host", "essential"}


# ---------------------------------------------------------------------------
# Key-validation helpers
Expand All @@ -63,8 +61,8 @@ def check_keys(mapping, allowed, context):
def validate_zone_record(record, context):
"""Validate a single zone record (input or expected output)."""
check_keys(record, _ZONE_RECORD_KEYS, context)
if "_dc" in record:
check_keys(record["_dc"], _DC_KEYS, "_dc of {}".format(context))
if "_dc" in record and not isinstance(record["_dc"], object):
raise ValueError("_dc not an object: {}".format(record["_dc"]))


def validate_common_case(case, inp, ctx, input_keys):
Expand Down
18 changes: 18 additions & 0 deletions test/test_definitions/process_records_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4109,6 +4109,24 @@ tests:
records:
- {type: TXT, name: "@", data: '"Hello World"', ttl: 1800}

- id: duplicate_skip_txt_dc
description: "TXT: identical record already in zone is not added again (no conflict rule, existing has _dc)"
input:
zone_records:
- {data: 'Hello World', name: '@', ttl: 1800, type: 'TXT', _dc: {record_id: '74688294'}}
template_records:
- {type: TXT, host: "@", data: '%RANDOMTEXT%', ttl: 600}
domain: example.com
host: ""
params: { RANDOMTEXT: 'Hello World'}
expect:
new_count: 0
delete_count: 0
records:
- {data: 'Hello World', name: '@', ttl: 1800, type: 'TXT', _dc: {record_id: '74688294'}}



- id: duplicate_skip_txt_case_diff
description: "TXT: identical record already in zone is not added again (no conflict rule, case diff)"
input:
Expand Down
Loading