Skip to content

Commit ceed810

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 ceed810

File tree

2 files changed

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

2 files changed

+29
-5
lines changed

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

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

91-
for k, v := range image.GetOriginalImageConfigs() {
92-
image := convertToImage(v)
93-
image.Index = int(k)
91+
originals := image.GetOriginalImageConfigs()
92+
for k, v := range originals {
93+
image := convertToImage(v, k)
94+
kubeTestsExtension.RegisterImage(image)
95+
}
96+
97+
mirror := "quay.io/openshift/community-e2e-images"
98+
if v := os.Getenv("TEST_IMAGE_MIRROR"); len(v) > 0 {
99+
mirror = v
100+
}
101+
102+
mapped := image.GetMappedImageConfigs(originals, mirror)
103+
for k, v := range mapped {
104+
image := convertToImage(v, k)
94105
kubeTestsExtension.RegisterImage(image)
95106
}
96107

@@ -158,10 +169,10 @@ func main() {
158169
}
159170
}
160171

161-
// convertToImages converts an image.Config to an extension.Image, which
172+
// convertToImage converts an image.Config to an extension.Image, which
162173
// can easily be serialized to JSON. Since image.Config has unexported fields,
163174
// reflection is used to read its values.
164-
func convertToImage(obj interface{}) e.Image {
175+
func convertToImage(obj interface{}, index image.ImageID) e.Image {
165176
image := e.Image{}
166177
val := reflect.ValueOf(obj)
167178
typ := reflect.TypeOf(obj)
@@ -171,11 +182,16 @@ func convertToImage(obj interface{}) e.Image {
171182
switch structField.Name {
172183
case "registry":
173184
image.Registry = fieldValue.String()
185+
image.Mapped.Registry = fieldValue.String()
174186
case "name":
175187
image.Name = fieldValue.String()
188+
image.Mapped.Name = fieldValue.String()
176189
case "version":
177190
image.Version = fieldValue.String()
191+
image.Mapped.Version = fieldValue.String()
178192
}
193+
image.Index = int(index)
194+
image.Mapped.Index = int(index)
179195
}
180196
return image
181197
}

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

Lines changed: 8 additions & 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)