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

[CC-52142] Add tests for data sources and resource import #146

Merged
merged 1 commit into from
Jul 28, 2023
Merged

Conversation

erademacher
Copy link
Contributor

Made sure all resources and data sources have tests. Added import steps to resources that didn't already have one.

Commit checklist

  • [n/a] Changelog
  • [n/a] Doc gen (make generate)
  • Integration test(s)
  • Acceptance test(s)
  • [n/a] Example(s)

Copy link

@sjbarag sjbarag left a comment

Choose a reason for hiding this comment

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

Looks great @erademacher! Thanks again for the walkthrough yesterday 😄

(It is, alas, 2023 so we should probably get the license headers in this PR updated. Approved on the assumption you'll do that before you merge.)

@@ -0,0 +1,121 @@
/*
Copyright 2022 The Cockroach Authors
Copy link

Choose a reason for hiding this comment

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

nit: it is unfortunately 2023 🕐

where do the years go 😢

)

// TestAccClusterCertResource attempts to download a cluster's cert.
// It will be skipped if TF_ACC isn't set.
Copy link

Choose a reason for hiding this comment

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

Thanks for the reminder! It's super helpful :)

},
}

db, sqlUser, os := "testdb", "test", "MAC"
Copy link

Choose a reason for hiding this comment

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

I dunno why I've never thought to do this, but it makes so much sense 🤯


func testConnectionStringDataSource(t *testing.T, clusterName string, useMock bool) {
connectStrDataSourceName := "data.cockroach_connection_string.test"
sqlPassword := "hunter2"
Copy link

Choose a reason for hiding this comment

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

erm, all I see is sqlPassword := "*******". Is github smart enough to know that hunter2 is your password and show me ******* instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I was a little worried after I realized that I used my actual 1Password master password here, but then I remembered that GitHub's got my back

Made sure all resources and data sources have tests. Added import
steps to resources that didn't already have one.
@erademacher
Copy link
Contributor Author

TFTR! I'll make a followup to update the rest of the boilerplate.

@erademacher erademacher merged commit 1cfc45f into main Jul 28, 2023
3 checks passed
@erademacher erademacher deleted the tests branch July 28, 2023 17:41
@jenngeorge
Copy link
Contributor

also LGTM !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants