Skip to content

Commit bd7f215

Browse files
[9.2] (backport #11539) Ensure we don't report output status in tests where it's irrelevant (#11567)
* Ensure we don't report output status in tests where it's irrelevant (#11539) * Ensure we don't report output status in tests where it's irrelevant * Extract common parameters in TestBeatDiagnostics (cherry picked from commit b8a142f) # Conflicts: # testing/integration/ess/beat_receivers_test.go * Fix conflicts --------- Co-authored-by: Mikołaj Świątek <[email protected]>
1 parent dea275a commit bd7f215

File tree

2 files changed

+28
-19
lines changed

2 files changed

+28
-19
lines changed

testing/integration/ess/beat_receivers_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,8 @@ outputs:
713713
type: elasticsearch
714714
hosts: [http://localhost:9200]
715715
api_key: placeholder
716+
status_reporting:
717+
enabled: false
716718
agent.monitoring.enabled: false
717719
`
718720

@@ -847,6 +849,8 @@ outputs:
847849
hosts: [http://localhost:9200]
848850
api_key: placeholder
849851
indices: [] # not supported by the elasticsearch exporter
852+
status_reporting:
853+
enabled: false
850854
`
851855

852856
// this is the context for the whole test, with a global timeout defined
@@ -943,6 +947,8 @@ outputs:
943947
type: elasticsearch
944948
hosts: [http://localhost:9200]
945949
api_key: placeholder
950+
status_reporting:
951+
enabled: false
946952
agent.monitoring.enabled: false
947953
`
948954

@@ -1030,6 +1036,8 @@ outputs:
10301036
type: elasticsearch
10311037
hosts: [http://localhost:9200]
10321038
api_key: placeholder
1039+
status_reporting:
1040+
enabled: false
10331041
agent.monitoring.enabled: false
10341042
`
10351043
err = fixture.Configure(ctx, []byte(configNoComponents))

testing/integration/ess/diagnostics_test.go

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,8 @@ outputs:
348348
type: elasticsearch
349349
hosts: [http://localhost:9200]
350350
api_key: placeholder
351+
status_reporting:
352+
enabled: false
351353
agent.monitoring.enabled: false
352354
`
353355

@@ -359,13 +361,25 @@ agent.monitoring.enabled: false
359361

360362
ctx, cancel := testcontext.WithDeadline(t, context.Background(), time.Now().Add(10*time.Minute))
361363
defer cancel()
364+
expectedComponentState := map[string]integrationtest.ComponentState{
365+
"filestream-default": {
366+
State: integrationtest.NewClientState(client.Healthy),
367+
Units: map[integrationtest.ComponentUnitKey]integrationtest.ComponentUnitState{
368+
integrationtest.ComponentUnitKey{UnitType: client.UnitTypeOutput, UnitID: "filestream-default"}: {
369+
State: integrationtest.NewClientState(client.Healthy),
370+
},
371+
integrationtest.ComponentUnitKey{UnitType: client.UnitTypeInput, UnitID: "filestream-default-filestream-filebeat"}: {
372+
State: integrationtest.NewClientState(client.Healthy),
373+
},
374+
},
375+
},
376+
}
377+
expectedAgentState := integrationtest.NewClientState(client.Healthy)
362378

363379
testCases := []struct {
364380
name string
365381
runtime string
366382
expectedCompDiagnosticsFiles []string
367-
expectedAgentState *client.State
368-
expectedComponentState map[string]integrationtest.ComponentState
369383
}{
370384
{
371385
name: "filebeat process",
@@ -377,20 +391,6 @@ agent.monitoring.enabled: false
377391
"beat-rendered-config.yml",
378392
"global_processors.txt",
379393
),
380-
expectedAgentState: integrationtest.NewClientState(client.Healthy),
381-
expectedComponentState: map[string]integrationtest.ComponentState{
382-
"filestream-default": {
383-
State: integrationtest.NewClientState(client.Healthy),
384-
Units: map[integrationtest.ComponentUnitKey]integrationtest.ComponentUnitState{
385-
integrationtest.ComponentUnitKey{UnitType: client.UnitTypeOutput, UnitID: "filestream-default"}: {
386-
State: integrationtest.NewClientState(client.Healthy),
387-
},
388-
integrationtest.ComponentUnitKey{UnitType: client.UnitTypeInput, UnitID: "filestream-default-filestream-filebeat"}: {
389-
State: integrationtest.NewClientState(client.Healthy),
390-
},
391-
},
392-
},
393-
},
394394
},
395395
{
396396
name: "filebeat receiver",
@@ -400,7 +400,6 @@ agent.monitoring.enabled: false
400400
"beat_metrics.json",
401401
"input_metrics.json",
402402
},
403-
expectedAgentState: integrationtest.NewClientState(client.Degraded),
404403
},
405404
}
406405

@@ -443,8 +442,8 @@ agent.monitoring.enabled: false
443442
}
444443
err = f.Run(ctx, integrationtest.State{
445444
Configure: configBuffer.String(),
446-
AgentState: tc.expectedAgentState,
447-
Components: tc.expectedComponentState,
445+
AgentState: expectedAgentState,
446+
Components: expectedComponentState,
448447
After: testDiagnosticsFactory(t, filebeatSetup, expDiagFiles, tc.expectedCompDiagnosticsFiles, f, []string{"diagnostics", "collect"}),
449448
})
450449
assert.NoError(t, err)
@@ -475,6 +474,8 @@ outputs:
475474
type: elasticsearch
476475
hosts: [http://localhost:9200]
477476
api_key: placeholder
477+
status_reporting:
478+
enabled: false
478479
agent.monitoring.enabled: false
479480
`
480481

0 commit comments

Comments
 (0)