mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 11:38:15 +00:00
Merge pull request #117109 from pohly/test-integration-race-detection-framework-grpclog
test/integration/framework: avoid race around grpclog.SetLoggerV2
This commit is contained in:
commit
730d811036
@ -25,6 +25,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
"testing"
|
||||
"time"
|
||||
@ -83,6 +84,8 @@ func startEtcd(output io.Writer) (func(), error) {
|
||||
return stop, nil
|
||||
}
|
||||
|
||||
var initGRPCOnce sync.Once
|
||||
|
||||
// RunCustomEtcd starts a custom etcd instance for test purposes.
|
||||
func RunCustomEtcd(dataDir string, customFlags []string, output io.Writer) (url string, stopFn func(), err error) {
|
||||
// TODO: Check for valid etcd version.
|
||||
@ -150,7 +153,9 @@ func RunCustomEtcd(dataDir string, customFlags []string, output io.Writer) (url
|
||||
|
||||
// Quiet etcd logs for integration tests
|
||||
// Comment out to get verbose logs if desired
|
||||
grpclog.SetLoggerV2(grpclog.NewLoggerV2(io.Discard, io.Discard, os.Stderr))
|
||||
initGRPCOnce.Do(func() {
|
||||
grpclog.SetLoggerV2(grpclog.NewLoggerV2(io.Discard, io.Discard, os.Stderr))
|
||||
})
|
||||
|
||||
if err := cmd.Start(); err != nil {
|
||||
return "", nil, fmt.Errorf("failed to run etcd: %v", err)
|
||||
|
Loading…
Reference in New Issue
Block a user