diff --git a/pkg/scalers/rabbitmq_scaler.go b/pkg/scalers/rabbitmq_scaler.go index 43a62a404ee..e0e7a10ad7f 100644 --- a/pkg/scalers/rabbitmq_scaler.go +++ b/pkg/scalers/rabbitmq_scaler.go @@ -86,7 +86,7 @@ type rabbitMQMetadata struct { // either http or amqp protocol Protocol string `keda:"name=protocol, order=triggerMetadata;authParams, optional, default=auto"` // override the vhost from the connection info - VhostName string `keda:"name=vhostName, order=triggerMetadata, optional"` + VhostName string `keda:"name=vhostName, order=triggerMetadata;authParams, optional"` // specify if the queueName contains a rexeg UseRegex bool `keda:"name=useRegex, order=triggerMetadata, optional"` // specify if the QueueLength value should exclude Unacknowledged messages (Ready messages only) diff --git a/pkg/scalers/rabbitmq_scaler_test.go b/pkg/scalers/rabbitmq_scaler_test.go index ed1785e5be3..a75412fea62 100644 --- a/pkg/scalers/rabbitmq_scaler_test.go +++ b/pkg/scalers/rabbitmq_scaler_test.go @@ -161,6 +161,10 @@ var testRabbitMQAuthParamData = []parseRabbitMQAuthParamTestData{ {map[string]string{"queueName": "sample", "hostFromEnv": host}, v1alpha1.AuthPodIdentity{}, map[string]string{"username": "user"}, true, rmqTLSDisable, false}, // failure, password but no username {map[string]string{"queueName": "sample", "hostFromEnv": host}, v1alpha1.AuthPodIdentity{}, map[string]string{"password": "PASSWORD"}, true, rmqTLSDisable, false}, + // success, vhostName + {map[string]string{"queueName": "sample", "hostFromEnv": host}, v1alpha1.AuthPodIdentity{}, map[string]string{"vhostName": "myVhost"}, false, rmqTLSDisable, false}, + // success, vhostName but empty + {map[string]string{"queueName": "sample", "hostFromEnv": host}, v1alpha1.AuthPodIdentity{}, map[string]string{"vhostName": ""}, false, rmqTLSDisable, false}, // success, username and password from env {map[string]string{"queueName": "sample", "hostFromEnv": host, "usernameFromEnv": rabbitMQUsername, "passwordFromEnv": rabbitMQPassword}, v1alpha1.AuthPodIdentity{}, map[string]string{}, false, rmqTLSDisable, false}, // failure, username from env but not password