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

Validate metastore_id field in worspace UC resources #3035

Merged
merged 7 commits into from
Dec 15, 2023

Conversation

hectorcast-db
Copy link
Contributor

@hectorcast-db hectorcast-db commented Dec 15, 2023

Changes

Validate metastore_id field in worspace UC resources

Tests

  • make test run locally
  • relevant change in docs/ folder
  • covered with integration tests in internal/acceptance
  • relevant acceptance tests are passing
  • using Go SDK

@hectorcast-db hectorcast-db requested review from a team as code owners December 15, 2023 13:07
@hectorcast-db hectorcast-db requested review from mgyucht and removed request for a team December 15, 2023 13:07
@codecov-commenter
Copy link

codecov-commenter commented Dec 15, 2023

Codecov Report

Merging #3035 (db1636c) into master (dcc95c3) will decrease coverage by 0.16%.
The diff coverage is 52.94%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3035      +/-   ##
==========================================
- Coverage   84.32%   84.16%   -0.16%     
==========================================
  Files         158      159       +1     
  Lines       13833    13897      +64     
==========================================
+ Hits        11664    11696      +32     
- Misses       1517     1533      +16     
- Partials      652      668      +16     
Files Coverage Δ
catalog/resource_artifact_allowlist.go 82.14% <100.00%> (+2.14%) ⬆️
catalog/utils.go 100.00% <100.00%> (ø)
catalog/resource_catalog.go 64.86% <55.55%> (-0.83%) ⬇️
catalog/resource_connection.go 67.64% <33.33%> (-3.33%) ⬇️
catalog/resource_external_location.go 73.91% <33.33%> (-6.09%) ⬇️
catalog/resource_metastore.go 84.61% <40.00%> (-5.75%) ⬇️
catalog/resource_schema.go 74.46% <33.33%> (-4.36%) ⬇️
catalog/resource_storage_credential.go 49.49% <40.00%> (-2.16%) ⬇️

@@ -56,7 +56,7 @@ func TestResourceCredentialsCreate(t *testing.T) {
})
}

func TestAccountIdOnlyInState(t *testing.T) {
func TestCredentialsAccountIdOnlyInState(t *testing.T) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unrelated, but since the name starts with TestAcc it runs on the integration tests an fails due to the fixture.

@@ -25,6 +25,7 @@ resource "databricks_catalog" "sandbox" {
The following arguments are required:

* `name` - Name of Catalog relative to parent metastore.
* `metastore_id` - (Required if changing the metastore assigned to a workspace) If set, it must match the ID of the metastore assigned to the worspace. If not set, the current ID is exported.
Copy link
Contributor

Choose a reason for hiding this comment

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

the statement (Required if changing the metastore assigned to a workspace) will likely cause confusion - let's just mention it in the troubleshooting guide

Copy link
Contributor

Choose a reason for hiding this comment

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

+1. IMO we don't need to show this to customers explicitly; the happy path would be not to specify the metastore ID, I think. Once these resources are available at the account-level, we'll change the docs to match what you've done for storage credentials.

Copy link
Contributor

@nkvuong nkvuong left a comment

Choose a reason for hiding this comment

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

just a couple of nits

Copy link
Contributor

Choose a reason for hiding this comment

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

we should also remove metastore_id = databricks_metastore.this.id from the example usage (and any other docs)

Copy link
Contributor

@mgyucht mgyucht left a comment

Choose a reason for hiding this comment

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

Awesome, thanks for fixing so quickly! One small test nit/question, and let's align on how we want to (not) document this (not) feature.

comment = "c"
owner = "administrators"
`,
}.ApplyNoError(t)
Copy link
Contributor

Choose a reason for hiding this comment

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

For sanity, let's make sure the metastore ID is updated properly?

"github.com/databricks/databricks-sdk-go"
)

func validateMetastoreId(ctx context.Context, w *databricks.WorkspaceClient, metastoreId string) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: add a small doccomment here explaining the purpose of this and where it should be added (e.g. all create/update/delete methods for UC resources that accept a metastore_id parameter).

@@ -25,6 +25,7 @@ resource "databricks_catalog" "sandbox" {
The following arguments are required:

* `name` - Name of Catalog relative to parent metastore.
* `metastore_id` - (Required if changing the metastore assigned to a workspace) If set, it must match the ID of the metastore assigned to the worspace. If not set, the current ID is exported.
Copy link
Contributor

Choose a reason for hiding this comment

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

+1. IMO we don't need to show this to customers explicitly; the happy path would be not to specify the metastore ID, I think. Once these resources are available at the account-level, we'll change the docs to match what you've done for storage credentials.

@hectorcast-db hectorcast-db added this pull request to the merge queue Dec 15, 2023
@hectorcast-db hectorcast-db removed this pull request from the merge queue due to a manual request Dec 15, 2023
@hectorcast-db hectorcast-db added this pull request to the merge queue Dec 15, 2023
Merged via the queue into master with commit 2359eb0 Dec 15, 2023
7 checks passed
@hectorcast-db hectorcast-db deleted the validate-metastore-id branch December 15, 2023 14:27
@tanmay-db tanmay-db mentioned this pull request Dec 19, 2023
5 tasks
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.

None yet

4 participants