mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-08-18 00:18:47 +00:00
Make all non-informative things informative
This commit is contained in:
parent
7f4d1fbec2
commit
40fb0ea260
@ -21,13 +21,13 @@ import (
|
|||||||
// waitTimeout waits for the waitgroup for the specified max timeout.
|
// waitTimeout waits for the waitgroup for the specified max timeout.
|
||||||
// Returns true if waiting timed out.
|
// Returns true if waiting timed out.
|
||||||
func waitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool {
|
func waitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool {
|
||||||
c := make(chan struct{})
|
channel := make(chan struct{})
|
||||||
go func() {
|
go func() {
|
||||||
defer close(c)
|
defer close(channel)
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
}()
|
}()
|
||||||
select {
|
select {
|
||||||
case <-c:
|
case <-channel:
|
||||||
return false // completed normally
|
return false // completed normally
|
||||||
case <-time.After(timeout):
|
case <-time.After(timeout):
|
||||||
return true // timed out
|
return true // timed out
|
||||||
@ -40,14 +40,14 @@ func checkDBHasEntries(t *testing.T, timestamp int64, limit int) (entries []map[
|
|||||||
query := fmt.Sprintf("timestamp < %d and limit(%d)", timestamp, limit)
|
query := fmt.Sprintf("timestamp < %d and limit(%d)", timestamp, limit)
|
||||||
webSocketUrl := getWebSocketUrl(defaultApiServerPort)
|
webSocketUrl := getWebSocketUrl(defaultApiServerPort)
|
||||||
|
|
||||||
c, _, err := websocket.DefaultDialer.Dial(webSocketUrl, nil)
|
connection, _, err := websocket.DefaultDialer.Dial(webSocketUrl, nil)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
defer c.Close()
|
defer connection.Close()
|
||||||
|
|
||||||
handleWSConnection := func(wg *sync.WaitGroup) {
|
handleWSConnection := func(wg *sync.WaitGroup) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
for {
|
for {
|
||||||
_, message, err := c.ReadMessage()
|
_, message, err := connection.ReadMessage()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ func checkDBHasEntries(t *testing.T, timestamp int64, limit int) (entries []map[
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = c.WriteMessage(websocket.TextMessage, []byte(query))
|
err = connection.WriteMessage(websocket.TextMessage, []byte(query))
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
Loading…
Reference in New Issue
Block a user