CICD: clean slate at the start, not end, of each testgroup (#2738)

This commit is contained in:
Tom Limoncelli 2023-12-19 11:16:32 -05:00 committed by GitHub
parent 1bbf9c4293
commit d5eedab66e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -288,12 +288,8 @@ func runTests(t *testing.T, prv providers.DNSServiceProvider, domainName string,
lastGroup = len(testGroups)
}
// Start the zone with a clean slate.
makeChanges(t, prv, dc, tc("Empty"), "Clean Slate", false, nil)
curGroup := -1
for gIdx, group := range testGroups {
start := time.Now()
// Abide by -start -end flags
curGroup++
@ -308,7 +304,11 @@ func runTests(t *testing.T, prv providers.DNSServiceProvider, domainName string,
continue
}
// Start the testgroup with a clean slate.
makeChanges(t, prv, dc, tc("Empty"), "Clean Slate", false, nil)
// Run the tests.
start := time.Now()
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)
if *printElapsed {
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
// deleted.
// clear() is the same as tc("Empty"). It removes all records. You
// can use this to verify a provider can delete all the records in
// the last tc(), or to provide a clean slate for the next tc().
// Each testgroup() begins and ends with clear(), so you don't have
// to list the clear() yourself.
// clear() is the same as tc("Empty"). It removes all records.
// Each testgroup() begins with clear() automagically. You do not
// have to include the clear() in teach testgroup().
tests := []*TestGroup{
@ -2080,6 +2075,11 @@ func makeTests(t *testing.T) []*TestGroup {
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
// you're very close to being able to submit your PR. Here's
// some tips: