Skip to content

Commit acd7a2a

Browse files
committed
Fix net/input/manager manager/wrapper
1 parent 3f8e13a commit acd7a2a

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

filebeat/input/net/manager.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ func (w wrapper) Run(ctx v2.Context, pipeline beat.PipelineConnector) (err error
165165
m := w.inp.InitMetrics(ctx.ID, ctx.MetricsRegistry, ctx.Logger)
166166
if err := w.initWorkers(ctx, pipeline, m); err != nil {
167167
logger.Errorf("cannot initialise pipeline workers: %s", err)
168+
ctx.UpdateStatus(
169+
status.Failed,
170+
fmt.Sprintf("cannot initialise workers: %s", err),
171+
)
168172
return fmt.Errorf("cannot initialise pipeline workers: %w", err)
169173
}
170174

x-pack/filebeat/tests/integration/managerV2_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,40 @@ func TestFoo(t *testing.T) {
11561156
testCases := map[string]*proto.UnitExpected{
11571157
"cel": brokenCEL,
11581158
"filestream": brokenFilestream,
1159+
"net inputs": {
1160+
Id: "broken-tcp",
1161+
Type: proto.UnitType_INPUT,
1162+
ConfigStateIdx: 1,
1163+
State: proto.State_HEALTHY,
1164+
LogLevel: proto.UnitLogLevel_DEBUG,
1165+
Config: &proto.UnitExpectedConfig{
1166+
Id: "tcp-input",
1167+
Type: "tcp",
1168+
Name: "tcp",
1169+
Streams: []*proto.Stream{
1170+
{
1171+
Id: "tcp-input",
1172+
Source: integration.RequireNewStruct(t, map[string]any{
1173+
"enabled": true,
1174+
"type": "tcp",
1175+
"host": "localhost:9042", // random port
1176+
"processors": []any{
1177+
map[string]any{
1178+
"add_fields": map[string]any{
1179+
"fields_under_root": true, // invalid
1180+
"fields": map[string]any{
1181+
"labels": map[string]any{
1182+
"foo": "bar",
1183+
},
1184+
},
1185+
},
1186+
},
1187+
},
1188+
}),
1189+
},
1190+
},
1191+
},
1192+
},
11591193
}
11601194

11611195
for name, inputUnit := range testCases {

0 commit comments

Comments
 (0)