Merge pull request #12381 from hashicorp/ci-gha-off
ci: set test log level off in gha
This commit is contained in:
commit
e3c8a86e2e
2
.github/workflows/test-core.yaml
vendored
2
.github/workflows/test-core.yaml
vendored
|
@ -27,7 +27,7 @@ env:
|
|||
CONSUL_VERSION: 1.11.3
|
||||
VAULT_VERSION: 1.9.3
|
||||
NOMAD_SLOW_TEST: 0
|
||||
NOMAD_TEST_LOG_LEVEL: ERROR
|
||||
NOMAD_TEST_LOG_LEVEL: OFF
|
||||
jobs:
|
||||
checks:
|
||||
runs-on: ubuntu-20.04
|
||||
|
|
|
@ -300,6 +300,7 @@ test-nomad: dev ## Run Nomad test suites
|
|||
$(if $(ENABLE_RACE),-race) $(if $(VERBOSE),-v) \
|
||||
-cover \
|
||||
-timeout=20m \
|
||||
-count=1 \
|
||||
-tags "$(GO_TAGS)" \
|
||||
$(GOTEST_PKGS)
|
||||
|
||||
|
@ -310,6 +311,7 @@ test-nomad-module: dev ## Run Nomad test suites on a sub-module
|
|||
$(if $(ENABLE_RACE),-race) $(if $(VERBOSE),-v) \
|
||||
-cover \
|
||||
-timeout=20m \
|
||||
-count=1 \
|
||||
-tags "$(GO_TAGS)" \
|
||||
./...
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
|
||||
"github.com/hashicorp/go-hclog"
|
||||
"github.com/hashicorp/nomad/ci"
|
||||
"github.com/hashicorp/nomad/helper/testlog"
|
||||
)
|
||||
|
||||
func TestAgent_LoadKeyrings(t *testing.T) {
|
||||
|
@ -29,9 +30,10 @@ func TestAgent_LoadKeyrings(t *testing.T) {
|
|||
|
||||
// Server should auto-load WAN keyring files
|
||||
agent2 := &TestAgent{
|
||||
T: t,
|
||||
Name: t.Name() + "2",
|
||||
Key: key,
|
||||
T: t,
|
||||
Name: t.Name() + "2",
|
||||
Key: key,
|
||||
logger: testlog.HCLogger(t),
|
||||
}
|
||||
agent2.Start()
|
||||
defer agent2.Shutdown()
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
// levels that we use.
|
||||
func LevelFilter() *logutils.LevelFilter {
|
||||
return &logutils.LevelFilter{
|
||||
Levels: []logutils.LogLevel{"TRACE", "DEBUG", "INFO", "WARN", "ERROR"},
|
||||
Levels: []logutils.LogLevel{"TRACE", "DEBUG", "INFO", "WARN", "ERROR", "OFF"},
|
||||
MinLevel: "INFO",
|
||||
Writer: ioutil.Discard,
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package agent
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
|
@ -55,9 +54,8 @@ type TestAgent struct {
|
|||
// when Shutdown() is called.
|
||||
Config *Config
|
||||
|
||||
// LogOutput is the sink for the logs. If nil, logs are written
|
||||
// to os.Stderr.
|
||||
LogOutput io.Writer
|
||||
// logger is used for logging
|
||||
logger hclog.InterceptLogger
|
||||
|
||||
// DataDir is the data directory which is used when Config.DataDir
|
||||
// is not set. It is created automatically and removed when
|
||||
|
@ -102,6 +100,7 @@ func NewTestAgent(t testing.TB, name string, configCallback func(*Config)) *Test
|
|||
Name: name,
|
||||
ConfigCallback: configCallback,
|
||||
Enterprise: EnterpriseTestAgent,
|
||||
logger: testlog.HCLogger(t),
|
||||
}
|
||||
|
||||
a.Start()
|
||||
|
@ -235,11 +234,6 @@ RETRY:
|
|||
}
|
||||
|
||||
func (a *TestAgent) start() (*Agent, error) {
|
||||
if a.LogOutput == nil {
|
||||
prefix := fmt.Sprintf("%v:%v ", a.Config.BindAddr, a.Config.Ports.RPC)
|
||||
a.LogOutput = testlog.NewPrefixWriter(a.T, prefix)
|
||||
}
|
||||
|
||||
inm := metrics.NewInmemSink(10*time.Second, time.Minute)
|
||||
metrics.NewGlobal(metrics.DefaultConfig("service-name"), inm)
|
||||
|
||||
|
@ -247,14 +241,7 @@ func (a *TestAgent) start() (*Agent, error) {
|
|||
return nil, fmt.Errorf("unable to set up in memory metrics needed for agent initialization")
|
||||
}
|
||||
|
||||
logger := hclog.NewInterceptLogger(&hclog.LoggerOptions{
|
||||
Name: "agent",
|
||||
Level: hclog.LevelFromString(a.Config.LogLevel),
|
||||
Output: a.LogOutput,
|
||||
JSONFormat: a.Config.LogJson,
|
||||
})
|
||||
|
||||
agent, err := NewAgent(a.Config, logger, a.LogOutput, inm)
|
||||
agent, err := NewAgent(a.Config, a.logger, testlog.NewWriter(a.T), inm)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -349,8 +336,7 @@ func (a *TestAgent) pickRandomPorts(c *Config) {
|
|||
}
|
||||
}
|
||||
|
||||
// TestConfig returns a unique default configuration for testing an
|
||||
// agent.
|
||||
// TestConfig returns a unique default configuration for testing an agent.
|
||||
func (a *TestAgent) config() *Config {
|
||||
conf := DevConfig(nil)
|
||||
|
||||
|
@ -361,10 +347,9 @@ func (a *TestAgent) config() *Config {
|
|||
// Setup client config
|
||||
conf.ClientConfig = client.DefaultConfig()
|
||||
|
||||
logger := testlog.HCLogger(a.T)
|
||||
conf.LogLevel = testlog.HCLoggerTestLevel().String()
|
||||
conf.NomadConfig.Logger = logger
|
||||
conf.ClientConfig.Logger = logger
|
||||
conf.NomadConfig.Logger = a.logger
|
||||
conf.ClientConfig.Logger = a.logger
|
||||
|
||||
// Set the name
|
||||
conf.NodeName = a.Name
|
||||
|
|
Loading…
Reference in a new issue