Skip to content

Commit feac727

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 feac727

File tree

2 files changed

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

2 files changed

+23
-3
lines changed

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

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,29 @@ 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)
94-
kubeTestsExtension.RegisterImage(image)
96+
originalImages[image.Index] = image
97+
}
98+
99+
mirror := "quay.io/openshift/community-e2e-images"
100+
if v := os.Getenv("TEST_IMAGE_MIRROR"); len(v) > 0 {
101+
mirror = v
102+
}
103+
104+
mapped := image.GetMappedImageConfigs(originals, mirror)
105+
for k, v := range mapped {
106+
original, ok := originalImages[int(k)]
107+
if !ok {
108+
continue
109+
}
110+
image := convertToImage(v)
111+
image.Index = int(k)
112+
original.Mapped = &image
113+
kubeTestsExtension.RegisterImage(original)
95114
}
96115

97116
//FIXME(stbenjam): what other suites does k8s-test contribute to?
@@ -158,7 +177,7 @@ func main() {
158177
}
159178
}
160179

161-
// convertToImages converts an image.Config to an extension.Image, which
180+
// convertToImage converts an image.Config to an extension.Image, which
162181
// can easily be serialized to JSON. Since image.Config has unexported fields,
163182
// reflection is used to read its values.
164183
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)