Skip to content

Commit

Permalink
mooore tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tlimoncelli committed Dec 18, 2024
1 parent 7bfee0b commit d7739e8
Showing 1 changed file with 119 additions and 27 deletions.
146 changes: 119 additions & 27 deletions integrationTest/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -2200,7 +2193,6 @@ func makeTests() []*TestGroup {
cname("mail", "ghs.googlehosted.com."),
).ExpectNoChanges(),

//
// Many types:
tc("ignore manytypes",
//a("foo", "1.2.3.4"),
Expand Down Expand Up @@ -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.
Expand All @@ -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"),
Expand All @@ -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"),
Expand All @@ -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"),
Expand All @@ -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"),
Expand All @@ -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"),
Expand All @@ -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"),
Expand All @@ -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"),
Expand All @@ -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"),
Expand All @@ -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"),
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d7739e8

Please sign in to comment.