github.com/quay/claircore@v1.5.28/test/enrichment.go (about) 1 package test 2 3 import ( 4 "encoding/json" 5 "fmt" 6 "strconv" 7 8 "github.com/quay/claircore/libvuln/driver" 9 ) 10 11 // GenEnrichments creates an array of enrichment records, with no meaningful 12 // content. 13 func GenEnrichments(n int) []driver.EnrichmentRecord { 14 var rs []driver.EnrichmentRecord 15 for i := 0; i < n; i++ { 16 t := strconv.Itoa(i) 17 e := fmt.Sprintf(`{"%[1]d":{"id":%[1]d}}`, i) 18 rs = append(rs, driver.EnrichmentRecord{ 19 Tags: []string{t}, 20 Enrichment: json.RawMessage(e), 21 }) 22 } 23 return rs 24 }