Skip to content

Commit

Permalink
Add a CNAME loop test to integration (#399)
Browse files Browse the repository at this point in the history
* added cname loop integration test

* undo zdns integration test rename

* remove integration test from another branch

---------

Co-authored-by: Zakir Durumeric <zakird@gmail.com>
  • Loading branch information
phillip-stephens and zakird authored Aug 1, 2024
1 parent 67c560c commit 0a02b64
Showing 1 changed file with 14 additions and 23 deletions.
37 changes: 14 additions & 23 deletions testing/integration_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,20 @@ def run_zdns_multiline(self, flags, names, executable=ZDNS_EXECUTABLE):
}
]

CNAME_LOOP_ANSWERS = [
{
"type": "CNAME",
"class": "IN",
"name": "cname-loop.zdns-testing.com",
"answer": "cname-loop.esrg.stanford.edu.",
}, {
"type": "CNAME",
"class": "IN",
"name": "cname-loop.esrg.stanford.edu",
"answer": "cname-loop.zdns-testing.com.",
}
]

# an A record behind a DNAME record
DNAME_A_RECORD_ANSWERS = [
{
Expand Down Expand Up @@ -574,29 +588,6 @@ def test_cname(self):
self.assertSuccess(res, cmd)
self.assertEqualAnswers(res, self.WWW_CNAME_ANSWERS, cmd)

def test_dname(self):
c = "DNAME --iterative"
name = "zdns-dname.esrg.stanford.edu"
cmd, res = self.run_zdns(c, name)
self.assertSuccess(res, cmd)
self.assertEqual(res["data"]["answers"][0]["type"], "DNAME")
self.assertEqual(res["data"]["answers"][0]["name"], "zdns-dname.esrg.stanford.edu")
self.assertEqual(res["data"]["answers"][0]["answer"], "zdns-testing.com.")

# Test for A record behind a DNAME record
# There exists the following records:
# a.zdns-dname.esrg.stanford.edu A 56.78.90.12
# a.zdns-testing.com A 21.9.87.65
# zdns-dname.esrg.stanford.edu DNAME zdns-testing.com.
#
# The query is for a.zdns-dname.esrg.stanford.edu and should return an A record stating "21.9.87.65"
def test_a_record_behind_dname(self):
c = "A --iterative"
name = "a.zdns-dname.esrg.stanford.edu"
cmd, res = self.run_zdns(c, name)
self.assertSuccess(res, cmd)
self.assertEqualAnswers(res, self.DNAME_A_RECORD_ANSWERS, cmd)

def test_caa(self):
c = "CAA"
name = "zdns-testing.com"
Expand Down

0 comments on commit 0a02b64

Please sign in to comment.