Skip to content

Commit

Permalink
fetch busycpusImage using environment variables
Browse files Browse the repository at this point in the history
This patch adds 2 env variables QE_IMAGE_REGISTRY and
BUSY_CPUS_IMAGE for QE image registry and busycpus image

This is required to execute tests in disconnected environment
where quay.io is not accessible and have to use internal private
registry

Signed-off-by: Niranjan M.R <mrniranjan@redhat.com>
  • Loading branch information
Niranjan M.R committed Apr 5, 2024
1 parent d2a3e80 commit 691e19a
Showing 1 changed file with 21 additions and 2 deletions.
Expand Up @@ -3,6 +3,7 @@ package __performance
import (
"context"
"fmt"
"os"
"regexp"
"strconv"
"strings"
Expand Down Expand Up @@ -537,14 +538,15 @@ var _ = Describe("[rfe_id:27363][performance] CPU Management", Ordered, func() {
Context("Crio Annotations", func() {
var testpod *corev1.Pod
var allTestpods map[types.UID]*corev1.Pod
var busyCpusImage string
annotations := map[string]string{
"cpu-load-balancing.crio.io": "disable",
"cpu-quota.crio.io": "disable",
}
BeforeAll(func() {
var err error
allTestpods = make(map[types.UID]*corev1.Pod)

busyCpusImage = busyCpuImageEnv()
testpod = getTestPodWithAnnotations(annotations, smtLevel)
// workaround for https://github.com/kubernetes/kubernetes/issues/107074
// until https://github.com/kubernetes/kubernetes/pull/120661 lands
Expand Down Expand Up @@ -576,7 +578,7 @@ var _ = Describe("[rfe_id:27363][performance] CPU Management", Ordered, func() {

By("Starting the pod")
testpod.Spec.NodeSelector = testutils.NodeSelectorLabels
testpod.Spec.Containers[0].Image = "quay.io/ocp-edge-qe/busycpus"
testpod.Spec.Containers[0].Image = busyCpusImage
testpod.Spec.Containers[0].Resources.Limits[corev1.ResourceCPU] = resource.MustParse("2")
err = testclient.Client.Create(context.TODO(), testpod)
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -951,3 +953,20 @@ func checkSchedulingDomains(workerRTNode *corev1.Node, podCpus cpuset.CPUSet, te
}).WithTimeout(2*time.Minute).WithPolling(5*time.Second).ShouldNot(HaveOccurred(), errMsg)

}

// busyCpuImageEnv return busycpus image used for crio quota annotations test
// This is required for running tests on disconnected environment where images are mirrored
// in private registries.
func busyCpuImageEnv() string {
qeImageRegistry := os.Getenv("QE_IMAGE_REGISTRY")
busyCpusImage := os.Getenv("BUSY_CPUS_IMAGE")

if busyCpusImage == "" {
busyCpusImage = "busycpus"
}

if qeImageRegistry == "" {
qeImageRegistry = "quay.io/ocp-edge-qe/"
}
return fmt.Sprintf("%s%s", qeImageRegistry, busyCpusImage)
}

0 comments on commit 691e19a

Please sign in to comment.