(t *testing.T)
| 265 | } |
| 266 | |
| 267 | func Test_overridesValidator(t *testing.T) { |
| 268 | testCases := []struct { |
| 269 | name string |
| 270 | cfg Config |
| 271 | limits client.Limits |
| 272 | expErr string |
| 273 | }{ |
| 274 | { |
| 275 | name: "forwarders - valid", |
| 276 | cfg: Config{ |
| 277 | Distributor: distributor.Config{ |
| 278 | Forwarders: []forwarder.Config{ |
| 279 | {Name: "forwarder-1"}, |
| 280 | {Name: "forwarder-2"}, |
| 281 | {Name: "forwarder-3"}, |
| 282 | }, |
| 283 | }, |
| 284 | }, |
| 285 | limits: client.Limits{ |
| 286 | Forwarders: &[]string{"forwarder-1", "forwarder-3"}, |
| 287 | }, |
| 288 | }, |
| 289 | { |
| 290 | name: "forwarders - invalid", |
| 291 | cfg: Config{ |
| 292 | Distributor: distributor.Config{ |
| 293 | Forwarders: []forwarder.Config{ |
| 294 | {Name: "forwarder-1"}, |
| 295 | {Name: "forwarder-2"}, |
| 296 | }, |
| 297 | }, |
| 298 | }, |
| 299 | limits: client.Limits{ |
| 300 | Forwarders: &[]string{"forwarder-1", "some-forwarder"}, |
| 301 | }, |
| 302 | expErr: "forwarder \"some-forwarder\" is not a known forwarder, contact your system administrator", |
| 303 | }, |
| 304 | { |
| 305 | name: "metrics_generator.processor", |
| 306 | cfg: Config{}, |
| 307 | limits: client.Limits{ |
| 308 | MetricsGenerator: client.LimitsMetricsGenerator{ |
| 309 | Processors: &listtomap.ListToMap{ |
| 310 | "service-graphs": {}, |
| 311 | "span-span": {}, |
| 312 | }, |
| 313 | }, |
| 314 | }, |
| 315 | expErr: fmt.Sprintf("metrics_generator.processor \"span-span\" is not a known processor, valid values: %v", validation.SupportedProcessors), |
| 316 | }, |
| 317 | { |
| 318 | name: "filter policies", |
| 319 | cfg: Config{}, |
| 320 | limits: client.Limits{ |
| 321 | Forwarders: &[]string{}, |
| 322 | MetricsGenerator: client.LimitsMetricsGenerator{Processor: client.LimitsMetricsGeneratorProcessor{SpanMetrics: client.LimitsMetricsGeneratorProcessorSpanMetrics{FilterPolicies: &[]filterconfig.FilterPolicy{{ |
| 323 | Include: &filterconfig.PolicyMatch{ |
| 324 | MatchType: filterconfig.Strict, |
nothing calls this directly
no test coverage detected