From 0368ebdaf38430417a48cbbc481f033af607e3a8 Mon Sep 17 00:00:00 2001 From: Jakub Adamus Date: Fri, 16 Jun 2023 00:30:37 +0200 Subject: [PATCH] Add E2E tests for RabbitMQ with Azure Workload Identity auth & fix rabbitmq generic tests Signed-off-by: Jakub Adamus --- tests/scalers/rabbitmq/rabbitmq_helper.go | 63 ++++++- .../rabbitmq_queue_amqp_test.go | 6 +- .../rabbitmq_queue_amqp_vhost_test.go | 6 +- .../rabbitmq_queue_http_test.go | 6 +- .../rabbitmq_queue_http_aad_wi_test.go | 172 +++++++++++++++++ .../rabbitmq_queue_http_regex_test.go | 6 +- .../rabbitmq_queue_http_regex_aad_wi_test.go | 178 ++++++++++++++++++ .../rabbitmq_queue_http_regex_vhost_test.go | 6 +- .../rabbitmq_queue_http_vhost_test.go | 6 +- 9 files changed, 421 insertions(+), 28 deletions(-) create mode 100644 tests/scalers/rabbitmq/rabbitmq_queue_http_aad_wi/rabbitmq_queue_http_aad_wi_test.go create mode 100644 tests/scalers/rabbitmq/rabbitmq_queue_http_regex_aad_wi/rabbitmq_queue_http_regex_aad_wi_test.go diff --git a/tests/scalers/rabbitmq/rabbitmq_helper.go b/tests/scalers/rabbitmq/rabbitmq_helper.go index a3ad2e2d6e2..1fc676b4f4c 100644 --- a/tests/scalers/rabbitmq/rabbitmq_helper.go +++ b/tests/scalers/rabbitmq/rabbitmq_helper.go @@ -60,6 +60,15 @@ data: default_vhost = {{.VHostName}} management.tcp.port = 15672 management.tcp.ip = 0.0.0.0 + {{if .EnableOAuth}} + auth_backends.1 = rabbit_auth_backend_internal + auth_backends.2 = rabbit_auth_backend_oauth2 + auth_backends.3 = rabbit_auth_backend_amqp + auth_oauth2.resource_server_id = {{.OAuthClientId}} + auth_oauth2.scope_prefix = rabbitmq. + auth_oauth2.additional_scopes_key = {{.OAuthScopesKey}} + auth_oauth2.jwks_url = {{.OAuthJwksUri}} + {{end}} enabled_plugins: | [rabbitmq_management]. --- @@ -158,6 +167,28 @@ spec: ` ) +type RabbitOAuthConfig struct { + Enable bool + ClientId string + ScopesKey string + JwksUrl string +} + +func WithoutOAuth() RabbitOAuthConfig { + return RabbitOAuthConfig{ + Enable: false, + } +} + +func WithAzureADOAuth(tenantId string, clientId string) RabbitOAuthConfig { + return RabbitOAuthConfig{ + Enable: true, + ClientId: clientId, + ScopesKey: "roles", + JwksUrl: fmt.Sprintf("https://login.microsoftonline.com/%s/discovery/keys", tenantId), + } +} + type templateData struct { Namespace string Connection string @@ -165,26 +196,38 @@ type templateData struct { HostName, VHostName string Username, Password string MessageCount int + EnableOAuth bool + OAuthClientId string + OAuthScopesKey string + OAuthJwksUri string } -func RMQInstall(t *testing.T, kc *kubernetes.Clientset, namespace, user, password, vhost string) { +func RMQInstall(t *testing.T, kc *kubernetes.Clientset, namespace, user, password, vhost string, oauth RabbitOAuthConfig) { helper.CreateNamespace(t, kc, namespace) data := templateData{ - Namespace: namespace, - VHostName: vhost, - Username: user, - Password: password, + Namespace: namespace, + VHostName: vhost, + Username: user, + Password: password, + EnableOAuth: oauth.Enable, + OAuthClientId: oauth.ClientId, + OAuthScopesKey: oauth.ScopesKey, + OAuthJwksUri: oauth.JwksUrl, } helper.KubectlApplyWithTemplate(t, data, "rmqDeploymentTemplate", deploymentTemplate) } -func RMQUninstall(t *testing.T, namespace, user, password, vhost string) { +func RMQUninstall(t *testing.T, namespace, user, password, vhost string, oauth RabbitOAuthConfig) { data := templateData{ - Namespace: namespace, - VHostName: vhost, - Username: user, - Password: password, + Namespace: namespace, + VHostName: vhost, + Username: user, + Password: password, + EnableOAuth: oauth.Enable, + OAuthClientId: oauth.ClientId, + OAuthScopesKey: oauth.ScopesKey, + OAuthJwksUri: oauth.JwksUrl, } helper.KubectlDeleteWithTemplate(t, data, "rmqDeploymentTemplate", deploymentTemplate) diff --git a/tests/scalers/rabbitmq/rabbitmq_queue_amqp/rabbitmq_queue_amqp_test.go b/tests/scalers/rabbitmq/rabbitmq_queue_amqp/rabbitmq_queue_amqp_test.go index fd3fc89ffc6..be16d0a480b 100644 --- a/tests/scalers/rabbitmq/rabbitmq_queue_amqp/rabbitmq_queue_amqp_test.go +++ b/tests/scalers/rabbitmq/rabbitmq_queue_amqp/rabbitmq_queue_amqp_test.go @@ -17,7 +17,7 @@ import ( ) // Load environment variables from .env file -var _ = godotenv.Load("../../.env") +var _ = godotenv.Load("../../../.env") const ( testName = "rmq-queue-amqp-test" @@ -79,7 +79,7 @@ func TestScaler(t *testing.T) { kc := GetKubernetesClient(t) data, templates := getTemplateData() - RMQInstall(t, kc, rmqNamespace, user, password, vhost) + RMQInstall(t, kc, rmqNamespace, user, password, vhost, WithoutOAuth()) CreateKubernetesResources(t, kc, testNamespace, data, templates) assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, deploymentName, testNamespace, 0, 60, 1), @@ -92,7 +92,7 @@ func TestScaler(t *testing.T) { // cleanup t.Log("--- cleaning up ---") DeleteKubernetesResources(t, testNamespace, data, templates) - RMQUninstall(t, rmqNamespace, user, password, vhost) + RMQUninstall(t, rmqNamespace, user, password, vhost, WithoutOAuth()) } func getTemplateData() (templateData, []Template) { diff --git a/tests/scalers/rabbitmq/rabbitmq_queue_amqp_vhost/rabbitmq_queue_amqp_vhost_test.go b/tests/scalers/rabbitmq/rabbitmq_queue_amqp_vhost/rabbitmq_queue_amqp_vhost_test.go index 299c9a6a74a..7ae59414a0d 100644 --- a/tests/scalers/rabbitmq/rabbitmq_queue_amqp_vhost/rabbitmq_queue_amqp_vhost_test.go +++ b/tests/scalers/rabbitmq/rabbitmq_queue_amqp_vhost/rabbitmq_queue_amqp_vhost_test.go @@ -17,7 +17,7 @@ import ( ) // Load environment variables from .env file -var _ = godotenv.Load("../../.env") +var _ = godotenv.Load("../../../.env") const ( testName = "rmq-queue-amqp-vhost-test" @@ -79,7 +79,7 @@ func TestScaler(t *testing.T) { kc := GetKubernetesClient(t) data, templates := getTemplateData() - RMQInstall(t, kc, rmqNamespace, user, password, vhost) + RMQInstall(t, kc, rmqNamespace, user, password, vhost, WithoutOAuth()) CreateKubernetesResources(t, kc, testNamespace, data, templates) assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, deploymentName, testNamespace, 0, 60, 1), @@ -92,7 +92,7 @@ func TestScaler(t *testing.T) { // cleanup t.Log("--- cleaning up ---") DeleteKubernetesResources(t, testNamespace, data, templates) - RMQUninstall(t, rmqNamespace, user, password, vhost) + RMQUninstall(t, rmqNamespace, user, password, vhost, WithoutOAuth()) } func getTemplateData() (templateData, []Template) { diff --git a/tests/scalers/rabbitmq/rabbitmq_queue_http/rabbitmq_queue_http_test.go b/tests/scalers/rabbitmq/rabbitmq_queue_http/rabbitmq_queue_http_test.go index 26749ddd9af..d19c5138956 100644 --- a/tests/scalers/rabbitmq/rabbitmq_queue_http/rabbitmq_queue_http_test.go +++ b/tests/scalers/rabbitmq/rabbitmq_queue_http/rabbitmq_queue_http_test.go @@ -17,7 +17,7 @@ import ( ) // Load environment variables from .env file -var _ = godotenv.Load("../../.env") +var _ = godotenv.Load("../../../.env") const ( testName = "rmq-queue-http-test" @@ -80,7 +80,7 @@ func TestScaler(t *testing.T) { kc := GetKubernetesClient(t) data, templates := getTemplateData() - RMQInstall(t, kc, rmqNamespace, user, password, vhost) + RMQInstall(t, kc, rmqNamespace, user, password, vhost, WithoutOAuth()) CreateKubernetesResources(t, kc, testNamespace, data, templates) assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, deploymentName, testNamespace, 0, 60, 1), @@ -91,7 +91,7 @@ func TestScaler(t *testing.T) { // cleanup t.Log("--- cleaning up ---") DeleteKubernetesResources(t, testNamespace, data, templates) - RMQUninstall(t, rmqNamespace, user, password, vhost) + RMQUninstall(t, rmqNamespace, user, password, vhost, WithoutOAuth()) } func getTemplateData() (templateData, []Template) { diff --git a/tests/scalers/rabbitmq/rabbitmq_queue_http_aad_wi/rabbitmq_queue_http_aad_wi_test.go b/tests/scalers/rabbitmq/rabbitmq_queue_http_aad_wi/rabbitmq_queue_http_aad_wi_test.go new file mode 100644 index 00000000000..6cac37673fe --- /dev/null +++ b/tests/scalers/rabbitmq/rabbitmq_queue_http_aad_wi/rabbitmq_queue_http_aad_wi_test.go @@ -0,0 +1,172 @@ +//go:build e2e +// +build e2e + +package rabbitmq_queue_http_add_wi_test + +import ( + "encoding/base64" + "fmt" + "github.com/stretchr/testify/require" + "os" + "testing" + + "github.com/joho/godotenv" + "github.com/stretchr/testify/assert" + "k8s.io/client-go/kubernetes" + + . "github.com/kedacore/keda/v2/tests/helper" + . "github.com/kedacore/keda/v2/tests/scalers/rabbitmq" +) + +// Load environment variables from .env file +var _ = godotenv.Load("../../../.env") + +const ( + testName = "rmq-queue-http-test-aad-wi" +) + +var ( + testNamespace = fmt.Sprintf("%s-ns", testName) + rmqNamespace = fmt.Sprintf("%s-rmq", testName) + deploymentName = fmt.Sprintf("%s-deployment", testName) + secretName = fmt.Sprintf("%s-secret", testName) + triggerAuthName = fmt.Sprintf("%s-ta", testName) + triggerSecretName = fmt.Sprintf("%s-ta-secret", testName) + scaledObjectName = fmt.Sprintf("%s-so", testName) + queueName = "hello" + user = fmt.Sprintf("%s-user", testName) + password = fmt.Sprintf("%s-password", testName) + vhost = "/" + connectionString = fmt.Sprintf("amqp://%s:%s@rabbitmq.%s.svc.cluster.local/", user, password, rmqNamespace) + httpConnectionString = fmt.Sprintf("http://%s:%s@rabbitmq.%s.svc.cluster.local/", user, password, rmqNamespace) + httpNoAuthConnectionString = fmt.Sprintf("http://rabbitmq.%s.svc.cluster.local/", rmqNamespace) + rabbitAppClientID = os.Getenv("TF_AZURE_RABBIT_API_APPLICATION_ID") + azureADTenantID = os.Getenv("TF_AZURE_SP_TENANT") + messageCount = 100 +) + +const ( + secretTemplate = ` +apiVersion: v1 +kind: Secret +metadata: + name: {{.TriggerSecretName}} + namespace: {{.TestNamespace}} +type: Opaque +data: + workloadIdentityResource: {{.Base64RabbitAppClientId}} +` + + triggerAuthTemplate = ` +apiVersion: keda.sh/v1alpha1 +kind: TriggerAuthentication +metadata: + name: {{.TriggerAuthName}} + namespace: {{.TestNamespace}} +spec: + podIdentity: + provider: azure-workload + + secretTargetRef: + - parameter: workloadIdentityResource + name: {{.TriggerSecretName}} + key: workloadIdentityResource +` + scaledObjectTemplate = ` +apiVersion: keda.sh/v1alpha1 +kind: ScaledObject +metadata: + name: {{.ScaledObjectName}} + namespace: {{.TestNamespace}} +spec: + scaleTargetRef: + name: {{.DeploymentName}} + pollingInterval: 5 + cooldownPeriod: 10 + minReplicaCount: 0 + maxReplicaCount: 4 + triggers: + - type: rabbitmq + metadata: + queueName: {{.QueueName}} + vhostName: {{.VHost}} + host: {{.ConnectionNoAuth}} + protocol: http + mode: QueueLength + value: '10' + authenticationRef: + name: {{.TriggerAuthName}} +` +) + +type templateData struct { + TestNamespace string + DeploymentName string + TriggerSecretName string + TriggerAuthName string + ScaledObjectName string + SecretName string + QueueName string + VHost string + Connection, Base64Connection string + ConnectionNoAuth string + RabbitAppClientId, Base64RabbitAppClientId string +} + +func TestScaler(t *testing.T) { + // setup + t.Log("--- setting up ---") + require.NotEmpty(t, rabbitAppClientID, "TF_AZURE_RABBIT_API_APPLICATION_ID env variable is required for rabbitmq workload identity tests") + require.NotEmpty(t, azureADTenantID, "TF_AZURE_SP_TENANT env variable is required for rabbitmq workload identity tests") + + // Create kubernetes resources + kc := GetKubernetesClient(t) + data, templates := getTemplateData() + + RMQInstall(t, kc, rmqNamespace, user, password, vhost, WithAzureADOAuth(azureADTenantID, rabbitAppClientID)) + CreateKubernetesResources(t, kc, testNamespace, data, templates) + + assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, deploymentName, testNamespace, 0, 60, 1), + "replica count should be 0 after 1 minute") + + testScaling(t, kc) + + // cleanup + t.Log("--- cleaning up ---") + DeleteKubernetesResources(t, testNamespace, data, templates) + RMQUninstall(t, rmqNamespace, user, password, vhost, WithAzureADOAuth(azureADTenantID, rabbitAppClientID)) +} + +func getTemplateData() (templateData, []Template) { + return templateData{ + TestNamespace: testNamespace, + DeploymentName: deploymentName, + ScaledObjectName: scaledObjectName, + SecretName: secretName, + VHost: vhost, + QueueName: queueName, + Connection: connectionString, + Base64Connection: base64.StdEncoding.EncodeToString([]byte(httpConnectionString)), + TriggerAuthName: triggerAuthName, + TriggerSecretName: triggerSecretName, + ConnectionNoAuth: httpNoAuthConnectionString, + RabbitAppClientId: rabbitAppClientID, + Base64RabbitAppClientId: base64.StdEncoding.EncodeToString([]byte(rabbitAppClientID)), + }, []Template{ + {Name: "deploymentTemplate", Config: RMQTargetDeploymentTemplate}, + {Name: "secretTemplate", Config: secretTemplate}, + {Name: "triggerAuthTemplate", Config: triggerAuthTemplate}, + {Name: "scaledObjectTemplate", Config: scaledObjectTemplate}, + } +} + +func testScaling(t *testing.T, kc *kubernetes.Clientset) { + t.Log("--- testing scale out ---") + RMQPublishMessages(t, rmqNamespace, connectionString, queueName, messageCount) + assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, deploymentName, testNamespace, 4, 60, 1), + "replica count should be 4 after 1 minute") + + t.Log("--- testing scale in ---") + assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, deploymentName, testNamespace, 0, 60, 1), + "replica count should be 0 after 1 minute") +} diff --git a/tests/scalers/rabbitmq/rabbitmq_queue_http_regex/rabbitmq_queue_http_regex_test.go b/tests/scalers/rabbitmq/rabbitmq_queue_http_regex/rabbitmq_queue_http_regex_test.go index 16551e57655..da128a85519 100644 --- a/tests/scalers/rabbitmq/rabbitmq_queue_http_regex/rabbitmq_queue_http_regex_test.go +++ b/tests/scalers/rabbitmq/rabbitmq_queue_http_regex/rabbitmq_queue_http_regex_test.go @@ -17,7 +17,7 @@ import ( ) // Load environment variables from .env file -var _ = godotenv.Load("../../.env") +var _ = godotenv.Load("../../../.env") const ( testName = "rmq-queue-http-regex-test" @@ -83,7 +83,7 @@ func TestScaler(t *testing.T) { kc := GetKubernetesClient(t) data, templates := getTemplateData() - RMQInstall(t, kc, rmqNamespace, user, password, vhost) + RMQInstall(t, kc, rmqNamespace, user, password, vhost, WithoutOAuth()) CreateKubernetesResources(t, kc, testNamespace, data, templates) assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, deploymentName, testNamespace, 0, 60, 1), @@ -94,7 +94,7 @@ func TestScaler(t *testing.T) { // cleanup t.Log("--- cleaning up ---") DeleteKubernetesResources(t, testNamespace, data, templates) - RMQUninstall(t, rmqNamespace, user, password, vhost) + RMQUninstall(t, rmqNamespace, user, password, vhost, WithoutOAuth()) } func getTemplateData() (templateData, []Template) { diff --git a/tests/scalers/rabbitmq/rabbitmq_queue_http_regex_aad_wi/rabbitmq_queue_http_regex_aad_wi_test.go b/tests/scalers/rabbitmq/rabbitmq_queue_http_regex_aad_wi/rabbitmq_queue_http_regex_aad_wi_test.go new file mode 100644 index 00000000000..52927a5e763 --- /dev/null +++ b/tests/scalers/rabbitmq/rabbitmq_queue_http_regex_aad_wi/rabbitmq_queue_http_regex_aad_wi_test.go @@ -0,0 +1,178 @@ +//go:build e2e +// +build e2e + +package rabbitmq_queue_http_regex_aad_wi_test + +import ( + "encoding/base64" + "fmt" + "github.com/stretchr/testify/require" + "os" + "testing" + + "github.com/joho/godotenv" + "github.com/stretchr/testify/assert" + "k8s.io/client-go/kubernetes" + + . "github.com/kedacore/keda/v2/tests/helper" + . "github.com/kedacore/keda/v2/tests/scalers/rabbitmq" +) + +// Load environment variables from .env file +var _ = godotenv.Load("../../../.env") + +const ( + testName = "rmq-queue-http-regex-aad-wi-test" +) + +var ( + testNamespace = fmt.Sprintf("%s-ns", testName) + rmqNamespace = fmt.Sprintf("%s-rmq", testName) + deploymentName = fmt.Sprintf("%s-deployment", testName) + secretName = fmt.Sprintf("%s-secret", testName) + triggerAuthName = fmt.Sprintf("%s-ta", testName) + triggerSecretName = fmt.Sprintf("%s-ta-secret", testName) + scaledObjectName = fmt.Sprintf("%s-so", testName) + queueName = "hello" + queueRegex = "^hell.{1}$" + user = fmt.Sprintf("%s-user", testName) + password = fmt.Sprintf("%s-password", testName) + vhost = "/" + connectionString = fmt.Sprintf("amqp://%s:%s@rabbitmq.%s.svc.cluster.local/", user, password, rmqNamespace) + httpConnectionString = fmt.Sprintf("http://%s:%s@rabbitmq.%s.svc.cluster.local/", user, password, rmqNamespace) + httpNoAuthConnectionString = fmt.Sprintf("http://rabbitmq.%s.svc.cluster.local/", rmqNamespace) + rabbitAppClientID = os.Getenv("TF_AZURE_RABBIT_API_APPLICATION_ID") + azureADTenantID = os.Getenv("TF_AZURE_SP_TENANT") + messageCount = 100 +) + +const ( + secretTemplate = ` +apiVersion: v1 +kind: Secret +metadata: + name: {{.TriggerSecretName}} + namespace: {{.TestNamespace}} +type: Opaque +data: + workloadIdentityResource: {{.Base64RabbitAppClientId}} +` + triggerAuthTemplate = ` +apiVersion: keda.sh/v1alpha1 +kind: TriggerAuthentication +metadata: + name: {{.TriggerAuthName}} + namespace: {{.TestNamespace}} +spec: + podIdentity: + provider: azure-workload + + secretTargetRef: + - parameter: workloadIdentityResource + name: {{.TriggerSecretName}} + key: workloadIdentityResource +` + scaledObjectTemplate = ` +apiVersion: keda.sh/v1alpha1 +kind: ScaledObject +metadata: + name: {{.ScaledObjectName}} + namespace: {{.TestNamespace}} +spec: + scaleTargetRef: + name: {{.DeploymentName}} + pollingInterval: 5 + cooldownPeriod: 10 + minReplicaCount: 0 + maxReplicaCount: 4 + triggers: + - type: rabbitmq + metadata: + queueName: {{.QueueName}} + vhostName: {{.VHost}} + host: {{.ConnectionNoAuth}} + protocol: http + mode: QueueLength + value: '10' + useRegex: 'true' + operation: sum + authenticationRef: + name: {{.TriggerAuthName}} +` +) + +type templateData struct { + TestNamespace string + DeploymentName string + TriggerSecretName string + TriggerAuthName string + ScaledObjectName string + SecretName string + QueueName string + VHost string + Connection, Base64Connection string + ConnectionNoAuth string + RabbitAppClientId, Base64RabbitAppClientId string +} + +func TestScaler(t *testing.T) { + // setup + t.Log("--- setting up ---") + require.NotEmpty(t, rabbitAppClientID, "TF_AZURE_RABBIT_API_APPLICATION_ID env variable is required for rabbitmq workload identity tests") + require.NotEmpty(t, azureADTenantID, "TF_AZURE_SP_TENANT env variable is required for rabbitmq workload identity tests") + + // Create kubernetes resources + kc := GetKubernetesClient(t) + data, templates := getTemplateData() + + RMQInstall(t, kc, rmqNamespace, user, password, vhost, WithAzureADOAuth(azureADTenantID, rabbitAppClientID)) + CreateKubernetesResources(t, kc, testNamespace, data, templates) + + assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, deploymentName, testNamespace, 0, 60, 1), + "replica count should be 0 after 1 minute") + + testScaling(t, kc) + + // cleanup + t.Log("--- cleaning up ---") + DeleteKubernetesResources(t, testNamespace, data, templates) + RMQUninstall(t, rmqNamespace, user, password, vhost, WithAzureADOAuth(azureADTenantID, rabbitAppClientID)) +} + +func getTemplateData() (templateData, []Template) { + return templateData{ + TestNamespace: testNamespace, + DeploymentName: deploymentName, + ScaledObjectName: scaledObjectName, + SecretName: secretName, + VHost: vhost, + QueueName: queueRegex, + Connection: connectionString, + Base64Connection: base64.StdEncoding.EncodeToString([]byte(httpConnectionString)), + TriggerAuthName: triggerAuthName, + TriggerSecretName: triggerSecretName, + ConnectionNoAuth: httpNoAuthConnectionString, + RabbitAppClientId: rabbitAppClientID, + Base64RabbitAppClientId: base64.StdEncoding.EncodeToString([]byte(rabbitAppClientID)), + }, []Template{ + {Name: "deploymentTemplate", Config: RMQTargetDeploymentTemplate}, + {Name: "secretTemplate", Config: secretTemplate}, + {Name: "triggerAuthTemplate", Config: triggerAuthTemplate}, + {Name: "scaledObjectTemplate", Config: scaledObjectTemplate}, + } +} + +func testScaling(t *testing.T, kc *kubernetes.Clientset) { + t.Log("--- testing scale out ---") + RMQPublishMessages(t, rmqNamespace, connectionString, queueName, messageCount) + // dummies + RMQPublishMessages(t, rmqNamespace, connectionString, fmt.Sprintf("%s-1", queueName), messageCount) + RMQPublishMessages(t, rmqNamespace, connectionString, fmt.Sprintf("%s-%s", queueName, queueName), messageCount) + + assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, deploymentName, testNamespace, 4, 60, 2), + "replica count should be 4 after 2 minute") + + t.Log("--- testing scale in ---") + assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, deploymentName, testNamespace, 0, 60, 1), + "replica count should be 0 after 1 minute") +} diff --git a/tests/scalers/rabbitmq/rabbitmq_queue_http_regex_vhost/rabbitmq_queue_http_regex_vhost_test.go b/tests/scalers/rabbitmq/rabbitmq_queue_http_regex_vhost/rabbitmq_queue_http_regex_vhost_test.go index 5e8a7f932bd..113d92d3cff 100644 --- a/tests/scalers/rabbitmq/rabbitmq_queue_http_regex_vhost/rabbitmq_queue_http_regex_vhost_test.go +++ b/tests/scalers/rabbitmq/rabbitmq_queue_http_regex_vhost/rabbitmq_queue_http_regex_vhost_test.go @@ -17,7 +17,7 @@ import ( ) // Load environment variables from .env file -var _ = godotenv.Load("../../.env") +var _ = godotenv.Load("../../../.env") const ( testName = "rmq-queue-http-regex-vhost-test" @@ -88,7 +88,7 @@ func TestScaler(t *testing.T) { kc := GetKubernetesClient(t) data, templates := getTemplateData() - RMQInstall(t, kc, rmqNamespace, user, password, vhost) + RMQInstall(t, kc, rmqNamespace, user, password, vhost, WithoutOAuth()) CreateKubernetesResources(t, kc, testNamespace, data, templates) RMQCreateVHost(t, rmqNamespace, connectionHost, user, password, dummyVhost1) @@ -102,7 +102,7 @@ func TestScaler(t *testing.T) { // cleanup t.Log("--- cleaning up ---") DeleteKubernetesResources(t, testNamespace, data, templates) - RMQUninstall(t, rmqNamespace, user, password, vhost) + RMQUninstall(t, rmqNamespace, user, password, vhost, WithoutOAuth()) } func getTemplateData() (templateData, []Template) { diff --git a/tests/scalers/rabbitmq/rabbitmq_queue_http_vhost/rabbitmq_queue_http_vhost_test.go b/tests/scalers/rabbitmq/rabbitmq_queue_http_vhost/rabbitmq_queue_http_vhost_test.go index f7ed7c6a8e6..a6c6963841b 100644 --- a/tests/scalers/rabbitmq/rabbitmq_queue_http_vhost/rabbitmq_queue_http_vhost_test.go +++ b/tests/scalers/rabbitmq/rabbitmq_queue_http_vhost/rabbitmq_queue_http_vhost_test.go @@ -17,7 +17,7 @@ import ( ) // Load environment variables from .env file -var _ = godotenv.Load("../../.env") +var _ = godotenv.Load("../../../.env") const ( testName = "rmq-queue-http-vhost-test" @@ -80,7 +80,7 @@ func TestScaler(t *testing.T) { kc := GetKubernetesClient(t) data, templates := getTemplateData() - RMQInstall(t, kc, rmqNamespace, user, password, vhost) + RMQInstall(t, kc, rmqNamespace, user, password, vhost, WithoutOAuth()) CreateKubernetesResources(t, kc, testNamespace, data, templates) assert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, deploymentName, testNamespace, 0, 60, 1), @@ -91,7 +91,7 @@ func TestScaler(t *testing.T) { // cleanup t.Log("--- cleaning up ---") DeleteKubernetesResources(t, testNamespace, data, templates) - RMQUninstall(t, rmqNamespace, user, password, vhost) + RMQUninstall(t, rmqNamespace, user, password, vhost, WithoutOAuth()) } func getTemplateData() (templateData, []Template) {