Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@
configChan <- cfgChange
coord.runLoopIteration(ctx)
assert.True(t, cfgChange.acked, "empty policy should be acknowledged")
assert.NoError(t, cfgChange.err, "config processing shouldn't report an error")
assert.True(t, updated, "empty policy should cause runtime manager update")
assert.Empty(t, components, "empty policy should produce empty component model")
assert.True(t, otelUpdated, "empty policy should cause otel manager update")
Expand Down Expand Up @@ -1052,11 +1053,20 @@
- nop
`)

<<<<<<< HEAD

Check failure on line 1056 in internal/pkg/agent/application/coordinator/coordinator_unit_test.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

expected statement, found '<<' (typecheck)

Check failure on line 1056 in internal/pkg/agent/application/coordinator/coordinator_unit_test.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

syntax error: unexpected <<, expected }
// Send the policy change and make sure it was acknowledged.
cfgChange := &configChange{cfg: cfg}
configChan <- cfgChange
coord.runLoopIteration(ctx)
assert.True(t, cfgChange.acked, "Coordinator should ACK a successful policy change")
=======
// Send the policy change and make sure it was acknowledged.
cfgChange := &configChange{cfg: cfg}
configChan <- cfgChange
coord.runLoopIteration(ctx)
assert.True(t, cfgChange.acked, "Coordinator should ACK a successful policy change")
assert.NoError(t, cfgChange.err, "config processing shouldn't report an error")
>>>>>>> 0ba2ea683 (Check for config processing errors in coordinator unit tests (#10203))

Check failure on line 1069 in internal/pkg/agent/application/coordinator/coordinator_unit_test.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

binary literal has no digits (typecheck)

Check failure on line 1069 in internal/pkg/agent/application/coordinator/coordinator_unit_test.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

invalid character U+0023 '#'

Check failure on line 1069 in internal/pkg/agent/application/coordinator/coordinator_unit_test.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

binary literal has no digits

// Make sure the runtime manager received the expected component update.
// An assert.Equal on the full component model doesn't play nice with
Expand All @@ -1073,12 +1083,75 @@
assert.Equal(t, "input not supported", runtimeComponent.Err.Error(), "Input with no spec should report 'input not supported'")
require.Equal(t, 2, len(runtimeComponent.Units))

<<<<<<< HEAD
units := runtimeComponent.Units
// Verify the input unit
assert.Equal(t, "system/metrics-default-test-other-input", units[0].ID)
assert.Equal(t, client.UnitTypeInput, units[0].Type)
assert.Equal(t, "test-other-input", units[0].Config.Id)
assert.Equal(t, "system/metrics", units[0].Config.Type)
=======
units := runtimeComponent.Units
// Verify the input unit
assert.Equal(t, "system/metrics-default-test-other-input", units[0].ID)
assert.Equal(t, client.UnitTypeInput, units[0].Type)
assert.Equal(t, "test-other-input", units[0].Config.Id)
assert.Equal(t, "system/metrics", units[0].Config.Type)

// Verify the output unit
assert.Equal(t, "system/metrics-default", units[1].ID)
assert.Equal(t, client.UnitTypeOutput, units[1].Type)
assert.Equal(t, "elasticsearch", units[1].Config.Type)
})

t.Run("unsupported otel output option", func(t *testing.T) {

Check failure on line 1107 in internal/pkg/agent/application/coordinator/coordinator_unit_test.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

syntax error: unexpected {, expected name
// Create a policy with one input and one output (no otel configuration)
cfg := config.MustNewConfigFrom(`
outputs:
default:
type: elasticsearch
hosts:
- localhost:9200
indices: [] # not supported by the elasticsearch exporter
inputs:
- id: test-input
type: filestream
use_output: default
_runtime_experimental: otel
- id: test-other-input
type: system/metrics
use_output: default
receivers:
nop:
exporters:
nop:
service:
pipelines:
traces:
receivers:
- nop
exporters:
- nop
`)

// Send the policy change and make sure it was acknowledged.
cfgChange := &configChange{cfg: cfg}
configChan <- cfgChange
coord.runLoopIteration(ctx)
assert.True(t, cfgChange.acked, "Coordinator should ACK a successful policy change")
assert.NoError(t, cfgChange.err, "config processing shouldn't report an error")

// Make sure the runtime manager received the expected component update.
// An assert.Equal on the full component model doesn't play nice with
// the embedded proto structs, so instead we verify the important fields
// manually (sorry).
assert.True(t, updated, "Runtime manager should be updated after a policy change")
assert.True(t, otelUpdated, "OTel manager should be updated after a policy change")
require.NotNil(t, otelConfig, "OTel manager should have config")

assert.Len(t, components, 2, "both components should be assigned to the runtime manager")
})

Check failure on line 1153 in internal/pkg/agent/application/coordinator/coordinator_unit_test.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

syntax error: unexpected ) after top level declaration
>>>>>>> 0ba2ea683 (Check for config processing errors in coordinator unit tests (#10203))

Check failure on line 1154 in internal/pkg/agent/application/coordinator/coordinator_unit_test.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

binary literal has no digits (typecheck)

Check failure on line 1154 in internal/pkg/agent/application/coordinator/coordinator_unit_test.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

invalid character U+0023 '#' (typecheck)

Check failure on line 1154 in internal/pkg/agent/application/coordinator/coordinator_unit_test.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

binary literal has no digits

// Verify the output unit
assert.Equal(t, "system/metrics-default", units[1].ID)
Expand Down
Loading