mirror of
https://github.com/kubernetes-sigs/descheduler.git
synced 2026-01-26 05:14:13 +01:00
1.2 KiB
1.2 KiB
Descheduler Design Constraints
This is a slowly growing document that lists good practices, conventions, and design decisions.
Overview
TBD
Code convention
- formatting code: running
make fmtbefore committing each change to avoid ci failing
Unit Test Conventions
These are the known conventions that are useful to practice whenever reasonable:
- single pod creation: each pod variable built using
test.BuildTestPodis updated only through theapplyargument ofBuildTestPod - single node creation: each node variable built using
test.BuildTestNodeis updated only through theapplyargument ofBuildTestNode - no object instance sharing: each object built through
test.BuildXXXfunctions is newly created in each unit test to avoid accidental object mutations - no object instance duplication: avoid duplication by no creating two objects with the same passed values at two different places. E.g. two nodes created with the same memory, cpu and pods requests. Rather create a single function wrapping test.BuildTestNode and invoke this wrapper multiple times.
The aim is to reduce cognitive load when reading and debugging the test code.