mirror of
https://github.com/coredns/coredns.git
synced 2026-07-18 05:30:13 -04:00
plugin/secondary: stop update loop on reload shutdown (#8198)
This commit is contained in:
@@ -3,6 +3,7 @@ package file
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/coredns/coredns/plugin/pkg/dnstest"
|
||||
"github.com/coredns/coredns/plugin/test"
|
||||
@@ -121,6 +122,27 @@ func TestTransferIn(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpdateStopsBeforeInitialTransfer(t *testing.T) {
|
||||
z := NewZone(testZone, "test")
|
||||
updateShutdown := make(chan bool)
|
||||
done := make(chan struct{})
|
||||
|
||||
go func() {
|
||||
if err := z.Update(updateShutdown, nil); err != nil {
|
||||
t.Errorf("Unexpected update error: %v", err)
|
||||
}
|
||||
close(done)
|
||||
}()
|
||||
|
||||
close(updateShutdown)
|
||||
|
||||
select {
|
||||
case <-done:
|
||||
case <-time.After(200 * time.Millisecond):
|
||||
t.Fatal("Update did not stop while waiting for initial SOA")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsNotify(t *testing.T) {
|
||||
z := new(Zone)
|
||||
z.origin = testZone
|
||||
|
||||
Reference in New Issue
Block a user