Skip to content

Commit b2176a2

Browse files
committed
fix clear() and min predefined
1 parent 85c36b7 commit b2176a2

File tree

2 files changed

+48
-58
lines changed

2 files changed

+48
-58
lines changed

integrationTest/integration_test.go

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ func porkbunUrlfwd(name, target, t, includePath, wildcard string) *models.Record
831831
return r
832832
}
833833

834-
func clear() *TestCase {
834+
func tcEmptyZone() *TestCase {
835835
return tc("Empty")
836836
}
837837

@@ -904,9 +904,9 @@ func makeTests() []*TestGroup {
904904
// whether or not a certain kind of record can be created and
905905
// deleted.
906906

907-
// clear() is the same as tc("Empty"). It removes all records.
908-
// Each testgroup() begins with clear() automagically. You do not
909-
// have to include the clear() in each testgroup().
907+
// emptyzone() is the same as tc("Empty"). It removes all records.
908+
// Each testgroup() begins with tcEmptyZone() automagically. You do not
909+
// have to include the tcEmptyZone() in each testgroup().
910910

911911
tests := []*TestGroup{
912912
// START HERE
@@ -1037,15 +1037,15 @@ func makeTests() []*TestGroup {
10371037

10381038
testgroup("ManyAtOnce",
10391039
tc("CreateManyAtLabel", a("www", "1.1.1.1"), a("www", "2.2.2.2"), a("www", "3.3.3.3")),
1040-
clear(),
1040+
tcEmptyZone(),
10411041
tc("Create an A record", a("www", "1.1.1.1")),
10421042
tc("Add at label1", a("www", "1.1.1.1"), a("www", "2.2.2.2")),
10431043
tc("Add at label2", a("www", "1.1.1.1"), a("www", "2.2.2.2"), a("www", "3.3.3.3")),
10441044
),
10451045

10461046
testgroup("manyTypesAtOnce",
10471047
tc("CreateManyTypesAtLabel", a("www", "1.1.1.1"), mx("testmx", 5, "foo.com."), mx("testmx", 100, "bar.com.")),
1048-
clear(),
1048+
tcEmptyZone(),
10491049
tc("Create an A record", a("www", "1.1.1.1")),
10501050
tc("Add Type At Label", a("www", "1.1.1.1"), mx("testmx", 5, "foo.com.")),
10511051
tc("Add Type At Label", a("www", "1.1.1.1"), mx("testmx", 5, "foo.com."), mx("testmx", 100, "bar.com.")),
@@ -1283,7 +1283,7 @@ func makeTests() []*TestGroup {
12831283
tc("a 764-byte TXT", txt("foo764", strings.Repeat("G", 764))), // 255*3-1
12841284
tc("a 765-byte TXT", txt("foo765", strings.Repeat("H", 765))), // 255*3
12851285
tc("a 766-byte TXT", txt("foo766", strings.Repeat("J", 766))), // 255*3+1
1286-
// clear(),
1286+
// tcEmptyZone(),
12871287

12881288
tc("TXT with 1 single-quote", txt("foosq", "quo'te")),
12891289
tc("TXT with 1 backtick", txt("foobt", "blah`blah")),
@@ -1586,7 +1586,7 @@ func makeTests() []*TestGroup {
15861586
// SOA
15871587
testgroup("SOA",
15881588
requires(providers.CanUseSOA),
1589-
clear(), // Extra clear required or only the first run passes.
1589+
tcEmptyZone(), // Required or only the first run passes.
15901590
tc("Create SOA record", soa("@", "kim.ns.cloudflare.com.", "dns.cloudflare.com.", 2037190000, 10000, 2400, 604800, 3600)),
15911591
tc("Modify SOA ns ", soa("@", "mmm.ns.cloudflare.com.", "dns.cloudflare.com.", 2037190000, 10000, 2400, 604800, 3600)),
15921592
tc("Modify SOA mbox ", soa("@", "mmm.ns.cloudflare.com.", "eee.cloudflare.com.", 2037190000, 10000, 2400, 604800, 3600)),
@@ -1606,7 +1606,7 @@ func makeTests() []*TestGroup {
16061606
tc("Change Priority", srv("_sip._tcp", 52, 6, 7, "foo.com."), srv("_sip._tcp", 15, 65, 75, "foo4.com.")),
16071607
tc("Change Weight", srv("_sip._tcp", 52, 62, 7, "foo.com."), srv("_sip._tcp", 15, 65, 75, "foo4.com.")),
16081608
tc("Change Port", srv("_sip._tcp", 52, 62, 72, "foo.com."), srv("_sip._tcp", 15, 65, 75, "foo4.com.")),
1609-
clear(),
1609+
tcEmptyZone(),
16101610
tc("Null Target", srv("_sip._tcp", 15, 65, 75, ".")),
16111611
),
16121612

@@ -1934,12 +1934,12 @@ func makeTests() []*TestGroup {
19341934

19351935
// Removed these for speed. They tested if order matters,
19361936
// which it doesn't seem to. Re-add if needed.
1937-
clear(),
1937+
tcEmptyZone(),
19381938
tc("multipleA",
19391939
cfRedir("cnn.**current-domain-no-trailing**/*", "https://www.cnn.com/$1"),
19401940
cfRedir("msnbc.**current-domain-no-trailing**/*", "https://msnbc.cnn.com/$1"),
19411941
),
1942-
clear(),
1942+
tcEmptyZone(),
19431943
tc("multipleB",
19441944
cfRedir("msnbc.**current-domain-no-trailing**/*", "https://msnbc.cnn.com/$1"),
19451945
cfRedir("cnn.**current-domain-no-trailing**/*", "https://www.cnn.com/$1"),
@@ -1954,24 +1954,24 @@ func makeTests() []*TestGroup {
19541954
),
19551955

19561956
// NB(tlim): This test case used to fail but mysteriously started working.
1957-
clear(),
1957+
tcEmptyZone(),
19581958
tc("multiple3",
19591959
cfRedir("msnbc.**current-domain-no-trailing**/*", "https://msnbc.cnn.com/$1"),
19601960
cfRedir("cnn.**current-domain-no-trailing**/*", "https://www.cnn.com/$1"),
19611961
cfRedir("nytimes.**current-domain-no-trailing**/*", "https://www.nytimes.com/$1"),
19621962
),
19631963

19641964
// Repeat the above tests using CF_TEMP_REDIR instead
1965-
clear(),
1965+
tcEmptyZone(),
19661966
tc("tempredir", cfRedirTemp("cnn.**current-domain-no-trailing**/*", "https://www.cnn.com/$1")),
19671967
tc("tempchange", cfRedirTemp("cnn.**current-domain-no-trailing**/*", "https://change.cnn.com/$1")),
19681968
tc("tempchangelabel", cfRedirTemp("cable.**current-domain-no-trailing**/*", "https://change.cnn.com/$1")),
1969-
clear(),
1969+
tcEmptyZone(),
19701970
tc("tempmultipleA",
19711971
cfRedirTemp("cnn.**current-domain-no-trailing**/*", "https://www.cnn.com/$1"),
19721972
cfRedirTemp("msnbc.**current-domain-no-trailing**/*", "https://msnbc.cnn.com/$1"),
19731973
),
1974-
clear(),
1974+
tcEmptyZone(),
19751975
tc("tempmultipleB",
19761976
cfRedirTemp("msnbc.**current-domain-no-trailing**/*", "https://msnbc.cnn.com/$1"),
19771977
cfRedirTemp("cnn.**current-domain-no-trailing**/*", "https://www.cnn.com/$1"),
@@ -2014,10 +2014,10 @@ func makeTests() []*TestGroup {
20142014

20152015
testgroup("CF_PROXY A create",
20162016
only("CLOUDFLAREAPI"),
2017-
CfProxyOff(), clear(),
2018-
CfProxyOn(), clear(),
2019-
CfProxyFull1(), clear(),
2020-
CfProxyFull2(), clear(),
2017+
CfProxyOff(), tcEmptyZone(),
2018+
CfProxyOn(), tcEmptyZone(),
2019+
CfProxyFull1(), tcEmptyZone(),
2020+
CfProxyFull2(), tcEmptyZone(),
20212021
),
20222022

20232023
// These next testgroups attempt every possible transition between off, on, full1 and full2.
@@ -2026,62 +2026,62 @@ func makeTests() []*TestGroup {
20262026

20272027
testgroup("CF_PROXY A off to X",
20282028
only("CLOUDFLAREAPI"),
2029-
// CF_PROXY_OFF(), CF_PROXY_OFF(), clear(), // redundant
2030-
CfProxyOff(), CfProxyOn(), clear(),
2031-
CfProxyOff(), CfProxyFull1(), clear(),
2032-
CfProxyOff(), CfProxyFull2(), clear(),
2029+
// CF_PROXY_OFF(), CF_PROXY_OFF(), tcEmptyZone(), // redundant
2030+
CfProxyOff(), CfProxyOn(), tcEmptyZone(),
2031+
CfProxyOff(), CfProxyFull1(), tcEmptyZone(),
2032+
CfProxyOff(), CfProxyFull2(), tcEmptyZone(),
20332033
),
20342034

20352035
testgroup("CF_PROXY A on to X",
20362036
only("CLOUDFLAREAPI"),
2037-
CfProxyOn(), CfProxyOff(), clear(),
2038-
// CF_PROXY_ON(), CF_PROXY_ON(), clear(), // redundant
2039-
// CF_PROXY_ON(), CF_PROXY_FULL1().ExpectNoChanges(), clear(), // Removed for speed
2040-
CfProxyOn(), CfProxyFull2(), clear(),
2037+
CfProxyOn(), CfProxyOff(), tcEmptyZone(),
2038+
// CF_PROXY_ON(), CF_PROXY_ON(), tcEmptyZone(), // redundant
2039+
// CF_PROXY_ON(), CF_PROXY_FULL1().ExpectNoChanges(), tcEmptyZone(), // Removed for speed
2040+
CfProxyOn(), CfProxyFull2(), tcEmptyZone(),
20412041
),
20422042

20432043
testgroup("CF_PROXY A full1 to X",
20442044
only("CLOUDFLAREAPI"),
2045-
CfProxyFull1(), CfProxyOff(), clear(),
2046-
// CF_PROXY_FULL1(), CF_PROXY_ON().ExpectNoChanges(), clear(), // Removed for speed
2047-
// CF_PROXY_FULL1(), clear(), // redundant
2048-
CfProxyFull1(), CfProxyFull2(), clear(),
2045+
CfProxyFull1(), CfProxyOff(), tcEmptyZone(),
2046+
// CF_PROXY_FULL1(), CF_PROXY_ON().ExpectNoChanges(), tcEmptyZone(), // Removed for speed
2047+
// CF_PROXY_FULL1(), tcEmptyZone(), // redundant
2048+
CfProxyFull1(), CfProxyFull2(), tcEmptyZone(),
20492049
),
20502050

20512051
testgroup("CF_PROXY A full2 to X",
20522052
only("CLOUDFLAREAPI"),
2053-
CfProxyFull2(), CfProxyOff(), clear(),
2054-
CfProxyFull2(), CfProxyOn(), clear(),
2055-
CfProxyFull2(), CfProxyFull1(), clear(),
2056-
// CF_PROXY_FULL2(), CF_PROXY_FULL2(), clear(), // redundant
2053+
CfProxyFull2(), CfProxyOff(), tcEmptyZone(),
2054+
CfProxyFull2(), CfProxyOn(), tcEmptyZone(),
2055+
CfProxyFull2(), CfProxyFull1(), tcEmptyZone(),
2056+
// CF_PROXY_FULL2(), CF_PROXY_FULL2(), tcEmptyZone(), // redundant
20572057
),
20582058

20592059
testgroup("CF_PROXY CNAME create",
20602060
only("CLOUDFLAREAPI"),
2061-
CfCProxyOff(), clear(),
2062-
CfCProxyOn(), clear(),
2063-
CfCProxyFull(), clear(),
2061+
CfCProxyOff(), tcEmptyZone(),
2062+
CfCProxyOn(), tcEmptyZone(),
2063+
CfCProxyFull(), tcEmptyZone(),
20642064
),
20652065

20662066
testgroup("CF_PROXY CNAME off to X",
20672067
only("CLOUDFLAREAPI"),
2068-
// CF_CPROXY_OFF(), CF_CPROXY_OFF(), clear(), // redundant
2069-
CfCProxyOff(), CfCProxyOn(), clear(),
2070-
CfCProxyOff(), CfCProxyFull(), clear(),
2068+
// CF_CPROXY_OFF(), CF_CPROXY_OFF(), tcEmptyZone(), // redundant
2069+
CfCProxyOff(), CfCProxyOn(), tcEmptyZone(),
2070+
CfCProxyOff(), CfCProxyFull(), tcEmptyZone(),
20712071
),
20722072

20732073
testgroup("CF_PROXY CNAME on to X",
20742074
only("CLOUDFLAREAPI"),
2075-
CfCProxyOn(), CfCProxyOff(), clear(),
2076-
// CF_CPROXY_ON(), CF_CPROXY_ON(), clear(), // redundant
2077-
// CF_CPROXY_ON(), CF_CPROXY_FULL().ExpectNoChanges(), clear(), // Removed for speed
2075+
CfCProxyOn(), CfCProxyOff(), tcEmptyZone(),
2076+
// CF_CPROXY_ON(), CF_CPROXY_ON(), tcEmptyZone(), // redundant
2077+
// CF_CPROXY_ON(), CF_CPROXY_FULL().ExpectNoChanges(), tcEmptyZone(), // Removed for speed
20782078
),
20792079

20802080
testgroup("CF_PROXY CNAME full to X",
20812081
only("CLOUDFLAREAPI"),
2082-
CfCProxyFull(), CfCProxyOff(), clear(),
2083-
// CF_CPROXY_FULL(), CF_CPROXY_ON().ExpectNoChanges(), clear(), // Removed for speed
2084-
// CF_CPROXY_FULL(), clear(), // redundant
2082+
CfCProxyFull(), CfCProxyOff(), tcEmptyZone(),
2083+
// CF_CPROXY_FULL(), CF_CPROXY_ON().ExpectNoChanges(), tcEmptyZone(), // Removed for speed
2084+
// CF_CPROXY_FULL(), tcEmptyZone(), // redundant
20852085
),
20862086

20872087
testgroup("CF_WORKER_ROUTE",
@@ -2091,7 +2091,7 @@ func makeTests() []*TestGroup {
20912091
tc("simple", cfWorkerRoute("cnn.**current-domain-no-trailing**/*", "dnscontrol_integrationtest_cnn")),
20922092
tc("changeScript", cfWorkerRoute("cnn.**current-domain-no-trailing**/*", "dnscontrol_integrationtest_msnbc")),
20932093
tc("changePattern", cfWorkerRoute("cable.**current-domain-no-trailing**/*", "dnscontrol_integrationtest_msnbc")),
2094-
clear(),
2094+
tcEmptyZone(),
20952095
tc("createMultiple",
20962096
cfWorkerRoute("cnn.**current-domain-no-trailing**/*", "dnscontrol_integrationtest_cnn"),
20972097
cfWorkerRoute("msnbc.**current-domain-no-trailing**/*", "dnscontrol_integrationtest_msnbc"),

pkg/diff2/min.go

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)