Skip to content

Commit

Permalink
test(*): TestRollover failed randomly on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
lsytj0413 authored and sebsoto committed Apr 10, 2020
1 parent 4cae117 commit edbc1d3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions klog_test.go
Expand Up @@ -28,6 +28,7 @@ import (
"runtime"
"strconv"
"strings"
"sync"
"testing"
"time"
)
Expand Down Expand Up @@ -317,13 +318,16 @@ func TestVmoduleOff(t *testing.T) {
func TestSetOutputDataRace(t *testing.T) {
setFlags()
defer logging.swap(logging.newBuffers())
var wg sync.WaitGroup
for i := 1; i <= 50; i++ {
go func() {
logging.flushDaemon()
}()
}
for i := 1; i <= 50; i++ {
wg.Add(1)
go func() {
defer wg.Done()
SetOutput(ioutil.Discard)
}()
}
Expand All @@ -333,7 +337,9 @@ func TestSetOutputDataRace(t *testing.T) {
}()
}
for i := 1; i <= 50; i++ {
wg.Add(1)
go func() {
defer wg.Done()
SetOutputBySeverity("INFO", ioutil.Discard)
}()
}
Expand All @@ -342,6 +348,7 @@ func TestSetOutputDataRace(t *testing.T) {
logging.flushDaemon()
}()
}
wg.Wait()
}

// vGlobs are patterns that match/don't match this file at V=2.
Expand Down

0 comments on commit edbc1d3

Please sign in to comment.