From d7739e8fb9400eb96782ef4ce5375ded6b053d44 Mon Sep 17 00:00:00 2001 From: Tom Limoncelli Date: Wed, 18 Dec 2024 15:37:43 -0500 Subject: [PATCH] mooore tests --- integrationTest/integration_test.go | 146 +++++++++++++++++++++++----- 1 file changed, 119 insertions(+), 27 deletions(-) diff --git a/integrationTest/integration_test.go b/integrationTest/integration_test.go index c21cab5f83..0d9e670e14 100644 --- a/integrationTest/integration_test.go +++ b/integrationTest/integration_test.go @@ -2093,13 +2093,6 @@ func makeTests() []*TestGroup { a("bar", "5.5.5.5"), cname("mail", "ghs.googlehosted.com."), ), - tc("VERIFY PREVIOUS", - a("foo", "1.2.3.4"), - a("foo", "2.3.4.5"), - txt("foo", "simple"), - a("bar", "5.5.5.5"), - cname("mail", "ghs.googlehosted.com."), - ).ExpectNoChanges(), tc("ignore label", // NB(tlim): This ignores 1 record of a recordSet. This should @@ -2200,7 +2193,6 @@ func makeTests() []*TestGroup { cname("mail", "ghs.googlehosted.com."), ).ExpectNoChanges(), - // // Many types: tc("ignore manytypes", //a("foo", "1.2.3.4"), @@ -2246,7 +2238,7 @@ func makeTests() []*TestGroup { cname("mail", "ghs.googlehosted.com."), ), - tc("ignore label", + tc("apex label", // NB(tlim): This ignores 1 record of a recordSet. This should // fail for diff2.ByRecordSet() providers if diff2 is not // implemented correctly. @@ -2269,7 +2261,7 @@ func makeTests() []*TestGroup { cname("mail", "ghs.googlehosted.com."), ).ExpectNoChanges(), - tc("ignore label,type", + tc("apex label,type", //a("@", "1.2.3.4"), //a("@", "2.3.4.5"), txt("@", "simple"), @@ -2285,7 +2277,7 @@ func makeTests() []*TestGroup { cname("mail", "ghs.googlehosted.com."), ).ExpectNoChanges(), - tc("ignore label,type,target", + tc("apex label,type,target", //a("@", "1.2.3.4"), a("@", "2.3.4.5"), txt("@", "simple"), @@ -2304,7 +2296,7 @@ func makeTests() []*TestGroup { cname("mail", "ghs.googlehosted.com."), ).ExpectNoChanges(), - tc("ignore type", + tc("apex type", //a("@", "1.2.3.4"), //a("@", "2.3.4.5"), txt("@", "simple"), @@ -2320,7 +2312,7 @@ func makeTests() []*TestGroup { cname("mail", "ghs.googlehosted.com."), ).ExpectNoChanges(), - tc("ignore type,target", + tc("apex type,target", a("@", "1.2.3.4"), //a("@", "2.3.4.5"), txt("@", "simple"), @@ -2336,7 +2328,7 @@ func makeTests() []*TestGroup { cname("mail", "ghs.googlehosted.com."), ).ExpectNoChanges(), - tc("ignore target", + tc("apex target", a("@", "1.2.3.4"), //a("@", "2.3.4.5"), txt("@", "simple"), @@ -2353,7 +2345,7 @@ func makeTests() []*TestGroup { ).ExpectNoChanges(), // Many types: - tc("ignore manytypes", + tc("apex manytypes", //a("@", "1.2.3.4"), //a("@", "2.3.4.5"), //txt("@", "simple"), @@ -2372,19 +2364,20 @@ func makeTests() []*TestGroup { // IGNORE with unsafe notation - testgroup("IGNORE cross", + testgroup("IGNORE unsafe", tc("Create some records", txt("foo", "simple"), a("foo", "1.2.3.4"), txt("@", "asimple"), a("@", "2.2.2.2"), ), - tc("ignore label=apex", + + tc("ignore unsafe apex", txt("foo", "simple"), a("foo", "1.2.3.4"), txt("@", "asimple"), a("@", "2.2.2.2"), - ignore("foo", "TXT", ""), + ignore("@", "", ""), ).ExpectNoChanges().UnsafeIgnore(), tc("VERIFY PREVIOUS", txt("foo", "simple"), @@ -2393,12 +2386,12 @@ func makeTests() []*TestGroup { a("@", "2.2.2.2"), ).ExpectNoChanges(), - tc("ignore label=apex", + tc("ignore unsafe label", txt("foo", "simple"), a("foo", "1.2.3.4"), txt("@", "asimple"), a("@", "2.2.2.2"), - ignore("@", "TXT", ""), + ignore("foo", "", ""), ).ExpectNoChanges().UnsafeIgnore(), tc("VERIFY PREVIOUS", txt("foo", "simple"), @@ -2418,13 +2411,6 @@ func makeTests() []*TestGroup { a("bar.bat", "5.5.5.5"), cname("mail.bat", "ghs.googlehosted.com."), ), - tc("VERIFY PREVIOUS", - a("foo.bat", "1.2.3.4"), - a("foo.bat", "2.3.4.5"), - txt("foo.bat", "simple"), - a("bar.bat", "5.5.5.5"), - cname("mail.bat", "ghs.googlehosted.com."), - ).ExpectNoChanges(), tc("ignore label=foo.*", //a("foo.bat", "1.2.3.4"), @@ -2475,6 +2461,112 @@ func makeTests() []*TestGroup { ).ExpectNoChanges(), ), + // IGNORE with changes + testgroup("IGNORE with modify", + tc("Create some records", + a("foo", "1.1.1.1"), + a("foo", "10.10.10.10"), + aaaa("foo", "2003:dd:d7ff::fe71:aaaa"), + mx("foo", 10, "aspmx.l.google.com."), + mx("foo", 20, "alt1.aspmx.l.google.com"), + a("zzz", "3.3.3.3"), + a("zzz", "4.4.4.4"), + aaaa("zzz", "2003:dd:d7ff::fe71:cccc"), + ), + + // ByZone: Change (anywhere) + tc("IGNORE change ByZone", + ignore("zzz", "A", ""), + a("foo", "1.1.1.1"), + a("foo", "11.11.11.11"), // CHANGE + aaaa("foo", "2003:dd:d7ff::fe71:aaaa"), + mx("foo", 10, "aspmx.l.google.com."), + mx("foo", 20, "alt1.aspmx.l.google.com"), + //a("zzz", "3.3.3.3"), + //a("zzz", "4.4.4.4"), + aaaa("zzz", "2003:dd:d7ff::fe71:cccc"), + ), + tc("VERIFY PREVIOUS", + a("foo", "1.1.1.1"), + a("foo", "11.11.11.11"), + aaaa("foo", "2003:dd:d7ff::fe71:aaaa"), + mx("foo", 10, "aspmx.l.google.com."), + mx("foo", 20, "alt1.aspmx.l.google.com"), + a("zzz", "3.3.3.3"), + a("zzz", "4.4.4.4"), + aaaa("zzz", "2003:dd:d7ff::fe71:cccc"), + ).ExpectNoChanges(), + + // ByLabel: Change within a (name) while we ignore the rest + tc("IGNORE change ByLabel", + ignore("foo", "MX", ""), + a("foo", "1.1.1.1"), + a("foo", "12.12.12.12"), // CHANGE + aaaa("foo", "2003:dd:d7ff::fe71:aaaa"), + //mx("foo", 10, "aspmx.l.google.com."), + //mx("foo", 20, "alt1.aspmx.l.google.com"), + a("zzz", "3.3.3.3"), + a("zzz", "4.4.4.4"), + aaaa("zzz", "2003:dd:d7ff::fe71:cccc"), + ), + tc("VERIFY PREVIOUS", + a("foo", "1.1.1.1"), + a("foo", "12.12.12.12"), + aaaa("foo", "2003:dd:d7ff::fe71:aaaa"), + mx("foo", 10, "aspmx.l.google.com."), + mx("foo", 20, "alt1.aspmx.l.google.com"), + a("zzz", "3.3.3.3"), + a("zzz", "4.4.4.4"), + aaaa("zzz", "2003:dd:d7ff::fe71:cccc"), + ).ExpectNoChanges(), + + // ByRecordSet: Change within a (name+type) while we ignore the rest + tc("IGNORE change ByRecordSet", + ignore("foo", "MX,AAAA", ""), + a("foo", "1.1.1.1"), + a("foo", "13.13.13.13"), // CHANGE + //aaaa("foo", "2003:dd:d7ff::fe71:aaaa"), + //mx("foo", 10, "aspmx.l.google.com."), + //mx("foo", 20, "alt1.aspmx.l.google.com"), + a("zzz", "3.3.3.3"), + a("zzz", "4.4.4.4"), + aaaa("zzz", "2003:dd:d7ff::fe71:cccc"), + ), + tc("VERIFY PREVIOUS", + a("foo", "1.1.1.1"), + a("foo", "13.13.13.13"), + aaaa("foo", "2003:dd:d7ff::fe71:aaaa"), + mx("foo", 10, "aspmx.l.google.com."), + mx("foo", 20, "alt1.aspmx.l.google.com"), + a("zzz", "3.3.3.3"), + a("zzz", "4.4.4.4"), + aaaa("zzz", "2003:dd:d7ff::fe71:cccc"), + ).ExpectNoChanges(), + + // Change within a (name+type+data) ("ByRecord") + tc("IGNORE change ByRecord", + ignore("foo", "A", "1.1.1.1"), + //a("foo", "1.1.1.1"), + a("foo", "14.14.14.14"), + aaaa("foo", "2003:dd:d7ff::fe71:aaaa"), + mx("foo", 10, "aspmx.l.google.com."), + mx("foo", 20, "alt1.aspmx.l.google.com"), + a("zzz", "3.3.3.3"), + a("zzz", "4.4.4.4"), + aaaa("zzz", "2003:dd:d7ff::fe71:cccc"), + ), + tc("VERIFY PREVIOUS", + a("foo", "1.1.1.1"), + a("foo", "14.14.14.14"), + aaaa("foo", "2003:dd:d7ff::fe71:aaaa"), + mx("foo", 10, "aspmx.l.google.com."), + mx("foo", 20, "alt1.aspmx.l.google.com"), + a("zzz", "3.3.3.3"), + a("zzz", "4.4.4.4"), + aaaa("zzz", "2003:dd:d7ff::fe71:cccc"), + ).ExpectNoChanges(), + ), + // IGNORE repro bug reports // https://github.com/StackExchange/dnscontrol/issues/2285