-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
👍 plus a couple questions.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_, err = db.DeleteUser(context.Background(), deleteReq) | |
_, err = db.DeleteUser(ctx, deleteReq) |
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.
Done
} | ||
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious why assertCreds()
needs a retry with backoff, but assertNoCreds()
doesn't.
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.
Because I neglected to put it in assertNoCreds
.
Overview
Updates the Cassandra Database plugin to adhere to the v5 Database interface.
Prerequisites