mirror of
https://github.com/kataras/iris.git
synced 2025-02-02 15:30:36 +01:00
minor
This commit is contained in:
parent
4845b77177
commit
65b7983d7a
|
@ -18,6 +18,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccessLogPrint_Simple(t *testing.T) {
|
func TestAccessLogPrint_Simple(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
const goroutinesN = 420
|
const goroutinesN = 420
|
||||||
|
|
||||||
w := new(bytes.Buffer)
|
w := new(bytes.Buffer)
|
||||||
|
@ -26,12 +27,17 @@ func TestAccessLogPrint_Simple(t *testing.T) {
|
||||||
ac.ResponseBody = true
|
ac.ResponseBody = true
|
||||||
ac.Clock = TClock(time.Time{})
|
ac.Clock = TClock(time.Time{})
|
||||||
|
|
||||||
var expected string
|
var (
|
||||||
var expectedLines int
|
expected string
|
||||||
var mu sync.Mutex
|
expectedLines int
|
||||||
for i := 0; i < goroutinesN; i++ {
|
mu sync.Mutex
|
||||||
|
wg sync.WaitGroup
|
||||||
|
)
|
||||||
|
wg.Add(goroutinesN)
|
||||||
|
|
||||||
|
for i := 0; i < goroutinesN; i++ {
|
||||||
go func() {
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
ac.Print(
|
ac.Print(
|
||||||
nil,
|
nil,
|
||||||
1*time.Second,
|
1*time.Second,
|
||||||
|
@ -61,9 +67,8 @@ func TestAccessLogPrint_Simple(t *testing.T) {
|
||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// time.Sleep(1 * time.Second)
|
wg.Wait()
|
||||||
// just to fire at least some routines (CI: travis).
|
ac.Close() // TODO: Close waits for current messages but does allow future writes, I should change that.
|
||||||
ac.Close()
|
|
||||||
|
|
||||||
if got := atomic.LoadUint32(&ac.remaining); got > 0 { // test wait.
|
if got := atomic.LoadUint32(&ac.remaining); got > 0 { // test wait.
|
||||||
t.Fatalf("expected remaining: %d but got: %d", 0, got)
|
t.Fatalf("expected remaining: %d but got: %d", 0, got)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user