Skip to content

Commit

Permalink
Fix mongdb e2e tests (#2140)
Browse files Browse the repository at this point in the history
Signed-off-by: jorturfer <jorge_turrado@hotmail.es>
  • Loading branch information
Jorge Turrado Ferrero authored Oct 4, 2021
1 parent 5b71044 commit 526f025
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/scalers/mongo_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func NewMongoDBScaler(config *ScalerConfig) (Scaler, error) {

func parseMongoDBMetadata(config *ScalerConfig) (*mongoDBMetadata, string, error) {
var connStr string
var err error
// setting default metadata
meta := mongoDBMetadata{}

Expand All @@ -124,6 +125,11 @@ func parseMongoDBMetadata(config *ScalerConfig) (*mongoDBMetadata, string, error
return nil, "", fmt.Errorf("no queryValue given")
}

meta.dbName, err = GetFromAuthOrMeta(config, "dbName")
if err != nil {
return nil, "", err
}

// Resolve connectionString
switch {
case config.AuthParams["connectionString"] != "":
Expand All @@ -132,17 +138,11 @@ func parseMongoDBMetadata(config *ScalerConfig) (*mongoDBMetadata, string, error
meta.connectionString = config.ResolvedEnv[config.TriggerMetadata["connectionStringFromEnv"]]
default:
meta.connectionString = ""
var err error
meta.host, err = GetFromAuthOrMeta(config, "host")
if err != nil {
return nil, "", err
}

meta.dbName, err = GetFromAuthOrMeta(config, "dbName")
if err != nil {
return nil, "", err
}

meta.port, err = GetFromAuthOrMeta(config, "port")
if err != nil {
return nil, "", err
Expand Down

0 comments on commit 526f025

Please sign in to comment.