Skip to content

Commit 473fe21

Browse files
committed
Add a new field Mapped into openshift-test extension Image struct
The new field Mapped contains all the same fields of Image resource that can be used later for openshift-tests images cmd to parse this Mapped key. The k8s-tests-ext will construct this Mapped key from GetMappedImageConfigs() function from upstream. Signed-off-by: Vu Dinh <[email protected]>
1 parent 1b675e1 commit 473fe21

File tree

2 files changed

+23
-2
lines changed
  • openshift-hack/cmd/k8s-tests-ext
  • vendor/github.com/openshift-eng/openshift-tests-extension/pkg/extension

2 files changed

+23
-2
lines changed

openshift-hack/cmd/k8s-tests-ext/k8s-tests.go

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,32 @@ func main() {
8888
Qualifiers: []string{withExcludedTestsFilter(`name.contains('[Serial]')`)},
8989
})
9090

91-
for k, v := range image.GetOriginalImageConfigs() {
91+
originals := image.GetOriginalImageConfigs()
92+
originalImages := make(map[int]e.Image)
93+
for k, v := range originals {
9294
image := convertToImage(v)
9395
image.Index = int(k)
96+
originalImages[image.Index] = image
9497
kubeTestsExtension.RegisterImage(image)
9598
}
9699

100+
mirror := "quay.io/openshift/community-e2e-images"
101+
if v := os.Getenv("TEST_IMAGE_MIRROR"); len(v) > 0 {
102+
mirror = v
103+
}
104+
105+
mapped := image.GetMappedImageConfigs(originals, mirror)
106+
for k, v := range mapped {
107+
original, ok := originalImages[int(k)]
108+
if !ok {
109+
continue
110+
}
111+
image := convertToImage(v)
112+
image.Index = int(k)
113+
original.Mapped = &image
114+
kubeTestsExtension.RegisterImage(original)
115+
}
116+
97117
//FIXME(stbenjam): what other suites does k8s-test contribute to?
98118

99119
// Build our specs from ginkgo
@@ -158,7 +178,7 @@ func main() {
158178
}
159179
}
160180

161-
// convertToImages converts an image.Config to an extension.Image, which
181+
// convertToImage converts an image.Config to an extension.Image, which
162182
// can easily be serialized to JSON. Since image.Config has unexported fields,
163183
// reflection is used to read its values.
164184
func convertToImage(obj interface{}) e.Image {

vendor/github.com/openshift-eng/openshift-tests-extension/pkg/extension/types.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)