mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-01-11 18:08:57 +08:00
CICD: clean slate at the start, not end, of each testgroup (#2738)
This commit is contained in:
parent
1bbf9c4293
commit
d5eedab66e
1 changed files with 12 additions and 12 deletions
|
@ -288,12 +288,8 @@ func runTests(t *testing.T, prv providers.DNSServiceProvider, domainName string,
|
||||||
lastGroup = len(testGroups)
|
lastGroup = len(testGroups)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the zone with a clean slate.
|
|
||||||
makeChanges(t, prv, dc, tc("Empty"), "Clean Slate", false, nil)
|
|
||||||
|
|
||||||
curGroup := -1
|
curGroup := -1
|
||||||
for gIdx, group := range testGroups {
|
for gIdx, group := range testGroups {
|
||||||
start := time.Now()
|
|
||||||
|
|
||||||
// Abide by -start -end flags
|
// Abide by -start -end flags
|
||||||
curGroup++
|
curGroup++
|
||||||
|
@ -308,7 +304,11 @@ func runTests(t *testing.T, prv providers.DNSServiceProvider, domainName string,
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start the testgroup with a clean slate.
|
||||||
|
makeChanges(t, prv, dc, tc("Empty"), "Clean Slate", false, nil)
|
||||||
|
|
||||||
// Run the tests.
|
// Run the tests.
|
||||||
|
start := time.Now()
|
||||||
|
|
||||||
for _, tst := range group.tests {
|
for _, tst := range group.tests {
|
||||||
|
|
||||||
|
@ -326,9 +326,6 @@ func runTests(t *testing.T, prv providers.DNSServiceProvider, domainName string,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove all records so next group starts with a clean slate.
|
|
||||||
makeChanges(t, prv, dc, tc("Empty"), "Post cleanup", true, nil)
|
|
||||||
|
|
||||||
elapsed := time.Since(start)
|
elapsed := time.Since(start)
|
||||||
if *printElapsed {
|
if *printElapsed {
|
||||||
fmt.Printf("ELAPSED %02d %7.2f %q\n", gIdx, elapsed.Seconds(), group.Desc)
|
fmt.Printf("ELAPSED %02d %7.2f %q\n", gIdx, elapsed.Seconds(), group.Desc)
|
||||||
|
@ -800,11 +797,9 @@ func makeTests(t *testing.T) []*TestGroup {
|
||||||
// whether or not a certain kind of record can be created and
|
// whether or not a certain kind of record can be created and
|
||||||
// deleted.
|
// deleted.
|
||||||
|
|
||||||
// clear() is the same as tc("Empty"). It removes all records. You
|
// clear() is the same as tc("Empty"). It removes all records.
|
||||||
// can use this to verify a provider can delete all the records in
|
// Each testgroup() begins with clear() automagically. You do not
|
||||||
// the last tc(), or to provide a clean slate for the next tc().
|
// have to include the clear() in teach testgroup().
|
||||||
// Each testgroup() begins and ends with clear(), so you don't have
|
|
||||||
// to list the clear() yourself.
|
|
||||||
|
|
||||||
tests := []*TestGroup{
|
tests := []*TestGroup{
|
||||||
|
|
||||||
|
@ -2080,6 +2075,11 @@ func makeTests(t *testing.T) []*TestGroup {
|
||||||
ovhdmarc("_dmarc", "v=DMARC1; p=none; rua=mailto:dmarc@example.com")),
|
ovhdmarc("_dmarc", "v=DMARC1; p=none; rua=mailto:dmarc@example.com")),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// This MUST be the last test.
|
||||||
|
testgroup("final",
|
||||||
|
tc("final", txt("final", `TestDNSProviders was successful!`)),
|
||||||
|
),
|
||||||
|
|
||||||
// Narrative: Congrats! You're done! If you've made it this far
|
// Narrative: Congrats! You're done! If you've made it this far
|
||||||
// you're very close to being able to submit your PR. Here's
|
// you're very close to being able to submit your PR. Here's
|
||||||
// some tips:
|
// some tips:
|
||||||
|
|
Loading…
Reference in a new issue