-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[v9.1 backport] Updates tsh ls
for node/app/db/kube to accept new filter flags
#11016
Conversation
tsh ls
for node/app/db/kube to accept new filter flags (#10…tsh ls
for node/app/db/kube to accept new filter flags
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.
Is there another PR for the docs for this (and the corresponding tctl
changes)?
@espadolini this is the docs PR: #11012 |
lib/client/api.go
Outdated
return proxyClient.GetDatabaseServers(ctx, tc.Namespace) | ||
|
||
filter := customFilter | ||
if customFilter == 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.
if customFilter == nil { | |
if filter == nil { |
The end result is equivalent, but you're trying to set filter
if not already set, so I think this check is easier to reason about.
lib/client/api_test.go
Outdated
func TestParseSearchKeywords(t *testing.T) { | ||
t.Parallel() | ||
|
||
expected := [][]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.
Can you make expected
a field of the testCases
anonymous struct?
When writing a new test it's nice to see the input and expected output together, rather than updating them in two separate places.
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.
sorry zac, i wasn't sure what you meant by updating them in two places
? the expected values should not change? i put it out b/c they are the same expects for each tests that test with similar inputs but with different delimiters.
This is what it looks like if something does not match (which looks easy to understand, to me at least):
maybe my test is confusing? should i create individual tests for each delimiter?
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 separated the test to make it easier to understand: 1adccd8
lib/client/api_test.go
Outdated
for _, tc := range testCases { | ||
tc := tc | ||
t.Run(tc.name, func(t *testing.T) { | ||
t.Parallel() |
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 would remove the parallel here, and then there's no need for the tc := tc
line.
These tests will be super fast (they're pure computation, no network calls or anything that can block), so no need to further parallelize them.
lib/client/client.go
Outdated
|
||
resources, err := client.GetResourcesWithFilters(ctx, site, req) | ||
if err != nil { | ||
// ListResources for nodes not availalbe, provide fallback. |
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.
// ListResources for nodes not availalbe, provide fallback. | |
// ListResources for nodes not available, provide fallback. |
lib/client/client.go
Outdated
@@ -663,13 +717,32 @@ func (proxy *ProxyClient) DeleteAppSession(ctx context.Context, sessionID string | |||
return nil | |||
} | |||
|
|||
// GetDatabaseServers returns all registered database proxy servers. | |||
func (proxy *ProxyClient) GetDatabaseServers(ctx context.Context, namespace string) ([]types.DatabaseServer, error) { | |||
// FindDatabaseServersByFilters returns all registered database proxy servers. |
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.
// FindDatabaseServersByFilters returns all registered database proxy servers. | |
// FindDatabaseServersByFilters returns registered database proxy servers that match the provided filter. |
Technically it doesn't return all database servers.
bf8095d
to
d63e507
Compare
Addressing minor code reviews received on a backport (mostly grammer fixes and updating a test)
Backport #10980 to branch/v9
Before Merge
v9.1
release)