github.com/quay/claircore@v1.5.28/test/scanner.go (about) 1 package test 2 3 import ( 4 "fmt" 5 6 "github.com/quay/claircore/indexer" 7 ) 8 9 // GenUniquePackageScanners creates n number of unique PackageScanners. the array is gauranteed to not have 10 // any scanner fields be duplicates 11 func GenUniquePackageScanners(n int) indexer.VersionedScanners { 12 var vscnrs = []indexer.VersionedScanner{} 13 for i := 0; i < n; i++ { 14 name, version, kind := fmt.Sprintf("test-scanner-%d", i), fmt.Sprintf("version-%d", i), fmt.Sprint("package") 15 m := indexer.NewPackageScannerMock(name, version, kind) 16 vscnrs = append(vscnrs, indexer.VersionedScanner(m)) 17 } 18 19 return vscnrs 20 } 21 22 // GenUniqueDistributionScanners creates n number of unique DistributionScanners. the array is gauranteed to not have 23 // any scanner fields be duplicates 24 func GenUniqueDistributionScanners(n int) indexer.VersionedScanners { 25 var vscnrs = []indexer.VersionedScanner{} 26 for i := 0; i < n; i++ { 27 name, version, kind := fmt.Sprintf("test-scanner-%d", i), fmt.Sprintf("version-%d", i), fmt.Sprint("distribution") 28 m := indexer.NewPackageScannerMock(name, version, kind) 29 vscnrs = append(vscnrs, indexer.VersionedScanner(m)) 30 } 31 32 return vscnrs 33 } 34 35 // GenUniqueRepositoryScanners creates n number of unique RepositoryScanners. the array is gauranteed to not have 36 // any scanner fields be duplicates 37 func GenUniqueRepositoryScanners(n int) indexer.VersionedScanners { 38 var vscnrs = []indexer.VersionedScanner{} 39 for i := 0; i < n; i++ { 40 name, version, kind := fmt.Sprintf("test-scanner-%d", i), fmt.Sprintf("version-%d", i), fmt.Sprint("repository") 41 m := indexer.NewPackageScannerMock(name, version, kind) 42 vscnrs = append(vscnrs, indexer.VersionedScanner(m)) 43 } 44 45 return vscnrs 46 }