Skip to content

Commit 0e992ad

Browse files
committed
trt-2163: pass in oc to avoid ginkgo panics
1 parent 88e9c10 commit 0e992ad

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

pkg/monitortests/kubeapiserver/disruptioninclusterapiserver/monitortest.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ func (i *InvariantInClusterDisruption) StartCollection(ctx context.Context, admi
318318
log.Infof("payload image pull spec is %s", i.payloadImagePullSpec)
319319

320320
// Extract the openshift-tests image from the release payload
321-
i.openshiftTestsImagePullSpec, err = extensions.ExtractImageFromReleasePayload(i.payloadImagePullSpec, "tests")
321+
oc := exutil.NewCLIForMonitorTest("default")
322+
i.openshiftTestsImagePullSpec, err = extensions.ExtractImageFromReleasePayload(i.payloadImagePullSpec, "tests", oc)
322323
if err != nil {
323324
return fmt.Errorf("unable to determine openshift-tests image: %s: %v", i.payloadImagePullSpec, err)
324325
}

pkg/monitortests/network/disruptionpodnetwork/monitortest.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ func NewPodNetworkAvalibilityInvariant(info monitortestframework.MonitorTestInit
9191
func (pna *podNetworkAvalibility) PrepareCollection(ctx context.Context, adminRESTConfig *rest.Config, recorder monitorapi.RecorderWriter) error {
9292
deploymentID := uuid.New().String()
9393

94-
openshiftTestsImagePullSpec, err := GetOpenshiftTestsImagePullSpec(ctx, adminRESTConfig, pna.payloadImagePullSpec, nil)
94+
// Skip on ROSA TRT-1869
95+
oc := util.NewCLIWithoutNamespace("openshift-tests")
96+
openshiftTestsImagePullSpec, err := GetOpenshiftTestsImagePullSpec(ctx, adminRESTConfig, pna.payloadImagePullSpec, oc)
9597
if err != nil {
9698
pna.notSupportedReason = &monitortestframework.NotSupportedError{Reason: fmt.Sprintf("unable to determine openshift-tests image: %v", err)}
9799
return pna.notSupportedReason
98100
}
99101

100-
// Skip on ROSA TRT-1869
101-
oc := util.NewCLIWithoutNamespace("openshift-tests")
102102
isManagedServiceCluster, err := util.IsManagedServiceCluster(ctx, oc.AdminKubeClient())
103103
if isManagedServiceCluster {
104104
pna.notSupportedReason = &monitortestframework.NotSupportedError{Reason: fmt.Sprintf("pod network tests are unschedulable on ROSA TRT-1869")}

pkg/monitortests/network/disruptionpodnetwork/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func GetOpenshiftTestsImagePullSpec(ctx context.Context, adminRESTConfig *rest.C
3333
// runImageExtract extracts src from specified image to dst
3434

3535
// Extract the openshift-tests image from the release payload
36-
openshiftTestsImagePullSpec, err := extensions.ExtractImageFromReleasePayload(suggestedPayloadImage, "tests")
36+
openshiftTestsImagePullSpec, err := extensions.ExtractImageFromReleasePayload(suggestedPayloadImage, "tests", oc)
3737
if err != nil {
3838
logrus.WithError(err).Errorf("unable to determine openshift-tests image through ExtractImageFromReleasePayload: %v", err)
3939
// Now try the wrapper to see if it makes a difference

pkg/test/extensions/binary.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,8 @@ func ExtractAllTestBinaries(ctx context.Context, parallelism int) (func(), TestB
426426

427427
defer os.RemoveAll(tmpDir)
428428

429-
registryAuthFilePath, err := DetermineRegistryAuthFilePath(tmpDir)
429+
oc := exutil.NewCLIWithoutNamespace("default")
430+
registryAuthFilePath, err := DetermineRegistryAuthFilePath(tmpDir, oc)
430431
if err != nil {
431432
return nil, nil, fmt.Errorf("failed to determine registry auth file path: %w", err)
432433
}

pkg/test/extensions/util.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,15 +273,15 @@ func extractReleaseImageStream(extractPath, releaseImage string,
273273

274274
// ExtractImageFromReleasePayload extracts the image pull spec for a specific tag from a release payload.
275275
// It returns the image pull spec for the specified tag or an error if the tag is not found.
276-
func ExtractImageFromReleasePayload(releaseImage, imageTag string) (string, error) {
276+
func ExtractImageFromReleasePayload(releaseImage, imageTag string, oc *util.CLI) (string, error) {
277277
// Create a temporary directory for extraction
278278
tmpDir, err := os.MkdirTemp("", "release-extract")
279279
if err != nil {
280280
return "", fmt.Errorf("failed to create temporary directory: %w", err)
281281
}
282282
defer os.RemoveAll(tmpDir)
283283

284-
registryAuthFilePath, err := DetermineRegistryAuthFilePath(tmpDir)
284+
registryAuthFilePath, err := DetermineRegistryAuthFilePath(tmpDir, oc)
285285
if err != nil {
286286
return "", fmt.Errorf("failed to determine registry auth file path: %w", err)
287287
}
@@ -302,9 +302,7 @@ func ExtractImageFromReleasePayload(releaseImage, imageTag string) (string, erro
302302
return "", fmt.Errorf("image tag %q not found in release payload %q", imageTag, releaseImage)
303303
}
304304

305-
func DetermineRegistryAuthFilePath(tmpDir string) (string, error) {
306-
oc := util.NewCLIWithoutNamespace("default")
307-
305+
func DetermineRegistryAuthFilePath(tmpDir string, oc *util.CLI) (string, error) {
308306
// To extract binaries bearing external tests, we must inspect the release
309307
// payload under tests as well as extract content from component images
310308
// referenced by that payload.

0 commit comments

Comments
 (0)