Skip to content

Commit

Permalink
Add registry prefix option
Browse files Browse the repository at this point in the history
This allows to pre-pull the images and running benchmarks against a
local registry.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
  • Loading branch information
saschagrunert committed Jun 26, 2019
1 parent 93aa03a commit 49cdc2e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/critest/cri_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func TestCRISuite(t *testing.T) {

if *isBenchMark {
flag.Set("ginkgo.focus", "benchmark")
flag.Set("ginkgo.succinct", "true")
} else {
// Skip benchmark measurements for validation tests.
flag.Set("ginkgo.skipMeasurements", "true")
Expand Down
3 changes: 3 additions & 0 deletions pkg/framework/test_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ type TestContextType struct {

// Test configuration.
IsLcow bool

RegistryPrefix string
}

// TestContext is a test context.
Expand Down Expand Up @@ -77,4 +79,5 @@ func RegisterFlags() {
} else {
TestContext.IsLcow = false
}
flag.StringVar(&TestContext.RegistryPrefix, "registry-prefix", "", "A possible registry prefix added to all images, like 'localhost:5000/'")
}
1 change: 1 addition & 0 deletions pkg/framework/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ func ListImage(c internalapi.ImageManagerService, filter *runtimeapi.ImageFilter

// PullPublicImage pulls the public image named imageName.
func PullPublicImage(c internalapi.ImageManagerService, imageName string, podConfig *runtimeapi.PodSandboxConfig) string {
imageName = TestContext.RegistryPrefix + imageName
if !strings.Contains(imageName, ":") {
imageName = imageName + ":latest"
Logf("Use latest as default image tag.")
Expand Down

0 comments on commit 49cdc2e

Please sign in to comment.