ankaios icon indicating copy to clipboard operation
ankaios copied to clipboard

Refactor workload control loop

Open inf17101 opened this issue 9 months ago • 0 comments

Description

The agent/src/workload/workload_control_loop.rs file has a little bit too much responsibilities. We can decouple more and simplify the unit tests here, when:

  1. Extracting the current concrete operations "create, update, delete, retry, restart) into own sub modules (perhaps with introducing a trait to decouple the knowledge about the concrete operations from the control loop itself)
  2. Refactoring the WorkloadControlLoop to only be responsible for receiving the workload states of the state checker and the workload commands and delegating the concrete operation to the specific module from point 1.
  3. The tests can then be simplified to only verify that when the WorkloadControlLoop receives a workload state or a workload command that it calls the appropriate module (just asserting the mock) or checking that the ControlLoopState variable contains the expected field values.

Goals

The WorkloadControlLoop shall be decoupled from the concrete operations it executes and unit tests shall be simplified.

Final result

Summary

To be filled when the final solution is sketched.

Tasks

  • [ ] Task 1
  • [ ] Task 2
  • [ ] ...

inf17101 avatar May 06 '24 11:05 inf17101