Browse Source

Fix occasional test failure for NS records configured in legacy format

(no code change, just fixing the test)
Ask Bjørn Hansen 11 years ago
parent
commit
36184e853b
1 changed files with 6 additions and 2 deletions
  1. 6 2
      zone_test.go

+ 6 - 2
zone_test.go

@@ -39,11 +39,15 @@ func (s *ConfigSuite) TestExampleComZone(c *C) {
 	c.Check(label.Records[dns.TypeCNAME], HasLen, 1)
 	c.Check(qtype, Equals, dns.TypeCNAME)
 
+	// pretty.Println(ex.Labels[""].Records[dns.TypeNS])
+
 	label, qtype = ex.findLabels("", []string{"@"}, qTypes{dns.TypeNS})
 	Ns := label.Records[dns.TypeNS]
 	c.Check(Ns, HasLen, 2)
-	c.Check(Ns[0].RR.(*dns.NS).Ns, Equals, "ns1.example.net.")
-	c.Check(Ns[1].RR.(*dns.NS).Ns, Equals, "ns2.example.net.")
+	// Test that we get the expected NS records (in any order because
+	// of the configuration format used for this zone)
+	c.Check(Ns[0].RR.(*dns.NS).Ns, Matches, "^ns[12]\\.example\\.net.$")
+	c.Check(Ns[1].RR.(*dns.NS).Ns, Matches, "^ns[12]\\.example\\.net.$")
 
 	label, qtype = ex.findLabels("", []string{"@"}, qTypes{dns.TypeSPF})
 	Spf := label.Records[dns.TypeSPF]