INNER CODE UNIT · Go
TestGetCommandLineOptions_LeaderElectionTimingsAreDurationStrings
stakater/Reloader · pkg/common/common_test.go:281
func TestGetCommandLineOptions_LeaderElectionTimingsAreDurationStrings(t *testing.T) {
origLease, origRenew, origRetry := options.LeaderElectionLeaseDuration, options.LeaderElectionRenewDeadline, options.LeaderElectionRetryPeriod
defer func() {
options.LeaderElectionLeaseDuration, options.LeaderElectionRenewDeadline, options.LeaderElectionRetryPeriod = origLease, origRenew, origRetry
}()
options.LeaderElectionLeaseDuration = 30 * time.Second
options.LeaderElectionRenewDeadline = 20 * time.Second
options.LeaderElectionRetryPeriod = 4 * time.Second
// the meta-info ConfigMap holds the marshalled options, so the timings must
// read as durations there rather than as raw nanoseconds
encoded, err := json.Marshal(GetCommandLineOptions())
if err != nil {
t.Fatalf("Expected the options to marshal, got err=%v", err)
}
decoded := map[string]any{}
if err := json.Unmarshal(encoded, &decoded); err != nil {