Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(e2e): fixed some issues with e2e tests #4508

Merged
merged 2 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/scalers/solace/solace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ func TestStanScaler(t *testing.T) {
}

func installSolace(t *testing.T) {
_, err := ExecuteCommand("helm repo add solacecharts https://solaceproducts.github.io/pubsubplus-kubernetes-quickstart/helm-charts")
_, err := ExecuteCommand("helm repo add solacecharts https://solaceproducts.github.io/pubsubplus-kubernetes-helm-quickstart/helm-charts")
assert.NoErrorf(t, err, "cannot execute command - %s", err)
_, err = ExecuteCommand("helm repo update")
assert.NoErrorf(t, err, "cannot execute command - %s", err)
_, err = ExecuteCommand(fmt.Sprintf(`helm upgrade --install --set solace.usernameAdminPassword=KedaLabAdminPwd1 --set storage.persistent=false --namespace %s --wait kedalab solacecharts/pubsubplus-dev`,
_, err = ExecuteCommand(fmt.Sprintf(`helm upgrade --install --set solace.usernameAdminPassword=KedaLabAdminPwd1 --set storage.persistent=false --namespace %s --wait --timeout 900s kedalab solacecharts/pubsubplus-dev`,
testNamespace))
assert.NoErrorf(t, err, "cannot execute command - %s", err)
// Create the pubsub broker
Expand Down
10 changes: 7 additions & 3 deletions tests/sequential/prometheus_metrics/prometheus_metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var (
monitoredDeploymentName = fmt.Sprintf("%s-monitored", testName)
scaledObjectName = fmt.Sprintf("%s-so", testName)
wrongScaledObjectName = fmt.Sprintf("%s-wrong", testName)
wrongScalerName = fmt.Sprintf("%s-wrong-scaler", testName)
cronScaledJobName = fmt.Sprintf("%s-cron-sj", testName)
clientName = fmt.Sprintf("%s-client", testName)
kedaOperatorPrometheusURL = "http://keda-operator.keda.svc.cluster.local:8080/metrics"
Expand All @@ -44,6 +45,7 @@ type templateData struct {
DeploymentName string
ScaledObjectName string
WrongScaledObjectName string
WrongScalerName string
CronScaledJobName string
MonitoredDeploymentName string
ClientName string
Expand Down Expand Up @@ -133,6 +135,7 @@ spec:
cooldownPeriod: 10
triggers:
- type: prometheus
name: {{.WrongScalerName}}
metadata:
serverAddress: http://keda-prometheus.keda.svc.cluster.local:8080
metricName: keda_scaler_errors_total
Expand Down Expand Up @@ -274,6 +277,7 @@ func getTemplateData() (templateData, []Template) {
DeploymentName: deploymentName,
ScaledObjectName: scaledObjectName,
WrongScaledObjectName: wrongScaledObjectName,
WrongScalerName: wrongScalerName,
MonitoredDeploymentName: monitoredDeploymentName,
ClientName: clientName,
CronScaledJobName: cronScaledJobName,
Expand Down Expand Up @@ -361,8 +365,8 @@ func testScalerErrors(t *testing.T, data templateData) {
if val, ok := family["keda_scaler_errors"]; ok {
errCounterVal1 := getErrorMetricsValue(val)

// wait for 4 seconds to correctly fetch metrics.
time.Sleep(4 * time.Second)
// wait for 10 seconds to correctly fetch metrics.
time.Sleep(10 * time.Second)

family = fetchAndParsePrometheusMetrics(t, fmt.Sprintf("curl --insecure %s", kedaOperatorPrometheusURL))
if val, ok := family["keda_scaler_errors"]; ok {
Expand Down Expand Up @@ -431,7 +435,7 @@ func getErrorMetricsValue(val *promModel.MetricFamily) float64 {
for _, metric := range metrics {
labels := metric.GetLabel()
for _, label := range labels {
if *label.Name == "scaler" && *label.Value == "prometheusScaler" {
if *label.Name == "scaler" && *label.Value == wrongScalerName {
return *metric.Counter.Value
}
}
Expand Down