INNER CODE UNIT · Go

TestNewEnablesLeaderElectionByDefault

kuberhealthy/kuberhealthy · cmd/kuberhealthy/config_test.go:100

func TestNewEnablesLeaderElectionByDefault(t *testing.T) {
	// Create a config without any leader election override.
	cfg := New()

	// Confirm the safe default is enabled.
	if !cfg.LeaderElectionEnabled {
		t.Fatalf("expected LeaderElectionEnabled to default to true")
	}
}

// TestLoadFromEnvInvalid returns an error when a duration environment variable is malformed.
func TestLoadFromEnvInvalid(t *testing.T) {
	if testing.Short() {
		t.Skip("skipping invalid config test in short mode")
	}
	t.Setenv("KH_MAX_JOB_AGE", "not-a-duration")
	cfg := New()
	err := cfg.LoadFromEnv()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…