mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
remove log_writer
prefix output with proper spacing update gzip handler, adjust first byte flow to allow gzip handler bypass wip, first stab at wiring up rpc endpoint
This commit is contained in:
@@ -3,10 +3,11 @@ package api
|
||||
import (
|
||||
"reflect"
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/hashicorp/nomad/api/internal/testutil"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -267,19 +268,27 @@ func TestAgent_Monitor(t *testing.T) {
|
||||
|
||||
agent := c.Agent()
|
||||
|
||||
logCh, err := agent.Monitor("info", nil, nil)
|
||||
doneCh := make(chan struct{})
|
||||
logCh, err := agent.Monitor("debug", doneCh, nil)
|
||||
defer close(doneCh)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
// make a request to generate some logs
|
||||
_, err = agent.Region()
|
||||
require.NoError(t, err)
|
||||
|
||||
// Wait for the first log message and validate it
|
||||
select {
|
||||
case log := <-logCh:
|
||||
// TODO: checkout why stub_asset.go help text returns here
|
||||
if !strings.Contains(log, "[INFO ] nomad: raft: Initial configuration") {
|
||||
t.Fatalf("bad: %q", log)
|
||||
for {
|
||||
select {
|
||||
case log := <-logCh:
|
||||
if log == " " {
|
||||
return
|
||||
}
|
||||
require.Contains(t, log, "[DEBUG]")
|
||||
case <-time.After(10 * time.Second):
|
||||
require.Fail(t, "failed to get a log message")
|
||||
}
|
||||
case <-time.After(1000 * time.Second):
|
||||
t.Fatalf("failed to get a log message")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user