StackExchange / dnscontrol

Infrastructure as code for DNS!
https://dnscontrol.org/
MIT License
3.16k stars 400 forks source link

TESTING: Clean-up records after TestDualProviders #3171

Closed fabienmazieres closed 3 weeks ago

fabienmazieres commented 4 weeks ago

Clean-up NS records after TestDualProviders, it used to leave ns1.example.com and ns2.example.com behind

fabienmazieres commented 4 weeks ago

@tlimoncelli , This bugged me a little bit, the testing suite removed all records except those 2 NS added during TestDualProviders This little change should leave a perfectly empty zone :)

fabienmazieres commented 4 weeks ago

with a shortened test suite:

# go test -v -provider "ORACLE" -start 0 -end 0
=== RUN   TestDNSProviders
=== RUN   TestDNSProviders/example.co.uk
=== RUN   TestDNSProviders/example.co.uk/Clean_Slate:Empty
=== RUN   TestDNSProviders/example.co.uk/00:A:Create_A
=== RUN   TestDNSProviders/example.co.uk/00:A:Change_A_target
--- PASS: TestDNSProviders (4.44s)
    --- PASS: TestDNSProviders/example.co.uk (2.12s)
        --- PASS: TestDNSProviders/example.co.uk/Clean_Slate:Empty (0.25s)
        --- PASS: TestDNSProviders/example.co.uk/00:A:Create_A (0.71s)
        --- PASS: TestDNSProviders/example.co.uk/00:A:Change_A_target (0.66s)
=== RUN   TestDualProviders
    integration_test.go:370: Clearing everything
    integration_test.go:364: #1:
        - DELETE A testa.example.co.uk 3.3.3.3 ttl=300
    integration_test.go:377: Adding test nameservers
    integration_test.go:364: #1:
        + CREATE NS example.co.uk ns1.example.com. ttl=86400
        + CREATE NS example.co.uk ns2.example.com. ttl=86400
    integration_test.go:380: Running again to ensure stability
    integration_test.go:396: Removing dummy nameservers
    integration_test.go:364: #1:
        - DELETE NS example.co.uk ns1.example.com. ttl=86400
        - DELETE NS example.co.uk ns2.example.com. ttl=86400
--- PASS: TestDualProviders (1.87s)
=== RUN   TestNameserverDots
=== RUN   TestNameserverDots/No_trailing_dot_in_nameserver
--- PASS: TestNameserverDots (0.24s)
    --- PASS: TestNameserverDots/No_trailing_dot_in_nameserver (0.00s)
PASS
ok      github.com/StackExchange/dnscontrol/v4/integrationTest  10.787s
tlimoncelli commented 3 weeks ago

Thanks!