MCPcopy Create free account
hub / github.com/quay/clair / TestUpdateRetention

Function TestUpdateRetention

config/config_test.go:346–383  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

344}
345
346func TestUpdateRetention(t *testing.T) {
347 expect := func(n int) func(*testing.T, *config.Config, error) {
348 return func(t *testing.T, c *config.Config, err error) {
349 if err != nil {
350 t.Errorf("unexpected error: %v", err)
351 }
352 if got, want := c.Matcher.UpdateRetention, n; got != want {
353 t.Errorf("got: %d, want: %d", got, want)
354 }
355 }
356 }
357
358 // Construct a bunch of test cases from (in, out) pairs.
359 tt := func(p [][2]int) (tt []ValidateTestcase) {
360 for _, p := range p {
361 tt = append(tt, ValidateTestcase{
362 Name: fmt.Sprintf("%d", p[0]),
363 Conf: config.Config{
364 Mode: config.ComboMode,
365 HTTPListenAddr: "localhost:8080",
366 Matcher: config.Matcher{
367 UpdateRetention: p[0],
368 },
369 },
370 Check: expect(p[1]),
371 })
372 }
373 return
374 }([][2]int{
375 {-1, 0},
376 {0, config.DefaultUpdateRetention},
377 {1, config.DefaultUpdateRetention},
378 {2, 2},
379 })
380 for _, tc := range tt {
381 t.Run(tc.Name, tc.Run)
382 }
383}
384
385func TestDisableUpdaters(t *testing.T) {
386 setsEmpty := func(t *testing.T, c *config.Config, err error) {

Callers

nothing calls this directly

Calls 1

RunMethod · 0.45

Tested by

no test coverage detected