-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ISSUE: 1585 | Add --wait flag to databases resize command #1590
ISSUE: 1585 | Add --wait flag to databases resize command #1590
Conversation
* added bool flag into resize command * added wait functionality into resize * adjusted test
+ clean up with fmt
+ clean up make go fmt
+ removed test option to make it similar to create command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Yordaniss. Thank you so much for the pull request!
I've left a few comments in-line with suggestions. In addition to that, it would be great to add a new test case to the TestDatabaseResize
test.
doctl/commands/databases_test.go
Line 618 in 6804c7d
func TestDatabaseResize(t *testing.T) { |
Something along the line of:
// Success with wait flag
withTestClient(t, func(config *CmdConfig, tm *tcMocks) {
tm.databases.EXPECT().Resize(testDBCluster.ID, r).Return(nil)
tm.databases.EXPECT().Get(testDBCluster.ID).Return(&testDBCluster, nil)
config.Args = append(config.Args, testDBCluster.ID)
config.Doit.Set(config.NS, doctl.ArgSizeSlug, testDBCluster.SizeSlug)
config.Doit.Set(config.NS, doctl.ArgDatabaseNumNodes, testDBCluster.NumNodes)
config.Doit.Set(config.NS, doctl.ArgDatabaseStorageSizeMib, testDBCluster.StorageSizeMib)
config.Doit.Set(config.NS, doctl.ArgCommandWait, true)
err := RunDatabaseResize(config)
assert.NoError(t, err)
})
Comparing that to the existing tests, you'll see it passes the wait
flag and tests that the Get
method is called by waitForDatabaseReady
when the flag is passed.
Let us know if you have any questions!
+ added new test case with wait flag + simplify logic in function
Hi @andrewsomething thanks a lot for a feedback. I simplified logic and added test case. 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Great work! Thanks again for the contribution!
ISSUE #1585