mirror of
https://github.com/traefik/traefik.git
synced 2026-06-17 19:09:29 +03:00
Use modern WaitGroup.Go function in additional places
This commit is contained in:
@@ -515,7 +515,6 @@ func TestDifferentIntervals(t *testing.T) {
|
||||
wg := sync.WaitGroup{}
|
||||
wg.Go(func() {
|
||||
hc.Launch(ctx)
|
||||
wg.Done()
|
||||
})
|
||||
|
||||
select {
|
||||
|
||||
@@ -192,11 +192,9 @@ func TestBasicAuthConcurrentHashOnce(t *testing.T) {
|
||||
defer ts.Close()
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(2)
|
||||
|
||||
for range 2 {
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
wg.Go(func() {
|
||||
req := testhelpers.MustNewRequest(http.MethodGet, ts.URL, nil)
|
||||
req.SetBasicAuth("test", "test")
|
||||
|
||||
@@ -205,7 +203,7 @@ func TestBasicAuthConcurrentHashOnce(t *testing.T) {
|
||||
defer res.Body.Close()
|
||||
|
||||
assert.Equal(t, http.StatusOK, res.StatusCode, "they should be equal")
|
||||
}()
|
||||
})
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
|
||||
@@ -51,8 +51,6 @@ func (eps UDPEntryPoints) Stop() {
|
||||
|
||||
for epn, ep := range eps {
|
||||
wg.Go(func() {
|
||||
defer wg.Done()
|
||||
|
||||
logger := log.With().Str(logs.EntryPointName, epn).Logger()
|
||||
ep.Shutdown(logger.WithContext(context.Background()))
|
||||
|
||||
|
||||
@@ -560,13 +560,11 @@ func TestConcurrentResponseTimeUpdates(t *testing.T) {
|
||||
updatesPerGoroutine := 20
|
||||
|
||||
for i := range numGoroutines {
|
||||
wg.Add(1)
|
||||
go func(id int) {
|
||||
defer wg.Done()
|
||||
wg.Go(func() {
|
||||
for range updatesPerGoroutine {
|
||||
handler.updateResponseTime(time.Duration(id+1) * time.Millisecond)
|
||||
handler.updateResponseTime(time.Duration(i+1) * time.Millisecond)
|
||||
}
|
||||
}(i)
|
||||
})
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
|
||||
Reference in New Issue
Block a user