Skip to content

Commit 3795567

Browse files
committed
update integration tests
1 parent 9bf6f18 commit 3795567

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

testing/integration/ess/container_cmd_test.go

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ func createPolicy(
4242
agentFixture *atesting.Fixture,
4343
info *define.Info,
4444
policyName string,
45-
dataOutputID string) (string, string) {
46-
45+
dataOutputID string,
46+
) (string, string) {
4747
createPolicyReq := kibana.AgentPolicy{
4848
Name: policyName,
4949
Namespace: info.Namespace,
@@ -89,8 +89,8 @@ func prepareAgentCMD(
8989
ctx context.Context,
9090
agentFixture *atesting.Fixture,
9191
args []string,
92-
env []string) (*exec.Cmd, *strings.Builder) {
93-
92+
env []string,
93+
) (*exec.Cmd, *strings.Builder) {
9494
cmd, err := agentFixture.PrepareAgentCommand(ctx, args)
9595
if err != nil {
9696
t.Fatalf("could not prepare agent command: %s", err)
@@ -533,13 +533,6 @@ func TestContainerCMDAgentMonitoringRuntimeExperimental(t *testing.T) {
533533
status, err := agentFixture.ExecStatus(ctx, atesting.WithCmdOptions(withEnv(env)))
534534
require.NoErrorf(ct, err, "error getting agent status")
535535

536-
expectedComponentCount := 4 // process runtime
537-
if tc.expectedRuntimeName == string(monitoringCfg.OtelRuntimeManager) {
538-
expectedComponentCount = 5
539-
}
540-
541-
require.Len(ct, status.Components, expectedComponentCount, "expected right number of components in agent status")
542-
543536
for _, comp := range status.Components {
544537
var compRuntime string
545538
switch comp.VersionInfo.Name {
@@ -550,15 +543,15 @@ func TestContainerCMDAgentMonitoringRuntimeExperimental(t *testing.T) {
550543
}
551544
t.Logf("Component ID: %s, version info: %s, runtime: %s", comp.ID, comp.VersionInfo.Name, compRuntime)
552545
switch comp.ID {
553-
case "beat/metrics-monitoring", "filestream-monitoring", "prometheus/metrics-monitoring":
546+
case "beat/metrics-monitoring", "filestream-monitoring":
554547
// Monitoring components should use the expected runtime
555548
assert.Equalf(ct, tc.expectedRuntimeName, compRuntime, "expected correct runtime name for monitoring component %s with id %s", comp.Name, comp.ID)
556549
case "http/metrics-monitoring":
557550
// The comp.VersionInfo.Name for this component is empty at times.
558551
// See https://github.com/elastic/elastic-agent/issues/11162.
559552
default:
560-
// Non-monitoring components should use the default runtime
561-
assert.Equalf(ct, string(component.DefaultRuntimeManager), compRuntime, "expected default runtime for non-monitoring component %s with id %s", comp.Name, comp.ID)
553+
// Non-monitoring components are not controlled by the env variable
554+
continue
562555
}
563556
}
564557
}, 1*time.Minute, 1*time.Second,
@@ -775,7 +768,7 @@ inputs:
775768

776769
config := fmt.Sprintf(configTemplate, esAddr)
777770
configPath := filepath.Join(workDir, "elastic-agent.yml")
778-
err := os.WriteFile(configPath, []byte(config), 0644)
771+
err := os.WriteFile(configPath, []byte(config), 0o644)
779772
if err != nil {
780773
t.Fatalf("failed to write agent config file: %s", err)
781774
}

0 commit comments

Comments
 (0)