| 383 | } |
| 384 | |
| 385 | func TestDisableUpdaters(t *testing.T) { |
| 386 | setsEmpty := func(t *testing.T, c *config.Config, err error) { |
| 387 | if err != nil { |
| 388 | t.Errorf("unexpected error: %v", err) |
| 389 | } |
| 390 | if !cmp.Equal(c.Updaters.Sets, []string{}) { |
| 391 | t.Error(cmp.Diff(c.Updaters.Sets, []string{})) |
| 392 | } |
| 393 | } |
| 394 | tt := []ValidateTestcase{ |
| 395 | { |
| 396 | Name: "ComboMode", |
| 397 | Conf: config.Config{ |
| 398 | Mode: config.ComboMode, |
| 399 | Matcher: config.Matcher{ |
| 400 | DisableUpdaters: true, |
| 401 | }, |
| 402 | Updaters: config.Updaters{ |
| 403 | Sets: []string{"alpine", "aws"}, |
| 404 | }, |
| 405 | }, |
| 406 | Check: setsEmpty, |
| 407 | }, |
| 408 | { |
| 409 | Name: "MatcherMode", |
| 410 | Conf: config.Config{ |
| 411 | Mode: config.MatcherMode, |
| 412 | Matcher: config.Matcher{ |
| 413 | IndexerAddr: "http://example.com/", |
| 414 | DisableUpdaters: true, |
| 415 | }, |
| 416 | Updaters: config.Updaters{ |
| 417 | Sets: []string{"alpine", "aws"}, |
| 418 | }, |
| 419 | }, |
| 420 | Check: setsEmpty, |
| 421 | }, |
| 422 | } |
| 423 | |
| 424 | for _, tc := range tt { |
| 425 | t.Run(tc.Name, tc.Run) |
| 426 | } |
| 427 | } |