Skip to content

Commit 2a5c9e1

Browse files
authored
rm user as req field in databases pool requests (#1205)
1 parent f5c0a04 commit 2a5c9e1

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

commands/databases.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ Connection pools can be created and deleted with these commands, or you can simp
809809

810810
connectionPoolDetails := `
811811
812-
- The username of the database user account that the connection pool uses
812+
- The database user that the connection pool uses. When excluded, all connections to the database use the inbound user.
813813
- The name of the connection pool
814814
- The size of the connection pool, i.e. the number of connections that will be allocated
815815
- The database within the cluster for which the connection pool is used
@@ -850,7 +850,7 @@ We recommend starting with a pool size of about half your available connections
850850
AddIntFlag(cmdDatabasePoolCreate, doctl.ArgSizeSlug, "", 0, "pool size",
851851
requiredOpt())
852852
AddStringFlag(cmdDatabasePoolCreate, doctl.ArgDatabasePoolUserName, "", "",
853-
"The username for the database user", requiredOpt())
853+
"The username for the database user")
854854
AddStringFlag(cmdDatabasePoolCreate, doctl.ArgDatabasePoolDBName, "", "",
855855
"The name of the specific database within the database cluster", requiredOpt())
856856

commands/databases_test.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,43 @@ func TestDatabasePoolCreate(t *testing.T) {
742742
})
743743
}
744744

745+
func TestDatabasePoolCreate_InboundUser(t *testing.T) {
746+
pool := *(testDBPool.DatabasePool)
747+
pool.Connection = nil
748+
749+
r := &godo.DatabaseCreatePoolRequest{
750+
Name: pool.Name,
751+
Mode: pool.Mode,
752+
Size: pool.Size,
753+
Database: pool.Database,
754+
}
755+
756+
// Successful call
757+
withTestClient(t, func(config *CmdConfig, tm *tcMocks) {
758+
tm.databases.EXPECT().CreatePool(testDBCluster.ID, r).Return(&testDBPool, nil)
759+
760+
config.Args = append(config.Args, testDBCluster.ID, testDBPool.Name)
761+
config.Doit.Set(config.NS, doctl.ArgDatabasePoolDBName, testDB.Name)
762+
config.Doit.Set(config.NS, doctl.ArgDatabasePoolMode, testDBPool.Mode)
763+
config.Doit.Set(config.NS, doctl.ArgDatabasePoolSize, testDBPool.Size)
764+
765+
err := RunDatabasePoolCreate(config)
766+
assert.NoError(t, err)
767+
})
768+
769+
// Error
770+
withTestClient(t, func(config *CmdConfig, tm *tcMocks) {
771+
tm.databases.EXPECT().CreatePool(
772+
testDBCluster.ID,
773+
gomock.AssignableToTypeOf(&godo.DatabaseCreatePoolRequest{}),
774+
).Return(nil, errTest)
775+
776+
config.Args = append(config.Args, testDBCluster.ID, testDBPool.Name)
777+
err := RunDatabasePoolCreate(config)
778+
assert.EqualError(t, err, "error")
779+
})
780+
}
781+
745782
func TestDatabasesPoolDelete(t *testing.T) {
746783
// Successful
747784
withTestClient(t, func(config *CmdConfig, tm *tcMocks) {

0 commit comments

Comments
 (0)