|
|
@@ -871,8 +871,17 @@ func TestMetricsCollectorOptionParsing(t *testing.T) {
|
|
|
t.Fatal("Expected METRICS_COLLECTOR to be enabled")
|
|
|
}
|
|
|
|
|
|
- if !configParser.options.HasMetricsCollector() {
|
|
|
- t.Fatal("Expected HAS_METRICS_COLLECTOR to be enabled")
|
|
|
+ if configParser.options.HasMetricsCollector() != metricsSupported {
|
|
|
+ t.Fatal("Expected HAS_METRICS_COLLECTOR to reflect build-time Prometheus support")
|
|
|
+ }
|
|
|
+
|
|
|
+ err := configParser.options.Validate()
|
|
|
+ if metricsSupported {
|
|
|
+ if err != nil {
|
|
|
+ t.Fatalf("Unexpected validation error: %v", err)
|
|
|
+ }
|
|
|
+ } else if err == nil {
|
|
|
+ t.Fatal("Expected validation error when enabling metrics without Prometheus support")
|
|
|
}
|
|
|
|
|
|
if err := configParser.parseLines([]string{"METRICS_COLLECTOR=0"}); err != nil {
|
|
|
@@ -886,6 +895,9 @@ func TestMetricsCollectorOptionParsing(t *testing.T) {
|
|
|
if configParser.options.HasMetricsCollector() {
|
|
|
t.Fatal("Expected HAS_METRICS_COLLECTOR to be disabled")
|
|
|
}
|
|
|
+ if err := configParser.options.Validate(); err != nil {
|
|
|
+ t.Fatalf("Unexpected validation error with metrics disabled: %v", err)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
func TestMetricsPasswordOptionParsing(t *testing.T) {
|