Skip to content

Commit 1f79351

Browse files
committed
Wire instance_pools into resource-type enumerations and regenerate validation
Fixes CI failures from adding the instance_pools resource: update the workspace-open supported-type lists, skip instance_pools (direct-only) in the Terraform lifecycle test, extend the statemgmt StateToBundle tests for full resource coverage, and regenerate the validation enum/required fields.
1 parent 215fe4d commit 1f79351

5 files changed

Lines changed: 49 additions & 2 deletions

File tree

bundle/deploy/terraform/lifecycle_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ func TestConvertLifecycleForAllResources(t *testing.T) {
1818
"catalogs",
1919
"external_locations",
2020
"genie_spaces",
21+
"instance_pools",
2122
"job_runs",
2223
"vector_search_endpoints",
2324
"vector_search_indexes",

bundle/internal/validation/generated/enum_fields.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/internal/validation/generated/required_fields.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/statemgmt/state_load_test.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ func TestStateToBundleEmptyLocalResources(t *testing.T) {
5757
"resources.postgres_synced_tables.test_postgres_synced_table": {ID: "synced_tables/main.public.test_synced_table"},
5858
"resources.vector_search_endpoints.test_vector_search_endpoint": {ID: "vs-endpoint-1"},
5959
"resources.vector_search_indexes.test_vector_search_index": {ID: "vs-index-1"},
60+
"resources.instance_pools.test_instance_pool": {ID: "1"},
6061
}
6162
err := StateToBundle(t.Context(), state, &config)
6263
assert.NoError(t, err)
@@ -149,6 +150,9 @@ func TestStateToBundleEmptyLocalResources(t *testing.T) {
149150
assert.Equal(t, "vs-index-1", config.Resources.VectorSearchIndexes["test_vector_search_index"].ID)
150151
assert.Equal(t, resources.ModifiedStatusDeleted, config.Resources.VectorSearchIndexes["test_vector_search_index"].ModifiedStatus)
151152

153+
assert.Equal(t, "1", config.Resources.InstancePools["test_instance_pool"].ID)
154+
assert.Equal(t, resources.ModifiedStatusDeleted, config.Resources.InstancePools["test_instance_pool"].ModifiedStatus)
155+
152156
AssertFullResourceCoverage(t, &config)
153157
}
154158

@@ -378,6 +382,13 @@ func TestStateToBundleEmptyRemoteResources(t *testing.T) {
378382
},
379383
},
380384
},
385+
InstancePools: map[string]*resources.InstancePool{
386+
"test_instance_pool": {
387+
CreateInstancePool: compute.CreateInstancePool{
388+
InstancePoolName: "test_instance_pool",
389+
},
390+
},
391+
},
381392
},
382393
}
383394

@@ -477,6 +488,9 @@ func TestStateToBundleEmptyRemoteResources(t *testing.T) {
477488
assert.Empty(t, config.Resources.VectorSearchIndexes["test_vector_search_index"].ID)
478489
assert.Equal(t, resources.ModifiedStatusCreated, config.Resources.VectorSearchIndexes["test_vector_search_index"].ModifiedStatus)
479490

491+
assert.Empty(t, config.Resources.InstancePools["test_instance_pool"].ID)
492+
assert.Equal(t, resources.ModifiedStatusCreated, config.Resources.InstancePools["test_instance_pool"].ModifiedStatus)
493+
480494
AssertFullResourceCoverage(t, &config)
481495
}
482496

