mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 18:05:42 +03:00
monitor command takes no args
rm extra new line fix lint errors return after close fix, simplify test
This commit is contained in:
@@ -22,20 +22,23 @@ func TestMonitor_Start(t *testing.T) {
|
||||
})
|
||||
|
||||
closeCh := make(chan struct{})
|
||||
defer close(closeCh)
|
||||
|
||||
logCh := m.Start(closeCh)
|
||||
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case log := <-logCh:
|
||||
require.Contains(t, string(log), "[DEBUG] test log")
|
||||
case <-time.After(1 * time.Second):
|
||||
t.Fatal("Expected to receive from log channel")
|
||||
}
|
||||
}
|
||||
logger.Debug("test log")
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}()
|
||||
logger.Debug("test log")
|
||||
|
||||
for {
|
||||
select {
|
||||
case log := <-logCh:
|
||||
require.Contains(t, string(log), "[DEBUG] test log")
|
||||
return
|
||||
case <-time.After(3 * time.Second):
|
||||
t.Fatal("Expected to receive from log channel")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure number of dropped messages are logged
|
||||
@@ -61,7 +64,6 @@ func TestMonitor_DroppedMessages(t *testing.T) {
|
||||
}
|
||||
|
||||
received := ""
|
||||
|
||||
passed := make(chan struct{})
|
||||
go func() {
|
||||
for {
|
||||
|
||||
Reference in New Issue
Block a user