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:
Drew Bailey
2019-10-10 15:30:37 -04:00
parent a828c92403
commit 12819975ee
15 changed files with 387 additions and 193 deletions

View File

@@ -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")
}
}