@@ -856,6 +870,18 @@ func TestStateToBundleModifiedResources(t *testing.T) {
856870
},
857871
},
858872
},
873+
InstancePools: map[string]*resources.InstancePool{
874+
"test_instance_pool": {
875+
CreateInstancePool: compute.CreateInstancePool{
876+
InstancePoolName: "test_instance_pool",
877+
},
878+
},
879+
"test_instance_pool_new": {
880+
CreateInstancePool: compute.CreateInstancePool{
881+
InstancePoolName: "test_instance_pool_new",
882+
},
883+
},
884+
},
859885
},
860886
}
861887
state := ExportedResourcesMap{
@@ -913,6 +939,8 @@ func TestStateToBundleModifiedResources(t *testing.T) {
913939
"resources.vector_search_endpoints.test_vector_search_endpoint_old": {ID: "vs-endpoint-old"},
914940
"resources.vector_search_indexes.test_vector_search_index": {ID: "vs-index-1"},
915941
"resources.vector_search_indexes.test_vector_search_index_old": {ID: "vs-index-old"},
942+
"resources.instance_pools.test_instance_pool": {ID: "1"},
943+
"resources.instance_pools.test_instance_pool_old": {ID: "2"},
916944
}
917945
err := StateToBundle(t.Context(), state, &config)
918946
assert.NoError(t, err)
@@ -1108,6 +1136,13 @@ func TestStateToBundleModifiedResources(t *testing.T) {
11081136
assert.Empty(t, config.Resources.VectorSearchIndexes["test_vector_search_index_new"].ID)
11091137
assert.Equal(t, resources.ModifiedStatusCreated, config.Resources.VectorSearchIndexes["test_vector_search_index_new"].ModifiedStatus)
11101138

1139+
assert.Equal(t, "1", config.Resources.InstancePools["test_instance_pool"].ID)
1140+
assert.Empty(t, config.Resources.InstancePools["test_instance_pool"].ModifiedStatus)
1141+
assert.Equal(t, "2", config.Resources.InstancePools["test_instance_pool_old"].ID)
1142+
assert.Equal(t, resources.ModifiedStatusDeleted, config.Resources.InstancePools["test_instance_pool_old"].ModifiedStatus)
1143+
assert.Empty(t, config.Resources.InstancePools["test_instance_pool_new"].ID)
1144+
assert.Equal(t, resources.ModifiedStatusCreated, config.Resources.InstancePools["test_instance_pool_new"].ModifiedStatus)
1145+
11111146
AssertFullResourceCoverage(t, &config)
11121147
}
11131148

cmd/experimental/workspace_open_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func TestBuildWorkspaceURLFragmentBasedResources(t *testing.T) {
6767
func TestBuildWorkspaceURLUnknownResourceType(t *testing.T) {
6868
_, err := workspaceurls.BuildResourceURL("https://myworkspace.databricks.com", "unknown", "123", "")
6969
assert.ErrorContains(t, err, "unknown resource type \"unknown\"")
70-
assert.ErrorContains(t, err, "alerts, apps, catalogs, clusters, dashboards, database_catalogs, database_instances, experiments, genie_spaces, jobs, model_serving_endpoints, models, notebooks, pipelines, postgres_catalogs, postgres_synced_tables, quality_monitors, queries, registered_models, schemas, synced_database_tables, vector_search_endpoints, vector_search_indexes, volumes, warehouses")
70+
assert.ErrorContains(t, err, "alerts, apps, catalogs, clusters, dashboards, database_catalogs, database_instances, experiments, genie_spaces, instance_pools, jobs, model_serving_endpoints, models, notebooks, pipelines, postgres_catalogs, postgres_synced_tables, quality_monitors, queries, registered_models, schemas, synced_database_tables, vector_search_endpoints, vector_search_indexes, volumes, warehouses")
7171
}
7272

7373
func TestBuildWorkspaceURLHostWithTrailingSlash(t *testing.T) {
@@ -116,6 +116,7 @@ func TestWorkspaceOpenCommandCompletion(t *testing.T) {
116116
"database_instances",
117117
"experiments",
118118
"genie_spaces",
119+
"instance_pools",
119120
"jobs",
120121
"model_serving_endpoints",
121122
"models",
@@ -146,7 +147,7 @@ func TestWorkspaceOpenCommandCompletionSecondArg(t *testing.T) {
146147
func TestWorkspaceOpenCommandHelpText(t *testing.T) {
147148
cmd := newWorkspaceOpenCommand()
148149

149-
assert.Contains(t, cmd.Long, "Supported resource types: alerts, apps, catalogs, clusters, dashboards, database_catalogs, database_instances, experiments, genie_spaces, jobs, model_serving_endpoints, models, notebooks, pipelines, postgres_catalogs, postgres_synced_tables, quality_monitors, queries, registered_models, schemas, synced_database_tables, vector_search_endpoints, vector_search_indexes, volumes, warehouses.")
150+
assert.Contains(t, cmd.Long, "Supported resource types: alerts, apps, catalogs, clusters, dashboards, database_catalogs, database_instances, experiments, genie_spaces, instance_pools, jobs, model_serving_endpoints, models, notebooks, pipelines, postgres_catalogs, postgres_synced_tables, quality_monitors, queries, registered_models, schemas, synced_database_tables, vector_search_endpoints, vector_search_indexes, volumes, warehouses.")
150151
assert.Contains(t, cmd.Long, "databricks experimental open jobs 123456789")
151152
assert.Contains(t, cmd.Long, "databricks experimental open notebooks /Users/user@example.com/my-notebook")
152153
assert.Contains(t, cmd.Long, "databricks experimental open registered_models catalog.schema.my_model")

0 commit comments

Comments
 (0)