ankaios
ankaios copied to clipboard
Refactor workload control loop
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:
- 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)
- 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.
- 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
- [ ] ...