DBPW - Update Cassandra to adhere to v5 Database interface#10051
Conversation
0fcaa61 to
76d5afc
Compare
76d5afc to
71a1b2c
Compare
| m := map[string]string{ | ||
| "username": req.Username, | ||
| } | ||
| err := session. |
There was a problem hiding this comment.
This is purely stylistic, but I don't think we tend to break chained function calls into multiple lines unless that's broken out by a multi-line struct declaration in the function's input param. Breaking out object's instantiation field values into multiple lines, like with m above, is fine though.
There was a problem hiding this comment.
I ended up doing this because the line was getting fairly long with a lot of parenthesis. I can change it back if you want though.
|
|
||
| c.rawConfig["password"] = password | ||
| return c.rawConfig, nil | ||
| return newdbplugin.DeleteUserResponse{}, result.ErrorOrNil() |
There was a problem hiding this comment.
Meant to ask this offline earlier, but can you remind me why the interface doesn't return pointer response values so that we can return nil?
There was a problem hiding this comment.
There isn't a particular need to do so. Plus it opens up the problem of having to do nil checks in other parts of the code and having some potentially inconsistent or confusing behavior.
| err = db.RevokeUser(context.Background(), statements, username) | ||
| ctx, cancel = context.WithTimeout(context.Background(), 5*time.Second) | ||
| defer cancel() | ||
| _, err = db.DeleteUser(context.Background(), deleteReq) |
There was a problem hiding this comment.
| _, err = db.DeleteUser(context.Background(), deleteReq) | |
| _, err = db.DeleteUser(ctx, deleteReq) |
| } | ||
|
|
||
| func testCredsExist(address string, port int, username, password string) error { | ||
| func assertNoCreds(t testing.TB, address string, port int, username, password string) { |
There was a problem hiding this comment.
I'm curious why assertCreds() needs a retry with backoff, but assertNoCreds() doesn't.
There was a problem hiding this comment.
Because I neglected to put it in assertNoCreds.
* update skipped tests and remove an unused test * update how event is triggered to reduce flakiness * remove test * Revert "remove test" This reverts commit 8d166994fb83f2030ac7b50ef125a48f030b80d3. * wait for tooltip to render * remove test Co-authored-by: lane-wetmore <lane.wetmore@hashicorp.com>
Overview
Updates the Cassandra Database plugin to adhere to the v5 Database interface.
Prerequisites