fix: test teardown dns data race

Signed-off-by: Terry Howe <terrylhowe@gmail.com>
pull/31042/head
Terry Howe 2 months ago
parent 4b8e61093d
commit 82bc9adcc2
No known key found for this signature in database

@ -29,6 +29,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
"sync"
"time" "time"
"github.com/distribution/distribution/v3/configuration" "github.com/distribution/distribution/v3/configuration"
@ -172,6 +173,9 @@ func setup(suite *TestSuite, tlsEnabled, insecure bool) *registry.Registry {
} }
func teardown(suite *TestSuite) { func teardown(suite *TestSuite) {
var lock sync.Mutex
lock.Lock()
defer lock.Unlock()
if suite.srv != nil { if suite.srv != nil {
mockdns.UnpatchNet(net.DefaultResolver) mockdns.UnpatchNet(net.DefaultResolver)
suite.srv.Close() suite.srv.Close()

Loading…
Cancel
Save