Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2: Add integration tests for the agent v2 control protocol #1275

Closed
4 tasks
Tracked by #836
cmacknz opened this issue Sep 22, 2022 · 7 comments
Closed
4 tasks
Tracked by #836

V2: Add integration tests for the agent v2 control protocol #1275

cmacknz opened this issue Sep 22, 2022 · 7 comments
Assignees
Labels

Comments

@cmacknz
Copy link
Member

cmacknz commented Sep 22, 2022

There is an extensive set of unit tests for the control protocol defined in https://github.com/elastic/elastic-agent/blob/feature-arch-v2/pkg/component/runtime/manager_test.go that use a fake input interacting directly with the agent manager. These provide good coverage for the component and unit state transitions but bypass several layers of the agent (notably the gRPC server) that are involved in running a real input.

To ensure we have no gaps in our test coverage we we should implement integration tests of the v2 control protocol using a fake input binary communicating with the compiled agent binary. We should try to cover the test cases below, which include a basic functional test of an input in normal operation and several important error cases.

  • The input process starts normally, checks in, processes at least one action, acknowledges it, and then shuts down normally.
  • The input process exits unexpectedly. The agent should restart the input and recover it to a healthy state.
  • The agent process restarts unexpectedly. The input process should exit and a new input process instance should start when the agent restarts.
  • The input process attempts to connect to the agent using an invalid certificate or TLS configuration. The agent should refuse the connection and log an obvious error about an unauthenticated connection attempt.
@cmacknz
Copy link
Member Author

cmacknz commented Sep 23, 2022

Relates to #56

@cmacknz
Copy link
Member Author

cmacknz commented Sep 27, 2022

We can use #1068 as prior art for how to set this up. That approach uses containers, but we do not necessarily need containers for these tests. We could just start and control the binaries directly.

@cmacknz cmacknz changed the title Add integration tests for the agent v2 control protocol V2: Add integration tests for the agent v2 control protocol Sep 28, 2022
@cmacknz
Copy link
Member Author

cmacknz commented Sep 28, 2022

This may overlap with #1272 in terms of deciding how the integration tests will be setup and run.

@cmacknz cmacknz assigned cmacknz and unassigned belimawr Sep 28, 2022
@cmacknz
Copy link
Member Author

cmacknz commented Sep 28, 2022

Much of this is already unit tested in https://github.com/elastic/elastic-agent/blob/feature-arch-v2/pkg/component/runtime/manager_test.go. I am going to re-scope this to just writing integration tests using the agent process for a few key scenarios, with most of the coverage living in the existing manager tests.

@jlind23 jlind23 added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Oct 3, 2022
@jlind23
Copy link
Contributor

jlind23 commented Oct 4, 2022

@cmacknz this task was a tech def, can we consider this as done and ready to be worked on?

@cmacknz cmacknz removed their assignment Oct 13, 2022
@cmacknz
Copy link
Member Author

cmacknz commented Oct 13, 2022

Technical definition complete, added to sprint 2.

@blakerouse
Copy link
Contributor

This was completed, the unit tests communicate with a real binary over the real GRPC protocol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants