Add tests for leadership election

Pull liveness into leadership to ease testing, logically the liveness
probe is directly affected by leadership so it makes sense here.

Moved some of the components of the controller tests into the testutil
package for reuse in my own tests.
This commit is contained in:
Alex Vest
2022-09-16 12:06:04 +01:00
parent d34c99baf4
commit 11ae057b0a
6 changed files with 263 additions and 24 deletions

View File

@@ -19,6 +19,7 @@ func (r ResourceCreatedHandler) Handle() error {
logrus.Errorf("Resource creation handler received nil resource")
} else {
config, _ := r.GetConfig()
// process resource based on its type
return doRollingUpgrade(config, r.Collectors)
}
return nil

View File

@@ -21,6 +21,7 @@ func (r ResourceUpdatedHandler) Handle() error {
} else {
config, oldSHAData := r.GetConfig()
if config.SHAValue != oldSHAData {
// process resource based on its type
return doRollingUpgrade(config, r.Collectors)
}
}