Skip to content
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

skip databases that are not available during auto discovery #10699

Merged
merged 9 commits into from
Mar 4, 2022

Conversation

greedy52
Copy link
Contributor

@greedy52 greedy52 commented Mar 1, 2022

Implements #10647

Testing

  • Running RDS instance
  • Stopped RDS instance
  • Running Aurora cluster
  • Stopped Aurora cluster
  • Running Redshift cluster
  • Paused Redshift cluster

@greedy52 greedy52 added aws Used for AWS Related Issues. backport-required database-access Database access related issues and PRs labels Mar 1, 2022
@greedy52 greedy52 self-assigned this Mar 1, 2022
@github-actions github-actions bot requested review from timothyb89 and xacrimon March 1, 2022 17:34
@greedy52 greedy52 marked this pull request as draft March 1, 2022 17:38
@greedy52 greedy52 requested review from r0mant, smallinsky and Tener March 1, 2022 20:06
@greedy52 greedy52 marked this pull request as ready for review March 1, 2022 20:09
@github-actions github-actions bot requested a review from xacrimon March 1, 2022 20:10
// https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/accessing-monitoring.html
switch aws.StringValue(instance.DBInstanceStatus) {

// Statues marked as "Not billed" in the above guide.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Statues marked as "Not billed" in the above guide.
// Statuses marked as "Not billed" in the above guide.

lib/services/database.go Outdated Show resolved Hide resolved
@@ -44,14 +44,17 @@ func TestWatcher(t *testing.T) {
rdsInstance2, _ := makeRDSInstance(t, "instance-2", "us-east-2", map[string]string{"env": "prod"})
rdsInstance3, _ := makeRDSInstance(t, "instance-3", "us-east-1", map[string]string{"env": "dev"})
rdsInstance4, rdsDatabase4 := makeRDSInstance(t, "instance-4", "us-west-1", nil)
rdsInstanceUnavailable, _ := makeRDSInstance(t, "instance-5", "us-west-1", nil, rdsInstanceStatus("stopped"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about adding a test that explicitly verifies the behavior against unrecognized status, like "xxx-this-status-does-not-exist"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

=== RUN   TestWatcher/RDS_unavailable_databases_are_skipped
WARN[0000] Unknown status type: "status-does-not-exist". Assuming RDS instance "instance-5" is available. 
WARN[0000] Unknown status type: "status-does-not-exist". Assuming Aurora cluster "cluster-5" is available. 
=== RUN   TestWatcher/skip_access_denied_errors
=== RUN   TestWatcher/Redshift_labels_matching
=== RUN   TestWatcher/Redshift_unavailable_databases_are_skipped
WARN[0000] Unknown status type: "status-does-not-exist". Assuming Redshift cluster "test" is available. 

@greedy52 greedy52 requested review from Tener and smallinsky March 4, 2022 17:02
Copy link
Contributor

@Tener Tener left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

@greedy52 greedy52 enabled auto-merge (squash) March 4, 2022 18:23
@greedy52 greedy52 merged commit fa33877 into master Mar 4, 2022
@greedy52 greedy52 deleted the STeve/10647_db_auto_discover_skip_stopped branch March 4, 2022 20:37
@webvictim webvictim linked an issue Mar 15, 2022 that may be closed by this pull request
@webvictim webvictim mentioned this pull request Apr 19, 2022
@webvictim webvictim mentioned this pull request Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws Used for AWS Related Issues. backport-required database-access Database access related issues and PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AWS database autodiscovery should exclude stopped RDS instances
4 participants