Skip to content

Commit

Permalink
use mongodb as a slug
Browse files Browse the repository at this point in the history
  • Loading branch information
loosla committed Sep 18, 2024
1 parent f879aca commit 5aa07c1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
24 changes: 12 additions & 12 deletions commands/databases.go
Original file line number Diff line number Diff line change
Expand Up @@ -2494,13 +2494,13 @@ func RunDatabaseConfigurationGet(c *CmdConfig) error {
}

allowedEngines := map[string]any{
"mysql": nil,
"pg": nil,
"redis": nil,
"mongo": nil,
"mysql": nil,
"pg": nil,
"redis": nil,
"mongodb": nil,
}
if _, ok := allowedEngines[engine]; !ok {
return fmt.Errorf("(%s) command: engine must be one of: 'pg', 'mysql', 'redis', 'mongo'", c.NS)
return fmt.Errorf("(%s) command: engine must be one of: 'pg', 'mysql', 'redis', 'mongodb'", c.NS)
}

dbId := args[0]
Expand Down Expand Up @@ -2534,7 +2534,7 @@ func RunDatabaseConfigurationGet(c *CmdConfig) error {
RedisConfig: *config,
}
return c.Display(&displayer)
} else if engine == "mongo" {
} else if engine == "mongodb" {
config, err := c.Databases().GetMongoDBConfiguration(dbId)
if err != nil {
return err
Expand Down Expand Up @@ -2564,13 +2564,13 @@ func RunDatabaseConfigurationUpdate(c *CmdConfig) error {
}

allowedEngines := map[string]any{
"mysql": nil,
"pg": nil,
"redis": nil,
"mongo": nil,
"mysql": nil,
"pg": nil,
"redis": nil,
"mongodb": nil,
}
if _, ok := allowedEngines[engine]; !ok {
return fmt.Errorf("(%s) command: engine must be one of: 'pg', 'mysql', 'redis', 'mongo'", c.NS)
return fmt.Errorf("(%s) command: engine must be one of: 'pg', 'mysql', 'redis', 'mongodb'", c.NS)
}

configJson, err := c.Doit.GetString(c.NS, doctl.ArgDatabaseConfigJson)
Expand All @@ -2594,7 +2594,7 @@ func RunDatabaseConfigurationUpdate(c *CmdConfig) error {
if err != nil {
return err
}
} else if engine == "mongo" {
} else if engine == "mongodb" {
err := c.Databases().UpdateMongoDBConfiguration(dbId, configJson)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions commands/databases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1659,7 +1659,7 @@ func TestDatabaseConfigurationGet(t *testing.T) {
withTestClient(t, func(config *CmdConfig, tm *tcMocks) {
tm.databases.EXPECT().GetMongoDBConfiguration(testDBCluster.ID).Return(&testMongoDBConfiguration, nil)
config.Args = append(config.Args, testDBCluster.ID)
config.Doit.Set(config.NS, doctl.ArgDatabaseEngine, "mongo")
config.Doit.Set(config.NS, doctl.ArgDatabaseEngine, "mongodb")

err := RunDatabaseConfigurationGet(config)

Expand Down Expand Up @@ -1723,7 +1723,7 @@ func TestDatabaseConfigurationUpdate(t *testing.T) {
withTestClient(t, func(config *CmdConfig, tm *tcMocks) {
tm.databases.EXPECT().UpdateMongoDBConfiguration(testDBCluster.ID, "").Return(nil)
config.Args = append(config.Args, testDBCluster.ID)
config.Doit.Set(config.NS, doctl.ArgDatabaseEngine, "mongo")
config.Doit.Set(config.NS, doctl.ArgDatabaseEngine, "mongodb")

err := RunDatabaseConfigurationUpdate(config)

Expand Down
2 changes: 1 addition & 1 deletion integration/database_config_get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ var _ = suite("database/config/get", func(t *testing.T, when spec.G, it spec.S)
}

w.Write([]byte(databaseConfigRedisGetResponse))
case "/v2/databases/mongo-database-id/config":
case "/v2/databases/mongodb-database-id/config":
auth := req.Header.Get("Authorization")
if auth != "Bearer some-magic-token" {
w.WriteHeader(http.StatusTeapot)
Expand Down
8 changes: 4 additions & 4 deletions integration/database_config_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ var _ = suite("database/config/get", func(t *testing.T, when spec.G, it spec.S)
expect.Equal(expected, strings.TrimSpace(string(b)))

w.WriteHeader(http.StatusOK)
case "/v2/databases/mongo-database-id/config":
case "/v2/databases/mongodb-database-id/config":
auth := req.Header.Get("Authorization")
if auth != "Bearer some-magic-token" {
w.WriteHeader(http.StatusTeapot)
Expand Down Expand Up @@ -174,15 +174,15 @@ var _ = suite("database/config/get", func(t *testing.T, when spec.G, it spec.S)
})

when("all required flags are passed", func() {
it("updates the mongo database config", func() {
it("updates the mongodb database config", func() {
cmd := exec.Command(builtBinaryPath,
"-t", "some-magic-token",
"-u", server.URL,
"database",
"configuration",
"update",
"--engine", "mongo",
"mongo-database-id",
"--engine", "mongodb",
"mongodb-database-id",
"--config-json", `{"verbosity":2}`,
)

Expand Down

0 comments on commit 5aa07c1

Please sign in to comment.