Skip to content

Commit 977de43

Browse files
committed
use vhostName from authParams when declared
Signed-off-by: Michi U. <[email protected]>
1 parent 2adbc81 commit 977de43

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pkg/scalers/rabbitmq_scaler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ type rabbitMQMetadata struct {
8686
// either http or amqp protocol
8787
Protocol string `keda:"name=protocol, order=triggerMetadata;authParams, optional, default=auto"`
8888
// override the vhost from the connection info
89-
VhostName string `keda:"name=vhostName, order=triggerMetadata, optional"`
89+
VhostName string `keda:"name=vhostName, order=triggerMetadata;authParams, optional"`
9090
// specify if the queueName contains a rexeg
9191
UseRegex bool `keda:"name=useRegex, order=triggerMetadata, optional"`
9292
// specify if the QueueLength value should exclude Unacknowledged messages (Ready messages only)

pkg/scalers/rabbitmq_scaler_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ var testRabbitMQAuthParamData = []parseRabbitMQAuthParamTestData{
161161
{map[string]string{"queueName": "sample", "hostFromEnv": host}, v1alpha1.AuthPodIdentity{}, map[string]string{"username": "user"}, true, rmqTLSDisable, false},
162162
// failure, password but no username
163163
{map[string]string{"queueName": "sample", "hostFromEnv": host}, v1alpha1.AuthPodIdentity{}, map[string]string{"password": "PASSWORD"}, true, rmqTLSDisable, false},
164+
// success, vhostName
165+
{map[string]string{"queueName": "sample", "hostFromEnv": host}, v1alpha1.AuthPodIdentity{}, map[string]string{"vhostName": "myVhost"}, false, rmqTLSDisable, false},
166+
// success, vhostName but empty
167+
{map[string]string{"queueName": "sample", "hostFromEnv": host}, v1alpha1.AuthPodIdentity{}, map[string]string{"vhostName": ""}, false, rmqTLSDisable, false},
164168
// success, username and password from env
165169
{map[string]string{"queueName": "sample", "hostFromEnv": host, "usernameFromEnv": rabbitMQUsername, "passwordFromEnv": rabbitMQPassword}, v1alpha1.AuthPodIdentity{}, map[string]string{}, false, rmqTLSDisable, false},
166170
// failure, username from env but not password

0 commit comments

Comments
 (0)