Skip to content

Commit

Permalink
Added METRIC_TEST_IMAGE var
Browse files Browse the repository at this point in the history
  • Loading branch information
evgenLevin authored and openshift-cherrypick-robot committed Jan 10, 2024
1 parent b49cc43 commit dd69149
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,7 @@ Running `make deploy` will deploy the daemonset and set up the configuration to
## Deploy on k8s

Running `make deploy-k8s` will deploy the daemonset and set up the configuration to tie it to the Prometheus operator instance of an existing kubernetes cluster where the prometheus operator was deployed. Please note that the k8s version exposes metrics over a plain http port.

## List of environment variables used in the tests

- METRIC_TEST_IMAGE - path to generic container image used in tests
4 changes: 2 additions & 2 deletions test/network-metrics-daemon/network_metrics_daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var _ = ginkgo.Describe("NetworkMetricsDaemon", func() {
Containers: []corev1.Container{
{
Name: "c1",
Image: "quay.io/centos/centos",
Image: consts.TestImage,
Command: []string{"/bin/bash", "-c", "sleep inf"},
},
},
Expand Down Expand Up @@ -226,7 +226,7 @@ var _ = ginkgo.Describe("NetworkMetricsDaemon", func() {
Containers: []corev1.Container{
{
Name: "c1",
Image: "quay.io/centos/centos",
Image: consts.TestImage,
Command: []string{"/bin/bash", "-c", "sleep inf"},
},
},
Expand Down
12 changes: 12 additions & 0 deletions test/utils/consts/consts.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
package consts

import "os"

// TestImage contains test image (default is quay.io/centos/centos)
var TestImage string

func init() {
TestImage = os.Getenv("METRIC_TEST_IMAGE")
if TestImage == "" {
TestImage = "quay.io/centos/centos"
}
}

const (
// TestingNamespace contains the name of the testing namespace
TestingNamespace = "metrictest"
Expand Down
2 changes: 1 addition & 1 deletion test/utils/pods/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func getDefinition() *corev1.Pod {
Spec: corev1.PodSpec{
TerminationGracePeriodSeconds: pointer.Int64Ptr(0),
Containers: []corev1.Container{{Name: "test",
Image: "quay.io/centos/centos",
Image: consts.TestImage,
Command: []string{"/bin/bash", "-c", "sleep INF"},
}},
},
Expand Down

0 comments on commit dd69149

Please sign in to comment.