Skip to content

Commit

Permalink
Remove test debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
belimawr committed May 2, 2023
1 parent 37cfef3 commit 2ba009a
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions x-pack/libbeat/management/input_reload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import (
"github.com/elastic/beats/v7/libbeat/common/reload"
"github.com/elastic/elastic-agent-client/v7/pkg/client"
"github.com/elastic/elastic-agent-client/v7/pkg/proto"
"github.com/elastic/elastic-agent-libs/logp"
"github.com/joeshaw/multierror"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)

func TestInputReload(t *testing.T) {
logp.DevelopmentSetup(logp.WithLevel(logp.DebugLevel), logp.WithSelectors("*", "centralmgmt.V2-manager"))
// Uncomment this line to see the debug logs for this test
// logp.DevelopmentSetup(logp.WithLevel(logp.DebugLevel), logp.WithSelectors("*", "centralmgmt.V2-manager"))
r := reload.NewRegistry()

output := &reloadable{}
Expand All @@ -29,29 +29,23 @@ func TestInputReload(t *testing.T) {
ReloadImpl: func(configs []*reload.ConfigWithMeta) error {
reloadCallCount++
if reloadCallCount == 1 {
t.Log("Reload implementation retruning an error")
e1 := multierror.Errors{withCause{&common.ErrInputNotFinished{
State: "<state string goes here>",
File: "/tmp/foo.log",
}}}
return e1.Err()
}
t.Log("reload implementation retruning 'nil'")

return nil
},
}
r.MustRegisterInput(inputs)

configIdx := -1

onObserved := func(observed *proto.CheckinObserved, currentIdx int) {
configIdx = currentIdx
t.Log(currentIdx, "on observed called")
for _, unit := range observed.Units {
t.Log(unit.Id, unit.Payload.String(), unit.Message, unit.GetState().String(), unit.Type.String(), unit.ConfigStateIdx)
}
}

srv := mockSrv([][]*proto.UnitExpected{
{
{
Expand Down Expand Up @@ -163,7 +157,6 @@ func TestInputReload(t *testing.T) {
// That detects a state change, we only count/advance steps
// on state changes
if forceReload != forceReloadLastState {
t.Log("================ Force reload state change")
forceReloadLastState = forceReload
if forceReload == forceReloadState[forceReloadStateIdx] {
// Setp to the next state
Expand All @@ -178,7 +171,7 @@ func TestInputReload(t *testing.T) {
}
}
}
t.Log("forcereload False cont: ", forceReloadFalseCount, "config idx:", configIdx, "Force reload status:", mm.forceReload.Load(), "force reload state idx:", forceReloadStateIdx)

return configIdx == 1 && forceReloadFalseCount == 2
}, 15*time.Hour, 300*time.Millisecond)
}
Expand Down

0 comments on commit 2ba009a

Please sign in to comment.