Skip to content

Shipper configuration tests are run against invalid configurations #2147

@faec

Description

@faec

The Agent tests that construct fake shippers / inputs and their configurations are, at least in some cases, verifying the output configurations against incorrect or impossible inputs, such that the real code paths aren't being exercised. The problem was first observed in TestManager_FakeShipper but may apply to other contexts.

I haven't pinned down the exact mechanism of failure yet since these tests are pretty large and involve a lot of setup / mocked elements, but one visible consequence is: when an input unit configuration (unit.Type() == client.UnitTypeInput) is generated and passed through to Manager.connectShippers, comp.ShipperSpec is non-nil. However, in a real configuration, comp.ShipperSpec should only be non-nil for the shipper itself, and should be nil for its inputs (the test if comp.ShipperSpec != nil is used to recognize a shipper unit as opposed to an input). In consequence, any tests that rely on distinguishing shipper and input units during initialization will receive the wrong metadata, and that is what ends up being tested rather than the intended unit types.

(Problem was discovered in the context of this pending PR)

Metadata

Metadata

Assignees

Labels

Team:Elastic-AgentLabel for the Agent teambugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions