Skip to content

Commit

Permalink
Implement review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
belimawr committed Jan 2, 2025
1 parent e1b6c4d commit e5d6bdf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions filebeat/input/filestream/internal/input-logfile/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (cim *InputManager) Create(config *conf.C) (v2.Input, error) {
duplicatedInput := map[string]any{}
unpackErr := config.Unpack(&duplicatedInput)
if unpackErr != nil {
duplicatedInput["error"] = fmt.Errorf("failed to umpack dupliucated input config: %w", unpackErr).Error()
duplicatedInput["error"] = fmt.Errorf("failed to unpack duplicated input config: %w", unpackErr).Error()
}

// Keep old behaviour so users can upgrade to 9.0 without
Expand All @@ -191,7 +191,7 @@ func (cim *InputManager) Create(config *conf.C) (v2.Input, error) {
} else {
cim.Logger.Errorw(
fmt.Sprintf(
"filestream input '%s' is duplicated: input will NOT start",
"filestream input ID '%s' is duplicated: input will NOT start",
settings.ID,
),
"input.cfg", conf.DebugString(config, true))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ paths:
logs := buff.String()
// Assert the logs contain the correct log message
assert.Contains(t, logs,
fmt.Sprintf("filestream input '%s' is duplicated:", tc.id))
fmt.Sprintf("filestream input ID '%s' is duplicated:", tc.id))

// Assert the error contains the correct text
assert.Contains(t, err.Error(),
Expand Down
5 changes: 1 addition & 4 deletions libbeat/autodiscover/autodiscover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ func check(t *testing.T, runners []*mockRunner, expected *conf.C, started, stopp
t.Fatalf("expected cfg %v to be started=%v stopped=%v but have %v", out, started, stopped, runners)
}

func TestTiago(t *testing.T) {
func TestErrNonReloadableIsNotRetried(t *testing.T) {
// Register mock autodiscover provider
busChan := make(chan bus.Bus, 1)
Registry = NewRegistry()
Expand Down Expand Up @@ -847,9 +847,6 @@ func TestTiago(t *testing.T) {
conf.MustNewConfigFrom(map[string]any{
"err_non_reloadable": true,
}),
// conf.MustNewConfigFrom(map[string]any{
// "lets-break-it": true,
// }),
},
}

Expand Down
2 changes: 1 addition & 1 deletion x-pack/libbeat/management/managerV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ func (cm *BeatV2Manager) reload(units map[unitKey]*agentUnit) {
// in v2 only a single input type will be started per component, so we don't need to
// worry about getting multiple re-loaders (we just need the one for the type)
if err := cm.reloadInputs(inputUnits); err != nil { // HERE
// cm.reloadInputs will use fmt.Errorf and join an erros slice
// cm.reloadInputs will use fmt.Errorf and join an error slice
// using errors.Join, so we need to unwrap the fmt wrapped error,
// then we can iterate over the errors list.
err = errors.Unwrap(err)
Expand Down

0 comments on commit e5d6bdf

Please sign in to comment.