diff --git a/bundle/apps/interpolate_variables_test.go b/bundle/apps/interpolate_variables_test.go index b6c424a955..c9eb44fa11 100644 --- a/bundle/apps/interpolate_variables_test.go +++ b/bundle/apps/interpolate_variables_test.go @@ -17,7 +17,7 @@ func TestAppInterpolateVariables(t *testing.T) { Resources: config.Resources{ Apps: map[string]*resources.App{ "my_app_1": { - App: &apps.App{ + App: apps.App{ Name: "my_app_1", }, Config: map[string]any{ @@ -28,7 +28,7 @@ func TestAppInterpolateVariables(t *testing.T) { }, }, "my_app_2": { - App: &apps.App{ + App: apps.App{ Name: "my_app_2", }, }, diff --git a/bundle/apps/upload_config_test.go b/bundle/apps/upload_config_test.go index 1087508f2a..cf481336cb 100644 --- a/bundle/apps/upload_config_test.go +++ b/bundle/apps/upload_config_test.go @@ -37,7 +37,7 @@ func TestAppUploadConfig(t *testing.T) { Resources: config.Resources{ Apps: map[string]*resources.App{ "my_app": { - App: &apps.App{ + App: apps.App{ Name: "my_app", }, SourceCodePath: "./my_app", diff --git a/bundle/apps/validate_test.go b/bundle/apps/validate_test.go index d218f96ca0..639137dfb6 100644 --- a/bundle/apps/validate_test.go +++ b/bundle/apps/validate_test.go @@ -32,13 +32,13 @@ func TestAppsValidateSameSourcePath(t *testing.T) { Resources: config.Resources{ Apps: map[string]*resources.App{ "app1": { - App: &apps.App{ + App: apps.App{ Name: "app1", }, SourceCodePath: "./app1", }, "app2": { - App: &apps.App{ + App: apps.App{ Name: "app2", }, SourceCodePath: "./app1", diff --git a/bundle/config/mutator/initialize_urls_test.go b/bundle/config/mutator/initialize_urls_test.go index 8c751079bc..25ba064f91 100644 --- a/bundle/config/mutator/initialize_urls_test.go +++ b/bundle/config/mutator/initialize_urls_test.go @@ -26,31 +26,31 @@ func TestInitializeURLs(t *testing.T) { Jobs: map[string]*resources.Job{ "job1": { ID: "1", - JobSettings: &jobs.JobSettings{Name: "job1"}, + JobSettings: jobs.JobSettings{Name: "job1"}, }, }, Pipelines: map[string]*resources.Pipeline{ "pipeline1": { ID: "3", - CreatePipeline: &pipelines.CreatePipeline{Name: "pipeline1"}, + CreatePipeline: pipelines.CreatePipeline{Name: "pipeline1"}, }, }, Experiments: map[string]*resources.MlflowExperiment{ "experiment1": { ID: "4", - Experiment: &ml.Experiment{Name: "experiment1"}, + Experiment: ml.Experiment{Name: "experiment1"}, }, }, Models: map[string]*resources.MlflowModel{ "model1": { ID: "a model uses its name for identifier", - Model: &ml.Model{Name: "a model uses its name for identifier"}, + Model: ml.Model{Name: "a model uses its name for identifier"}, }, }, ModelServingEndpoints: map[string]*resources.ModelServingEndpoint{ "servingendpoint1": { ID: "my_serving_endpoint", - CreateServingEndpoint: &serving.CreateServingEndpoint{ + CreateServingEndpoint: serving.CreateServingEndpoint{ Name: "my_serving_endpoint", }, }, @@ -58,7 +58,7 @@ func TestInitializeURLs(t *testing.T) { RegisteredModels: map[string]*resources.RegisteredModel{ "registeredmodel1": { ID: "8", - CreateRegisteredModelRequest: &catalog.CreateRegisteredModelRequest{ + CreateRegisteredModelRequest: catalog.CreateRegisteredModelRequest{ Name: "my_registered_model", }, }, @@ -66,13 +66,13 @@ func TestInitializeURLs(t *testing.T) { QualityMonitors: map[string]*resources.QualityMonitor{ "qualityMonitor1": { TableName: "catalog.schema.qualityMonitor1", - CreateMonitor: &catalog.CreateMonitor{}, + CreateMonitor: catalog.CreateMonitor{}, }, }, Schemas: map[string]*resources.Schema{ "schema1": { ID: "catalog.schema", - CreateSchema: &catalog.CreateSchema{ + CreateSchema: catalog.CreateSchema{ Name: "schema", }, }, @@ -80,7 +80,7 @@ func TestInitializeURLs(t *testing.T) { Clusters: map[string]*resources.Cluster{ "cluster1": { ID: "1017-103929-vlr7jzcf", - ClusterSpec: &compute.ClusterSpec{ + ClusterSpec: compute.ClusterSpec{ ClusterName: "cluster1", }, }, @@ -88,7 +88,7 @@ func TestInitializeURLs(t *testing.T) { Dashboards: map[string]*resources.Dashboard{ "dashboard1": { ID: "01ef8d56871e1d50ae30ce7375e42478", - Dashboard: &dashboards.Dashboard{ + Dashboard: dashboards.Dashboard{ DisplayName: "My special dashboard", }, }, @@ -127,7 +127,7 @@ func TestInitializeURLsWithoutOrgId(t *testing.T) { Jobs: map[string]*resources.Job{ "job1": { ID: "1", - JobSettings: &jobs.JobSettings{Name: "job1"}, + JobSettings: jobs.JobSettings{Name: "job1"}, }, }, }, diff --git a/bundle/config/mutator/normalize_paths.go b/bundle/config/mutator/normalize_paths.go index 3f4d5337c6..1a29e69fa5 100644 --- a/bundle/config/mutator/normalize_paths.go +++ b/bundle/config/mutator/normalize_paths.go @@ -72,7 +72,7 @@ func collectGitSourcePaths(b *bundle.Bundle) []dyn.Path { var jobs []dyn.Path for name, job := range b.Config.Resources.Jobs { - if job == nil || job.JobSettings == nil { + if job == nil { continue } if job.GitSource != nil { diff --git a/bundle/config/mutator/normalize_paths_test.go b/bundle/config/mutator/normalize_paths_test.go index af03d77c80..d78c824ceb 100644 --- a/bundle/config/mutator/normalize_paths_test.go +++ b/bundle/config/mutator/normalize_paths_test.go @@ -22,7 +22,7 @@ func TestNormalizePaths(t *testing.T) { Config: config.Root{ Resources: config.Resources{ Jobs: map[string]*resources.Job{ - "job1": {JobSettings: &jobs.JobSettings{ + "job1": {JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { NotebookTask: &jobs.NotebookTask{ diff --git a/bundle/config/mutator/paths/job_paths_visitor_test.go b/bundle/config/mutator/paths/job_paths_visitor_test.go index a3c79182ae..109b9d465e 100644 --- a/bundle/config/mutator/paths/job_paths_visitor_test.go +++ b/bundle/config/mutator/paths/job_paths_visitor_test.go @@ -51,7 +51,7 @@ func TestVisitJobPaths(t *testing.T) { } job0 := &resources.Job{ - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ task0, task1, @@ -96,7 +96,7 @@ func TestVisitJobPaths_environments(t *testing.T) { }, } job0 := &resources.Job{ - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Environments: []jobs.JobEnvironment{ environment0, }, @@ -131,7 +131,7 @@ func TestVisitJobPaths_foreach(t *testing.T) { }, } job0 := &resources.Job{ - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ task0, }, diff --git a/bundle/config/mutator/paths/pipeline_paths_visitor_test.go b/bundle/config/mutator/paths/pipeline_paths_visitor_test.go index ac7e58a7d1..2a848a9f8c 100644 --- a/bundle/config/mutator/paths/pipeline_paths_visitor_test.go +++ b/bundle/config/mutator/paths/pipeline_paths_visitor_test.go @@ -15,7 +15,7 @@ func TestVisitPipelinePaths(t *testing.T) { Resources: config.Resources{ Pipelines: map[string]*resources.Pipeline{ "pipeline0": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Libraries: []pipelines.PipelineLibrary{ { File: &pipelines.FileLibrary{ diff --git a/bundle/config/mutator/resolve_variable_references_test.go b/bundle/config/mutator/resolve_variable_references_test.go index 48a6869624..dc15b68859 100644 --- a/bundle/config/mutator/resolve_variable_references_test.go +++ b/bundle/config/mutator/resolve_variable_references_test.go @@ -48,7 +48,7 @@ func TestResolveVariableReferencesWithSourceLinkedDeployment(t *testing.T) { Resources: config.Resources{ Pipelines: map[string]*resources.Pipeline{ "pipeline1": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Configuration: map[string]string{ "source": "${workspace.file_path}", }, diff --git a/bundle/config/mutator/resourcemutator/apply_bundle_permissions_test.go b/bundle/config/mutator/resourcemutator/apply_bundle_permissions_test.go index 848996f098..2935bb89ac 100644 --- a/bundle/config/mutator/resourcemutator/apply_bundle_permissions_test.go +++ b/bundle/config/mutator/resourcemutator/apply_bundle_permissions_test.go @@ -30,12 +30,12 @@ func TestApplyBundlePermissions(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job_1": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "job_1", }, }, "job_2": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "job_2", }, }, @@ -139,7 +139,7 @@ func TestWarningOnOverlapPermission(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job_1": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "job_1", }, Permissions: []resources.JobPermission{ @@ -147,7 +147,7 @@ func TestWarningOnOverlapPermission(t *testing.T) { }, }, "job_2": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "job_2", }, Permissions: []resources.JobPermission{ diff --git a/bundle/config/mutator/resourcemutator/apply_presets.go b/bundle/config/mutator/resourcemutator/apply_presets.go index 31c162f5ec..2d97ce4651 100644 --- a/bundle/config/mutator/resourcemutator/apply_presets.go +++ b/bundle/config/mutator/resourcemutator/apply_presets.go @@ -13,12 +13,8 @@ import ( "github.com/databricks/cli/libs/dyn" "github.com/databricks/cli/libs/textutil" "github.com/databricks/databricks-sdk-go/service/catalog" - "github.com/databricks/databricks-sdk-go/service/compute" - "github.com/databricks/databricks-sdk-go/service/dashboards" "github.com/databricks/databricks-sdk-go/service/jobs" "github.com/databricks/databricks-sdk-go/service/ml" - "github.com/databricks/databricks-sdk-go/service/pipelines" - "github.com/databricks/databricks-sdk-go/service/serving" ) type applyPresets struct{} @@ -59,9 +55,6 @@ func (m *applyPresets) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnos if j == nil { continue } - if j.JobSettings == nil { - j.JobSettings = &jobs.JobSettings{} - } j.Name = prefix + j.Name if len(tags) > 0 { if j.Tags == nil { @@ -100,9 +93,6 @@ func (m *applyPresets) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnos if p == nil { continue } - if p.CreatePipeline == nil { - p.CreatePipeline = &pipelines.CreatePipeline{} - } p.Name = prefix + p.Name if config.IsExplicitlyEnabled(t.PipelinesDevelopment) { p.Development = true @@ -118,9 +108,6 @@ func (m *applyPresets) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnos if m == nil { continue } - if m.Model == nil { - m.Model = &ml.Model{} - } m.Name = prefix + m.Name for _, t := range tags { exists := slices.ContainsFunc(m.Tags, func(modelTag ml.ModelTag) bool { @@ -138,9 +125,6 @@ func (m *applyPresets) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnos if e == nil { continue } - if e.Experiment == nil { - e.Experiment = &ml.Experiment{} - } filepath := e.Name dir := path.Dir(filepath) base := path.Base(filepath) @@ -168,9 +152,6 @@ func (m *applyPresets) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnos if e == nil { continue } - if e.CreateServingEndpoint == nil { - e.CreateServingEndpoint = &serving.CreateServingEndpoint{} - } e.Name = normalizePrefix(prefix) + e.Name // As of 2024-06, model serving endpoints don't yet support tags @@ -181,9 +162,6 @@ func (m *applyPresets) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnos if m == nil { continue } - if m.CreateRegisteredModelRequest == nil { - m.CreateRegisteredModelRequest = &catalog.CreateRegisteredModelRequest{} - } m.Name = normalizePrefix(prefix) + m.Name // As of 2024-06, registered models don't yet support tags @@ -191,11 +169,7 @@ func (m *applyPresets) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnos // Quality monitors presets: Schedule if t.TriggerPauseStatus == config.Paused { - for key, q := range r.QualityMonitors { - if q.CreateMonitor == nil { - diags = diags.Extend(diag.Errorf("quality monitor %s is not defined", key)) - continue - } + for _, q := range r.QualityMonitors { // Remove all schedules from monitors, since they don't support pausing/unpausing. // Quality monitors might support the "pause" property in the future, so at the // CLI level we do respect that property if it is set to "unpaused." @@ -210,9 +184,6 @@ func (m *applyPresets) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnos if s == nil { continue } - if s.CreateSchema == nil { - s.CreateSchema = &catalog.CreateSchema{} - } s.Name = normalizePrefix(prefix) + s.Name // HTTP API for schemas doesn't yet support tags. It's only supported in // the Databricks UI and via the SQL API. @@ -223,9 +194,6 @@ func (m *applyPresets) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnos if c == nil { continue } - if c.ClusterSpec == nil { - c.ClusterSpec = &compute.ClusterSpec{} - } c.ClusterName = prefix + c.ClusterName if c.CustomTags == nil { c.CustomTags = make(map[string]string) @@ -244,9 +212,6 @@ func (m *applyPresets) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnos if dashboard == nil { continue } - if dashboard.Dashboard == nil { - dashboard.Dashboard = &dashboards.Dashboard{} - } dashboard.DisplayName = prefix + dashboard.DisplayName } diff --git a/bundle/config/mutator/resourcemutator/apply_target_mode_test.go b/bundle/config/mutator/resourcemutator/apply_target_mode_test.go index cbc5e2900b..fbdb5321a9 100644 --- a/bundle/config/mutator/resourcemutator/apply_target_mode_test.go +++ b/bundle/config/mutator/resourcemutator/apply_target_mode_test.go @@ -53,7 +53,7 @@ func mockBundle(mode config.Mode) *bundle.Bundle { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job1": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "job1", Schedule: &jobs.CronSchedule{ QuartzCronExpression: "* * * * *", @@ -62,7 +62,7 @@ func mockBundle(mode config.Mode) *bundle.Bundle { }, }, "job2": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "job2", Schedule: &jobs.CronSchedule{ QuartzCronExpression: "* * * * *", @@ -71,7 +71,7 @@ func mockBundle(mode config.Mode) *bundle.Bundle { }, }, "job3": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "job3", Trigger: &jobs.TriggerSettings{ FileArrival: &jobs.FileArrivalTriggerConfiguration{ @@ -81,7 +81,7 @@ func mockBundle(mode config.Mode) *bundle.Bundle { }, }, "job4": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "job4", Continuous: &jobs.Continuous{ PauseStatus: jobs.PauseStatusPaused, @@ -90,38 +90,38 @@ func mockBundle(mode config.Mode) *bundle.Bundle { }, }, Pipelines: map[string]*resources.Pipeline{ - "pipeline1": {CreatePipeline: &pipelines.CreatePipeline{Name: "pipeline1", Continuous: true}}, + "pipeline1": {CreatePipeline: pipelines.CreatePipeline{Name: "pipeline1", Continuous: true}}, }, Experiments: map[string]*resources.MlflowExperiment{ - "experiment1": {Experiment: &ml.Experiment{Name: "/Users/lennart.kats@databricks.com/experiment1"}}, - "experiment2": {Experiment: &ml.Experiment{Name: "experiment2"}}, + "experiment1": {Experiment: ml.Experiment{Name: "/Users/lennart.kats@databricks.com/experiment1"}}, + "experiment2": {Experiment: ml.Experiment{Name: "experiment2"}}, }, Models: map[string]*resources.MlflowModel{ - "model1": {Model: &ml.Model{Name: "model1"}}, + "model1": {Model: ml.Model{Name: "model1"}}, }, ModelServingEndpoints: map[string]*resources.ModelServingEndpoint{ - "servingendpoint1": {CreateServingEndpoint: &serving.CreateServingEndpoint{Name: "servingendpoint1"}}, + "servingendpoint1": {CreateServingEndpoint: serving.CreateServingEndpoint{Name: "servingendpoint1"}}, }, RegisteredModels: map[string]*resources.RegisteredModel{ - "registeredmodel1": {CreateRegisteredModelRequest: &catalog.CreateRegisteredModelRequest{Name: "registeredmodel1"}}, + "registeredmodel1": {CreateRegisteredModelRequest: catalog.CreateRegisteredModelRequest{Name: "registeredmodel1"}}, }, QualityMonitors: map[string]*resources.QualityMonitor{ "qualityMonitor1": { TableName: "qualityMonitor1", - CreateMonitor: &catalog.CreateMonitor{ + CreateMonitor: catalog.CreateMonitor{ OutputSchemaName: "catalog.schema", }, }, "qualityMonitor2": { TableName: "qualityMonitor2", - CreateMonitor: &catalog.CreateMonitor{ + CreateMonitor: catalog.CreateMonitor{ OutputSchemaName: "catalog.schema", Schedule: &catalog.MonitorCronSchedule{}, }, }, "qualityMonitor3": { TableName: "qualityMonitor3", - CreateMonitor: &catalog.CreateMonitor{ + CreateMonitor: catalog.CreateMonitor{ OutputSchemaName: "catalog.schema", Schedule: &catalog.MonitorCronSchedule{ PauseStatus: catalog.MonitorCronSchedulePauseStatusUnpaused, @@ -130,24 +130,24 @@ func mockBundle(mode config.Mode) *bundle.Bundle { }, }, Schemas: map[string]*resources.Schema{ - "schema1": {CreateSchema: &catalog.CreateSchema{Name: "schema1"}}, + "schema1": {CreateSchema: catalog.CreateSchema{Name: "schema1"}}, }, Volumes: map[string]*resources.Volume{ - "volume1": {CreateVolumeRequestContent: &catalog.CreateVolumeRequestContent{Name: "volume1"}}, + "volume1": {CreateVolumeRequestContent: catalog.CreateVolumeRequestContent{Name: "volume1"}}, }, Clusters: map[string]*resources.Cluster{ - "cluster1": {ClusterSpec: &compute.ClusterSpec{ClusterName: "cluster1", SparkVersion: "13.2.x", NumWorkers: 1}}, + "cluster1": {ClusterSpec: compute.ClusterSpec{ClusterName: "cluster1", SparkVersion: "13.2.x", NumWorkers: 1}}, }, Dashboards: map[string]*resources.Dashboard{ "dashboard1": { - Dashboard: &dashboards.Dashboard{ + Dashboard: dashboards.Dashboard{ DisplayName: "dashboard1", }, }, }, Apps: map[string]*resources.App{ "app1": { - App: &apps.App{ + App: apps.App{ Name: "app1", }, }, diff --git a/bundle/config/mutator/resourcemutator/capture_schema_dependency.go b/bundle/config/mutator/resourcemutator/capture_schema_dependency.go index 7219730b74..bb5a863483 100644 --- a/bundle/config/mutator/resourcemutator/capture_schema_dependency.go +++ b/bundle/config/mutator/resourcemutator/capture_schema_dependency.go @@ -36,7 +36,7 @@ func findSchema(b *bundle.Bundle, catalogName, schemaName string) (string, *reso } for k, s := range b.Config.Resources.Schemas { - if s != nil && s.CreateSchema != nil && s.CatalogName == catalogName && s.Name == schemaName { + if s != nil && s.CatalogName == catalogName && s.Name == schemaName { return k, s } } @@ -44,7 +44,7 @@ func findSchema(b *bundle.Bundle, catalogName, schemaName string) (string, *reso } func resolveVolume(v *resources.Volume, b *bundle.Bundle) { - if v == nil || v.CreateVolumeRequestContent == nil { + if v == nil { return } schemaK, schema := findSchema(b, v.CatalogName, v.SchemaName) @@ -56,7 +56,7 @@ func resolveVolume(v *resources.Volume, b *bundle.Bundle) { } func resolvePipelineSchema(p *resources.Pipeline, b *bundle.Bundle) { - if p == nil || p.CreatePipeline == nil { + if p == nil { return } if p.Schema == "" { @@ -71,7 +71,7 @@ func resolvePipelineSchema(p *resources.Pipeline, b *bundle.Bundle) { } func resolvePipelineTarget(p *resources.Pipeline, b *bundle.Bundle) { - if p == nil || p.CreatePipeline == nil { + if p == nil { return } if p.Target == "" { diff --git a/bundle/config/mutator/resourcemutator/capture_schema_dependency_test.go b/bundle/config/mutator/resourcemutator/capture_schema_dependency_test.go index 9f12f02ae3..c04fd8ed4a 100644 --- a/bundle/config/mutator/resourcemutator/capture_schema_dependency_test.go +++ b/bundle/config/mutator/resourcemutator/capture_schema_dependency_test.go @@ -19,19 +19,19 @@ func TestCaptureSchemaDependencyForVolume(t *testing.T) { Resources: config.Resources{ Schemas: map[string]*resources.Schema{ "schema1": { - CreateSchema: &catalog.CreateSchema{ + CreateSchema: catalog.CreateSchema{ CatalogName: "catalog1", Name: "foobar", }, }, "schema2": { - CreateSchema: &catalog.CreateSchema{ + CreateSchema: catalog.CreateSchema{ CatalogName: "catalog2", Name: "foobar", }, }, "schema3": { - CreateSchema: &catalog.CreateSchema{ + CreateSchema: catalog.CreateSchema{ CatalogName: "catalog1", Name: "barfoo", }, @@ -41,31 +41,31 @@ func TestCaptureSchemaDependencyForVolume(t *testing.T) { }, Volumes: map[string]*resources.Volume{ "volume1": { - CreateVolumeRequestContent: &catalog.CreateVolumeRequestContent{ + CreateVolumeRequestContent: catalog.CreateVolumeRequestContent{ CatalogName: "catalog1", SchemaName: "foobar", }, }, "volume2": { - CreateVolumeRequestContent: &catalog.CreateVolumeRequestContent{ + CreateVolumeRequestContent: catalog.CreateVolumeRequestContent{ CatalogName: "catalog2", SchemaName: "foobar", }, }, "volume3": { - CreateVolumeRequestContent: &catalog.CreateVolumeRequestContent{ + CreateVolumeRequestContent: catalog.CreateVolumeRequestContent{ CatalogName: "catalog1", SchemaName: "barfoo", }, }, "volume4": { - CreateVolumeRequestContent: &catalog.CreateVolumeRequestContent{ + CreateVolumeRequestContent: catalog.CreateVolumeRequestContent{ CatalogName: "catalogX", SchemaName: "foobar", }, }, "volume5": { - CreateVolumeRequestContent: &catalog.CreateVolumeRequestContent{ + CreateVolumeRequestContent: catalog.CreateVolumeRequestContent{ CatalogName: "catalog1", SchemaName: "schemaX", }, @@ -87,7 +87,7 @@ func TestCaptureSchemaDependencyForVolume(t *testing.T) { assert.Equal(t, "schemaX", b.Config.Resources.Volumes["volume5"].CreateVolumeRequestContent.SchemaName) assert.Nil(t, b.Config.Resources.Volumes["nilVolume"]) - assert.Nil(t, b.Config.Resources.Volumes["emptyVolume"].CreateVolumeRequestContent) + // assert.Nil(t, b.Config.Resources.Volumes["emptyVolume"].CreateVolumeRequestContent) } func TestCaptureSchemaDependencyForPipelinesWithTarget(t *testing.T) { @@ -96,19 +96,19 @@ func TestCaptureSchemaDependencyForPipelinesWithTarget(t *testing.T) { Resources: config.Resources{ Schemas: map[string]*resources.Schema{ "schema1": { - CreateSchema: &catalog.CreateSchema{ + CreateSchema: catalog.CreateSchema{ CatalogName: "catalog1", Name: "foobar", }, }, "schema2": { - CreateSchema: &catalog.CreateSchema{ + CreateSchema: catalog.CreateSchema{ CatalogName: "catalog2", Name: "foobar", }, }, "schema3": { - CreateSchema: &catalog.CreateSchema{ + CreateSchema: catalog.CreateSchema{ CatalogName: "catalog1", Name: "barfoo", }, @@ -118,43 +118,43 @@ func TestCaptureSchemaDependencyForPipelinesWithTarget(t *testing.T) { }, Pipelines: map[string]*resources.Pipeline{ "pipeline1": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Catalog: "catalog1", Schema: "foobar", }, }, "pipeline2": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Catalog: "catalog2", Schema: "foobar", }, }, "pipeline3": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Catalog: "catalog1", Schema: "barfoo", }, }, "pipeline4": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Catalog: "catalogX", Schema: "foobar", }, }, "pipeline5": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Catalog: "catalog1", Schema: "schemaX", }, }, "pipeline6": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Catalog: "", Schema: "foobar", }, }, "pipeline7": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Catalog: "", Schema: "", Name: "whatever", @@ -179,7 +179,7 @@ func TestCaptureSchemaDependencyForPipelinesWithTarget(t *testing.T) { assert.Equal(t, "", b.Config.Resources.Pipelines["pipeline7"].Schema) assert.Nil(t, b.Config.Resources.Pipelines["nilPipeline"]) - assert.Nil(t, b.Config.Resources.Pipelines["emptyPipeline"].CreatePipeline) + assert.Empty(t, b.Config.Resources.Pipelines["emptyPipeline"].CreatePipeline.Catalog) for _, k := range []string{"pipeline1", "pipeline2", "pipeline3", "pipeline4", "pipeline5", "pipeline6", "pipeline7"} { assert.Empty(t, b.Config.Resources.Pipelines[k].Target) @@ -192,19 +192,19 @@ func TestCaptureSchemaDependencyForPipelinesWithSchema(t *testing.T) { Resources: config.Resources{ Schemas: map[string]*resources.Schema{ "schema1": { - CreateSchema: &catalog.CreateSchema{ + CreateSchema: catalog.CreateSchema{ CatalogName: "catalog1", Name: "foobar", }, }, "schema2": { - CreateSchema: &catalog.CreateSchema{ + CreateSchema: catalog.CreateSchema{ CatalogName: "catalog2", Name: "foobar", }, }, "schema3": { - CreateSchema: &catalog.CreateSchema{ + CreateSchema: catalog.CreateSchema{ CatalogName: "catalog1", Name: "barfoo", }, @@ -214,43 +214,43 @@ func TestCaptureSchemaDependencyForPipelinesWithSchema(t *testing.T) { }, Pipelines: map[string]*resources.Pipeline{ "pipeline1": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Catalog: "catalog1", Target: "foobar", }, }, "pipeline2": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Catalog: "catalog2", Target: "foobar", }, }, "pipeline3": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Catalog: "catalog1", Target: "barfoo", }, }, "pipeline4": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Catalog: "catalogX", Target: "foobar", }, }, "pipeline5": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Catalog: "catalog1", Target: "schemaX", }, }, "pipeline6": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Catalog: "", Target: "foobar", }, }, "pipeline7": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Catalog: "", Target: "", Name: "whatever", diff --git a/bundle/config/mutator/resourcemutator/default_queueing.go b/bundle/config/mutator/resourcemutator/default_queueing.go index f4a06061e2..98285abdde 100644 --- a/bundle/config/mutator/resourcemutator/default_queueing.go +++ b/bundle/config/mutator/resourcemutator/default_queueing.go @@ -24,9 +24,6 @@ func (m *defaultQueueing) Name() string { func (m *defaultQueueing) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics { r := b.Config.Resources for i := range r.Jobs { - if r.Jobs[i].JobSettings == nil { - r.Jobs[i].JobSettings = &jobs.JobSettings{} - } if r.Jobs[i].Queue != nil { continue } diff --git a/bundle/config/mutator/resourcemutator/default_queueing_test.go b/bundle/config/mutator/resourcemutator/default_queueing_test.go index 6fea4a2d23..5219abe62b 100644 --- a/bundle/config/mutator/resourcemutator/default_queueing_test.go +++ b/bundle/config/mutator/resourcemutator/default_queueing_test.go @@ -38,7 +38,7 @@ func TestDefaultQueueingApplyJobsAlreadyEnabled(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Queue: &jobs.QueueSettings{Enabled: true}, }, }, @@ -57,7 +57,7 @@ func TestDefaultQueueingApplyEnableQueueing(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "job", }, }, @@ -77,17 +77,17 @@ func TestDefaultQueueingApplyWithMultipleJobs(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job1": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Queue: &jobs.QueueSettings{Enabled: false}, }, }, "job2": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "job", }, }, "job3": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Queue: &jobs.QueueSettings{Enabled: true}, }, }, diff --git a/bundle/config/mutator/resourcemutator/expand_pipeline_glob_paths_test.go b/bundle/config/mutator/resourcemutator/expand_pipeline_glob_paths_test.go index 647341ced7..bf55c2f77f 100644 --- a/bundle/config/mutator/resourcemutator/expand_pipeline_glob_paths_test.go +++ b/bundle/config/mutator/resourcemutator/expand_pipeline_glob_paths_test.go @@ -52,7 +52,7 @@ func TestExpandGlobPathsInPipelines(t *testing.T) { Resources: config.Resources{ Pipelines: map[string]*resources.Pipeline{ "pipeline": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Libraries: []pipelines.PipelineLibrary{ { Notebook: &pipelines.NotebookLibrary{ diff --git a/bundle/config/mutator/resourcemutator/filter_current_user_test.go b/bundle/config/mutator/resourcemutator/filter_current_user_test.go index 7a9fdee933..beec9ef54a 100644 --- a/bundle/config/mutator/resourcemutator/filter_current_user_test.go +++ b/bundle/config/mutator/resourcemutator/filter_current_user_test.go @@ -132,13 +132,13 @@ func testFixture(userName string) *bundle.Bundle { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job1": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "job1", }, Permissions: jobPermissions, }, "job2": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "job2", }, Permissions: jobPermissions, diff --git a/bundle/config/mutator/resourcemutator/merge_apps_test.go b/bundle/config/mutator/resourcemutator/merge_apps_test.go index a20400a5b9..3952889bd5 100644 --- a/bundle/config/mutator/resourcemutator/merge_apps_test.go +++ b/bundle/config/mutator/resourcemutator/merge_apps_test.go @@ -19,7 +19,7 @@ func TestMergeApps(t *testing.T) { Resources: config.Resources{ Apps: map[string]*resources.App{ "foo": { - App: &apps.App{ + App: apps.App{ Name: "foo", Resources: []apps.AppResource{ { diff --git a/bundle/config/mutator/resourcemutator/merge_job_clusters_test.go b/bundle/config/mutator/resourcemutator/merge_job_clusters_test.go index 2f8471a5be..34ce08e9a5 100644 --- a/bundle/config/mutator/resourcemutator/merge_job_clusters_test.go +++ b/bundle/config/mutator/resourcemutator/merge_job_clusters_test.go @@ -20,7 +20,7 @@ func TestMergeJobClusters(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "foo": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ JobClusters: []jobs.JobCluster{ { JobClusterKey: "foo", @@ -77,7 +77,7 @@ func TestMergeJobClustersWithNilKey(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "foo": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ JobClusters: []jobs.JobCluster{ { NewCluster: compute.ClusterSpec{ diff --git a/bundle/config/mutator/resourcemutator/merge_job_parameters_test.go b/bundle/config/mutator/resourcemutator/merge_job_parameters_test.go index 7bf53b905d..45a3a90818 100644 --- a/bundle/config/mutator/resourcemutator/merge_job_parameters_test.go +++ b/bundle/config/mutator/resourcemutator/merge_job_parameters_test.go @@ -19,7 +19,7 @@ func TestMergeJobParameters(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "foo": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Parameters: []jobs.JobParameterDefinition{ { Name: "foo", @@ -59,7 +59,7 @@ func TestMergeJobParametersWithNilKey(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "foo": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Parameters: []jobs.JobParameterDefinition{ { Default: "v1", diff --git a/bundle/config/mutator/resourcemutator/merge_job_tasks_test.go b/bundle/config/mutator/resourcemutator/merge_job_tasks_test.go index 21dd8537c8..6700d04d39 100644 --- a/bundle/config/mutator/resourcemutator/merge_job_tasks_test.go +++ b/bundle/config/mutator/resourcemutator/merge_job_tasks_test.go @@ -20,7 +20,7 @@ func TestMergeJobTasks(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "foo": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { TaskKey: "foo", @@ -89,7 +89,7 @@ func TestMergeJobTasksWithNilKey(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "foo": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { NewCluster: &compute.ClusterSpec{ diff --git a/bundle/config/mutator/resourcemutator/merge_pipeline_clusters_test.go b/bundle/config/mutator/resourcemutator/merge_pipeline_clusters_test.go index 238b03b091..a07bee08d7 100644 --- a/bundle/config/mutator/resourcemutator/merge_pipeline_clusters_test.go +++ b/bundle/config/mutator/resourcemutator/merge_pipeline_clusters_test.go @@ -20,7 +20,7 @@ func TestMergePipelineClusters(t *testing.T) { Resources: config.Resources{ Pipelines: map[string]*resources.Pipeline{ "foo": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Clusters: []pipelines.PipelineCluster{ { NodeTypeId: "i3.xlarge", @@ -69,7 +69,7 @@ func TestMergePipelineClustersCaseInsensitive(t *testing.T) { Resources: config.Resources{ Pipelines: map[string]*resources.Pipeline{ "foo": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Clusters: []pipelines.PipelineCluster{ { Label: "default", diff --git a/bundle/config/mutator/resourcemutator/override_compute_test.go b/bundle/config/mutator/resourcemutator/override_compute_test.go index 9881a4c60e..ab04c36993 100644 --- a/bundle/config/mutator/resourcemutator/override_compute_test.go +++ b/bundle/config/mutator/resourcemutator/override_compute_test.go @@ -26,7 +26,7 @@ func TestOverrideComputeModeDevelopment(t *testing.T) { }, Resources: config.Resources{ Jobs: map[string]*resources.Job{ - "job1": {JobSettings: &jobs.JobSettings{ + "job1": {JobSettings: jobs.JobSettings{ Name: "job1", Tasks: []jobs.Task{ { @@ -73,7 +73,7 @@ func TestOverrideComputeModeDefaultIgnoresVariable(t *testing.T) { }, Resources: config.Resources{ Jobs: map[string]*resources.Job{ - "job1": {JobSettings: &jobs.JobSettings{ + "job1": {JobSettings: jobs.JobSettings{ Name: "job1", Tasks: []jobs.Task{ { @@ -102,7 +102,7 @@ func TestOverrideComputePipelineTask(t *testing.T) { Config: config.Root{ Resources: config.Resources{ Jobs: map[string]*resources.Job{ - "job1": {JobSettings: &jobs.JobSettings{ + "job1": {JobSettings: jobs.JobSettings{ Name: "job1", Tasks: []jobs.Task{ { @@ -127,7 +127,7 @@ func TestOverrideComputeForEachTask(t *testing.T) { Config: config.Root{ Resources: config.Resources{ Jobs: map[string]*resources.Job{ - "job1": {JobSettings: &jobs.JobSettings{ + "job1": {JobSettings: jobs.JobSettings{ Name: "job1", Tasks: []jobs.Task{ { @@ -155,7 +155,7 @@ func TestOverrideComputeModeProduction(t *testing.T) { }, Resources: config.Resources{ Jobs: map[string]*resources.Job{ - "job1": {JobSettings: &jobs.JobSettings{ + "job1": {JobSettings: jobs.JobSettings{ Name: "job1", Tasks: []jobs.Task{ { @@ -188,7 +188,7 @@ func TestOverrideComputeModeProductionIgnoresVariable(t *testing.T) { }, Resources: config.Resources{ Jobs: map[string]*resources.Job{ - "job1": {JobSettings: &jobs.JobSettings{ + "job1": {JobSettings: jobs.JobSettings{ Name: "job1", Tasks: []jobs.Task{ { diff --git a/bundle/config/mutator/resourcemutator/run_as_test.go b/bundle/config/mutator/resourcemutator/run_as_test.go index 664b955124..9ff5d5faec 100644 --- a/bundle/config/mutator/resourcemutator/run_as_test.go +++ b/bundle/config/mutator/resourcemutator/run_as_test.go @@ -66,17 +66,17 @@ func TestRunAsWorksForAllowedResources(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job_one": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "foo", }, }, "job_two": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "bar", }, }, "job_three": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "baz", }, }, diff --git a/bundle/config/mutator/resourcemutator/validate_target_mode_test.go b/bundle/config/mutator/resourcemutator/validate_target_mode_test.go index 09d4857483..b1ed42203d 100644 --- a/bundle/config/mutator/resourcemutator/validate_target_mode_test.go +++ b/bundle/config/mutator/resourcemutator/validate_target_mode_test.go @@ -21,7 +21,7 @@ func TestValidateProductionPipelines(t *testing.T) { Resources: config.Resources{ Pipelines: map[string]*resources.Pipeline{ "pipeline": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Development: true, }, }, diff --git a/bundle/config/mutator/rewrite_workspace_prefix_test.go b/bundle/config/mutator/rewrite_workspace_prefix_test.go index 099738c02e..e3b325d78a 100644 --- a/bundle/config/mutator/rewrite_workspace_prefix_test.go +++ b/bundle/config/mutator/rewrite_workspace_prefix_test.go @@ -26,7 +26,7 @@ func TestNoWorkspacePrefixUsed(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "test_job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { SparkPythonTask: &jobs.SparkPythonTask{ diff --git a/bundle/config/mutator/translate_paths_apps_test.go b/bundle/config/mutator/translate_paths_apps_test.go index 3888581d9d..f1ade17970 100644 --- a/bundle/config/mutator/translate_paths_apps_test.go +++ b/bundle/config/mutator/translate_paths_apps_test.go @@ -32,7 +32,7 @@ func TestTranslatePathsApps_FilePathRelativeSubDirectory(t *testing.T) { Resources: config.Resources{ Apps: map[string]*resources.App{ "app": { - App: &apps.App{ + App: apps.App{ Name: "My App", }, SourceCodePath: "../src/app", diff --git a/bundle/config/mutator/translate_paths_dashboards_test.go b/bundle/config/mutator/translate_paths_dashboards_test.go index 75f794b974..a5f7425d80 100644 --- a/bundle/config/mutator/translate_paths_dashboards_test.go +++ b/bundle/config/mutator/translate_paths_dashboards_test.go @@ -29,7 +29,7 @@ func TestTranslatePathsDashboards_FilePathRelativeSubDirectory(t *testing.T) { Resources: config.Resources{ Dashboards: map[string]*resources.Dashboard{ "dashboard": { - Dashboard: &dashboards.Dashboard{ + Dashboard: dashboards.Dashboard{ DisplayName: "My Dashboard", }, FilePath: "../src/my_dashboard.lvdash.json", diff --git a/bundle/config/mutator/translate_paths_test.go b/bundle/config/mutator/translate_paths_test.go index 8c838e8eeb..4dcc9475e6 100644 --- a/bundle/config/mutator/translate_paths_test.go +++ b/bundle/config/mutator/translate_paths_test.go @@ -53,7 +53,7 @@ func TestTranslatePathsSkippedWithGitSource(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ GitSource: &jobs.GitSource{ GitBranch: "somebranch", GitCommit: "somecommit", @@ -126,7 +126,7 @@ func TestTranslatePaths(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { NotebookTask: &jobs.NotebookTask{ @@ -181,7 +181,7 @@ func TestTranslatePaths(t *testing.T) { }, Pipelines: map[string]*resources.Pipeline{ "pipeline": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Libraries: []pipelines.PipelineLibrary{ { Notebook: &pipelines.NotebookLibrary{ @@ -303,7 +303,7 @@ func TestTranslatePathsInSubdirectories(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { SparkPythonTask: &jobs.SparkPythonTask{ @@ -336,7 +336,7 @@ func TestTranslatePathsInSubdirectories(t *testing.T) { }, Pipelines: map[string]*resources.Pipeline{ "pipeline": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Libraries: []pipelines.PipelineLibrary{ { File: &pipelines.FileLibrary{ @@ -399,7 +399,7 @@ func TestTranslatePathsOutsideSyncRoot(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { SparkPythonTask: &jobs.SparkPythonTask{ @@ -431,7 +431,7 @@ func TestJobNotebookDoesNotExistError(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { NotebookTask: &jobs.NotebookTask{ @@ -463,7 +463,7 @@ func TestJobFileDoesNotExistError(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { SparkPythonTask: &jobs.SparkPythonTask{ @@ -495,7 +495,7 @@ func TestPipelineNotebookDoesNotExistError(t *testing.T) { Resources: config.Resources{ Pipelines: map[string]*resources.Pipeline{ "pipeline": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Libraries: []pipelines.PipelineLibrary{ { Notebook: &pipelines.NotebookLibrary{ @@ -540,7 +540,7 @@ func TestPipelineNotebookDoesNotExistErrorWithoutExtension(t *testing.T) { Resources: config.Resources{ Pipelines: map[string]*resources.Pipeline{ "pipeline": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Libraries: []pipelines.PipelineLibrary{ { Notebook: &pipelines.NotebookLibrary{ @@ -581,7 +581,7 @@ func TestPipelineFileDoesNotExistError(t *testing.T) { Resources: config.Resources{ Pipelines: map[string]*resources.Pipeline{ "pipeline": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Libraries: []pipelines.PipelineLibrary{ { File: &pipelines.FileLibrary{ @@ -617,7 +617,7 @@ func TestJobSparkPythonTaskWithNotebookSourceError(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { SparkPythonTask: &jobs.SparkPythonTask{ @@ -653,7 +653,7 @@ func TestJobNotebookTaskWithFileSourceError(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { NotebookTask: &jobs.NotebookTask{ @@ -689,7 +689,7 @@ func TestPipelineNotebookLibraryWithFileSourceError(t *testing.T) { Resources: config.Resources{ Pipelines: map[string]*resources.Pipeline{ "pipeline": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Libraries: []pipelines.PipelineLibrary{ { Notebook: &pipelines.NotebookLibrary{ @@ -725,7 +725,7 @@ func TestPipelineFileLibraryWithNotebookSourceError(t *testing.T) { Resources: config.Resources{ Pipelines: map[string]*resources.Pipeline{ "pipeline": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Libraries: []pipelines.PipelineLibrary{ { File: &pipelines.FileLibrary{ @@ -759,7 +759,7 @@ func TestTranslatePathJobEnvironments(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Environments: []jobs.JobEnvironment{ { Spec: &compute.Environment{ @@ -816,7 +816,7 @@ func TestTranslatePathWithComplexVariables(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { TaskKey: "test", @@ -881,7 +881,7 @@ func TestTranslatePathsWithSourceLinkedDeployment(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { NotebookTask: &jobs.NotebookTask{ @@ -931,7 +931,7 @@ func TestTranslatePathsWithSourceLinkedDeployment(t *testing.T) { }, Pipelines: map[string]*resources.Pipeline{ "pipeline": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Libraries: []pipelines.PipelineLibrary{ { Notebook: &pipelines.NotebookLibrary{ diff --git a/bundle/config/resources.go b/bundle/config/resources.go index cffd5ada87..204ca93127 100644 --- a/bundle/config/resources.go +++ b/bundle/config/resources.go @@ -46,9 +46,6 @@ type ConfigResource interface { // InitializeURL initializes the URL field of the resource. InitializeURL(baseURL url.URL) - - // IsNil returns true if the resource is nil, for example, when it was removed from the bundle. - IsNil() bool } // ResourceGroup represents a group of resources of the same type. @@ -65,9 +62,6 @@ func collectResourceMap[T ConfigResource]( ) ResourceGroup { r := make(map[string]ConfigResource) for key, resource := range input { - if resource.IsNil() { - continue - } r[key] = resource } return ResourceGroup{ diff --git a/bundle/config/resources/apps.go b/bundle/config/resources/apps.go index 2d42d5d2e4..97e6567d9c 100644 --- a/bundle/config/resources/apps.go +++ b/bundle/config/resources/apps.go @@ -37,7 +37,7 @@ type App struct { ModifiedStatus ModifiedStatus `json:"modified_status,omitempty" bundle:"internal"` URL string `json:"url,omitempty" bundle:"internal"` - *apps.App + apps.App } func (a *App) UnmarshalJSON(b []byte) error { @@ -86,7 +86,3 @@ func (a *App) GetName() string { func (a *App) GetURL() string { return a.URL } - -func (a *App) IsNil() bool { - return a.App == nil -} diff --git a/bundle/config/resources/clusters.go b/bundle/config/resources/clusters.go index 60e367deaa..6c8570a5c4 100644 --- a/bundle/config/resources/clusters.go +++ b/bundle/config/resources/clusters.go @@ -28,7 +28,7 @@ type Cluster struct { ModifiedStatus ModifiedStatus `json:"modified_status,omitempty" bundle:"internal"` URL string `json:"url,omitempty" bundle:"internal"` - *compute.ClusterSpec + compute.ClusterSpec } func (s *Cluster) UnmarshalJSON(b []byte) error { @@ -77,7 +77,3 @@ func (s *Cluster) GetName() string { func (s *Cluster) GetURL() string { return s.URL } - -func (s *Cluster) IsNil() bool { - return s.ClusterSpec == nil -} diff --git a/bundle/config/resources/dashboard.go b/bundle/config/resources/dashboard.go index 57c7b1b94c..b0bcf7fe36 100644 --- a/bundle/config/resources/dashboard.go +++ b/bundle/config/resources/dashboard.go @@ -29,7 +29,7 @@ type Dashboard struct { ModifiedStatus ModifiedStatus `json:"modified_status,omitempty" bundle:"internal"` URL string `json:"url,omitempty" bundle:"internal"` - *dashboards.Dashboard + dashboards.Dashboard // ========================= // === Additional fields === @@ -101,7 +101,3 @@ func (r *Dashboard) GetName() string { func (r *Dashboard) GetURL() string { return r.URL } - -func (r *Dashboard) IsNil() bool { - return r.Dashboard == nil -} diff --git a/bundle/config/resources/job.go b/bundle/config/resources/job.go index d35a9e7ec9..c34a545d47 100644 --- a/bundle/config/resources/job.go +++ b/bundle/config/resources/job.go @@ -29,7 +29,7 @@ type Job struct { ModifiedStatus ModifiedStatus `json:"modified_status,omitempty" bundle:"internal"` URL string `json:"url,omitempty" bundle:"internal"` - *jobs.JobSettings + jobs.JobSettings } func (s *Job) UnmarshalJSON(b []byte) error { @@ -84,7 +84,3 @@ func (j *Job) GetName() string { func (j *Job) GetURL() string { return j.URL } - -func (j *Job) IsNil() bool { - return j.JobSettings == nil -} diff --git a/bundle/config/resources/mlflow_experiment.go b/bundle/config/resources/mlflow_experiment.go index 3b820899fb..a2e081049f 100644 --- a/bundle/config/resources/mlflow_experiment.go +++ b/bundle/config/resources/mlflow_experiment.go @@ -28,7 +28,7 @@ type MlflowExperiment struct { ModifiedStatus ModifiedStatus `json:"modified_status,omitempty" bundle:"internal"` URL string `json:"url,omitempty" bundle:"internal"` - *ml.Experiment + ml.Experiment } func (s *MlflowExperiment) UnmarshalJSON(b []byte) error { @@ -79,7 +79,3 @@ func (s *MlflowExperiment) GetName() string { func (s *MlflowExperiment) GetURL() string { return s.URL } - -func (s *MlflowExperiment) IsNil() bool { - return s.Experiment == nil -} diff --git a/bundle/config/resources/mlflow_model.go b/bundle/config/resources/mlflow_model.go index 282ff6de93..9c77c5e9bf 100644 --- a/bundle/config/resources/mlflow_model.go +++ b/bundle/config/resources/mlflow_model.go @@ -28,7 +28,7 @@ type MlflowModel struct { ModifiedStatus ModifiedStatus `json:"modified_status,omitempty" bundle:"internal"` URL string `json:"url,omitempty" bundle:"internal"` - *ml.Model + ml.Model } func (s *MlflowModel) UnmarshalJSON(b []byte) error { @@ -79,7 +79,3 @@ func (s *MlflowModel) GetName() string { func (s *MlflowModel) GetURL() string { return s.URL } - -func (s *MlflowModel) IsNil() bool { - return s.Model == nil -} diff --git a/bundle/config/resources/model_serving_endpoint.go b/bundle/config/resources/model_serving_endpoint.go index 7d7cadd294..50e55d1634 100644 --- a/bundle/config/resources/model_serving_endpoint.go +++ b/bundle/config/resources/model_serving_endpoint.go @@ -25,7 +25,7 @@ type ModelServingEndpointPermission struct { type ModelServingEndpoint struct { // This represents the input args for terraform, and will get converted // to a HCL representation for CRUD - *serving.CreateServingEndpoint + serving.CreateServingEndpoint // This represents the id (ie serving_endpoint_id) that can be used // as a reference in other resources. This value is returned by terraform. @@ -87,7 +87,3 @@ func (s *ModelServingEndpoint) GetName() string { func (s *ModelServingEndpoint) GetURL() string { return s.URL } - -func (s *ModelServingEndpoint) IsNil() bool { - return s.CreateServingEndpoint == nil -} diff --git a/bundle/config/resources/pipeline.go b/bundle/config/resources/pipeline.go index 402ace74ea..cb7dcf19f2 100644 --- a/bundle/config/resources/pipeline.go +++ b/bundle/config/resources/pipeline.go @@ -28,7 +28,7 @@ type Pipeline struct { ModifiedStatus ModifiedStatus `json:"modified_status,omitempty" bundle:"internal"` URL string `json:"url,omitempty" bundle:"internal"` - *pipelines.CreatePipeline + pipelines.CreatePipeline } func (s *Pipeline) UnmarshalJSON(b []byte) error { @@ -79,7 +79,3 @@ func (p *Pipeline) GetName() string { func (s *Pipeline) GetURL() string { return s.URL } - -func (s *Pipeline) IsNil() bool { - return s.CreatePipeline == nil -} diff --git a/bundle/config/resources/quality_monitor.go b/bundle/config/resources/quality_monitor.go index fb02b37d58..9fabfe49e2 100644 --- a/bundle/config/resources/quality_monitor.go +++ b/bundle/config/resources/quality_monitor.go @@ -20,7 +20,7 @@ type QualityMonitor struct { TableName string `json:"table_name"` // This struct defines the creation payload for a monitor. - *catalog.CreateMonitor + catalog.CreateMonitor } func (s *QualityMonitor) UnmarshalJSON(b []byte) error { @@ -71,7 +71,3 @@ func (s *QualityMonitor) GetName() string { func (s *QualityMonitor) GetURL() string { return s.URL } - -func (s *QualityMonitor) IsNil() bool { - return s.CreateMonitor == nil -} diff --git a/bundle/config/resources/registered_model.go b/bundle/config/resources/registered_model.go index dca3d49d04..ecf1aa5ef3 100644 --- a/bundle/config/resources/registered_model.go +++ b/bundle/config/resources/registered_model.go @@ -23,7 +23,7 @@ type RegisteredModel struct { // This represents the input args for terraform, and will get converted // to a HCL representation for CRUD - *catalog.CreateRegisteredModelRequest + catalog.CreateRegisteredModelRequest ModifiedStatus ModifiedStatus `json:"modified_status,omitempty" bundle:"internal"` URL string `json:"url,omitempty" bundle:"internal"` @@ -77,7 +77,3 @@ func (s *RegisteredModel) GetName() string { func (s *RegisteredModel) GetURL() string { return s.URL } - -func (s *RegisteredModel) IsNil() bool { - return s.CreateRegisteredModelRequest == nil -} diff --git a/bundle/config/resources/schema.go b/bundle/config/resources/schema.go index ebf63e834e..4f2e758e3a 100644 --- a/bundle/config/resources/schema.go +++ b/bundle/config/resources/schema.go @@ -22,7 +22,7 @@ type Schema struct { // the terraform state after deployment succeeds. ID string `json:"id,omitempty" bundle:"readonly"` - *catalog.CreateSchema + catalog.CreateSchema ModifiedStatus ModifiedStatus `json:"modified_status,omitempty" bundle:"internal"` URL string `json:"url,omitempty" bundle:"internal"` @@ -81,7 +81,3 @@ func (s *Schema) UnmarshalJSON(b []byte) error { func (s Schema) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } - -func (s *Schema) IsNil() bool { - return s.CreateSchema == nil -} diff --git a/bundle/config/resources/volume.go b/bundle/config/resources/volume.go index e21ccfb47a..6812a789e3 100644 --- a/bundle/config/resources/volume.go +++ b/bundle/config/resources/volume.go @@ -21,7 +21,7 @@ type Volume struct { // the terraform state after deployment succeeds. ID string `json:"id,omitempty" bundle:"readonly"` - *catalog.CreateVolumeRequestContent + catalog.CreateVolumeRequestContent ModifiedStatus ModifiedStatus `json:"modified_status,omitempty" bundle:"internal"` URL string `json:"url,omitempty" bundle:"internal"` @@ -81,7 +81,3 @@ func (v *Volume) GetURL() string { func (v *Volume) GetName() string { return v.Name } - -func (v *Volume) IsNil() bool { - return v.CreateVolumeRequestContent == nil -} diff --git a/bundle/config/resources_test.go b/bundle/config/resources_test.go index 7424966fe7..92bd32e5c1 100644 --- a/bundle/config/resources_test.go +++ b/bundle/config/resources_test.go @@ -13,7 +13,6 @@ import ( "github.com/databricks/databricks-sdk-go/experimental/mocks" "github.com/databricks/databricks-sdk-go/service/apps" "github.com/databricks/databricks-sdk-go/service/catalog" - "github.com/databricks/databricks-sdk-go/service/compute" "github.com/databricks/databricks-sdk-go/service/dashboards" "github.com/databricks/databricks-sdk-go/service/jobs" "github.com/databricks/databricks-sdk-go/service/ml" @@ -118,57 +117,55 @@ func TestResourcesBindSupport(t *testing.T) { supportedResources := &Resources{ Jobs: map[string]*resources.Job{ "my_job": { - JobSettings: &jobs.JobSettings{}, + JobSettings: jobs.JobSettings{}, }, }, Pipelines: map[string]*resources.Pipeline{ "my_pipeline": { - CreatePipeline: &pipelines.CreatePipeline{}, + CreatePipeline: pipelines.CreatePipeline{}, }, }, Experiments: map[string]*resources.MlflowExperiment{ "my_experiment": { - Experiment: &ml.Experiment{}, + Experiment: ml.Experiment{}, }, }, RegisteredModels: map[string]*resources.RegisteredModel{ "my_registered_model": { - CreateRegisteredModelRequest: &catalog.CreateRegisteredModelRequest{}, + CreateRegisteredModelRequest: catalog.CreateRegisteredModelRequest{}, }, }, Schemas: map[string]*resources.Schema{ "my_schema": { - CreateSchema: &catalog.CreateSchema{}, + CreateSchema: catalog.CreateSchema{}, }, }, Clusters: map[string]*resources.Cluster{ - "my_cluster": { - ClusterSpec: &compute.ClusterSpec{}, - }, + "my_cluster": {}, }, Dashboards: map[string]*resources.Dashboard{ "my_dashboard": { - Dashboard: &dashboards.Dashboard{}, + Dashboard: dashboards.Dashboard{}, }, }, Volumes: map[string]*resources.Volume{ "my_volume": { - CreateVolumeRequestContent: &catalog.CreateVolumeRequestContent{}, + CreateVolumeRequestContent: catalog.CreateVolumeRequestContent{}, }, }, Apps: map[string]*resources.App{ "my_app": { - App: &apps.App{}, + App: apps.App{}, }, }, QualityMonitors: map[string]*resources.QualityMonitor{ "my_quality_monitor": { - CreateMonitor: &catalog.CreateMonitor{}, + CreateMonitor: catalog.CreateMonitor{}, }, }, ModelServingEndpoints: map[string]*resources.ModelServingEndpoint{ "my_model_serving_endpoint": { - CreateServingEndpoint: &serving.CreateServingEndpoint{}, + CreateServingEndpoint: serving.CreateServingEndpoint{}, }, }, } diff --git a/bundle/config/validate/job_cluster_key_defined_test.go b/bundle/config/validate/job_cluster_key_defined_test.go index 559bd1c464..dbbc6c3b56 100644 --- a/bundle/config/validate/job_cluster_key_defined_test.go +++ b/bundle/config/validate/job_cluster_key_defined_test.go @@ -18,7 +18,7 @@ func TestJobClusterKeyDefined(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job1": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "job1", JobClusters: []jobs.JobCluster{ {JobClusterKey: "do-not-exist"}, @@ -44,7 +44,7 @@ func TestJobClusterKeyNotDefined(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job1": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "job1", Tasks: []jobs.Task{ {JobClusterKey: "do-not-exist"}, @@ -69,7 +69,7 @@ func TestJobClusterKeyDefinedInDifferentJob(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job1": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "job1", Tasks: []jobs.Task{ {JobClusterKey: "do-not-exist"}, @@ -77,7 +77,7 @@ func TestJobClusterKeyDefinedInDifferentJob(t *testing.T) { }, }, "job2": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "job2", JobClusters: []jobs.JobCluster{ {JobClusterKey: "do-not-exist"}, diff --git a/bundle/config/validate/job_task_cluster_spec_test.go b/bundle/config/validate/job_task_cluster_spec_test.go index fd316d61fe..40edef2167 100644 --- a/bundle/config/validate/job_task_cluster_spec_test.go +++ b/bundle/config/validate/job_task_cluster_spec_test.go @@ -168,7 +168,7 @@ Specify one of the following fields: job_cluster_key, environment_key, existing_ for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { job := &resources.Job{ - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{tc.task}, }, } diff --git a/bundle/config/validate/single_node_cluster_test.go b/bundle/config/validate/single_node_cluster_test.go index c6d5f8ca95..6136a9ecfd 100644 --- a/bundle/config/validate/single_node_cluster_test.go +++ b/bundle/config/validate/single_node_cluster_test.go @@ -99,7 +99,7 @@ func TestValidateSingleNodeClusterFailForInteractiveClusters(t *testing.T) { Resources: config.Resources{ Clusters: map[string]*resources.Cluster{ "foo": { - ClusterSpec: &compute.ClusterSpec{ + ClusterSpec: compute.ClusterSpec{ SparkConf: tc.sparkConf, CustomTags: tc.customTags, }, @@ -140,7 +140,7 @@ func TestValidateSingleNodeClusterFailForJobClusters(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "foo": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ JobClusters: []jobs.JobCluster{ { NewCluster: compute.ClusterSpec{ @@ -189,7 +189,7 @@ func TestValidateSingleNodeClusterFailForJobTaskClusters(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "foo": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { NewCluster: &compute.ClusterSpec{ @@ -238,7 +238,7 @@ func TestValidateSingleNodeClusterFailForPipelineClusters(t *testing.T) { Resources: config.Resources{ Pipelines: map[string]*resources.Pipeline{ "foo": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Clusters: []pipelines.PipelineCluster{ { SparkConf: tc.sparkConf, @@ -284,7 +284,7 @@ func TestValidateSingleNodeClusterFailForJobForEachTaskCluster(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "foo": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { ForEachTask: &jobs.ForEachTask{ @@ -380,7 +380,7 @@ func TestValidateSingleNodeClusterPassInteractiveClusters(t *testing.T) { Resources: config.Resources{ Clusters: map[string]*resources.Cluster{ "foo": { - ClusterSpec: &compute.ClusterSpec{ + ClusterSpec: compute.ClusterSpec{ SparkConf: tc.sparkConf, CustomTags: tc.customTags, PolicyId: tc.policyId, @@ -413,7 +413,7 @@ func TestValidateSingleNodeClusterPassJobClusters(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "foo": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ JobClusters: []jobs.JobCluster{ { NewCluster: compute.ClusterSpec{ @@ -453,7 +453,7 @@ func TestValidateSingleNodeClusterPassJobTaskClusters(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "foo": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { NewCluster: &compute.ClusterSpec{ @@ -493,7 +493,7 @@ func TestValidateSingleNodeClusterPassPipelineClusters(t *testing.T) { Resources: config.Resources{ Pipelines: map[string]*resources.Pipeline{ "foo": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Clusters: []pipelines.PipelineCluster{ { SparkConf: tc.sparkConf, @@ -530,7 +530,7 @@ func TestValidateSingleNodeClusterPassJobForEachTaskCluster(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "foo": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { ForEachTask: &jobs.ForEachTask{ diff --git a/bundle/config/validate/validate_artifact_path_test.go b/bundle/config/validate/validate_artifact_path_test.go index 3f998567bc..103380cb8f 100644 --- a/bundle/config/validate/validate_artifact_path_test.go +++ b/bundle/config/validate/validate_artifact_path_test.go @@ -27,7 +27,7 @@ func TestValidateArtifactPathWithVolumeInBundle(t *testing.T) { Resources: config.Resources{ Volumes: map[string]*resources.Volume{ "foo": { - CreateVolumeRequestContent: &catalog.CreateVolumeRequestContent{ + CreateVolumeRequestContent: catalog.CreateVolumeRequestContent{ CatalogName: "catalogN", Name: "volumeN", SchemaName: "schemaN", @@ -182,7 +182,7 @@ func TestFindVolumeInBundle(t *testing.T) { Resources: config.Resources{ Volumes: map[string]*resources.Volume{ "foo": { - CreateVolumeRequestContent: &catalog.CreateVolumeRequestContent{ + CreateVolumeRequestContent: catalog.CreateVolumeRequestContent{ CatalogName: "main", Name: "my_volume", SchemaName: "my_schema", diff --git a/bundle/deploy/metadata/annotate_jobs.go b/bundle/deploy/metadata/annotate_jobs.go index f42d469310..5c70deb38f 100644 --- a/bundle/deploy/metadata/annotate_jobs.go +++ b/bundle/deploy/metadata/annotate_jobs.go @@ -20,10 +20,6 @@ func (m *annotateJobs) Name() string { func (m *annotateJobs) Apply(_ context.Context, b *bundle.Bundle) diag.Diagnostics { for _, job := range b.Config.Resources.Jobs { - if job.JobSettings == nil { - continue - } - job.JobSettings.Deployment = &jobs.JobDeployment{ Kind: jobs.JobDeploymentKindBundle, MetadataFilePath: metadataFilePath(b), diff --git a/bundle/deploy/metadata/annotate_jobs_test.go b/bundle/deploy/metadata/annotate_jobs_test.go index 8dace45904..6ecef81164 100644 --- a/bundle/deploy/metadata/annotate_jobs_test.go +++ b/bundle/deploy/metadata/annotate_jobs_test.go @@ -21,12 +21,12 @@ func TestAnnotateJobsMutator(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "my-job-1": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "My Job One", }, }, "my-job-2": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "My Job Two", }, }, diff --git a/bundle/deploy/metadata/annotate_pipelines.go b/bundle/deploy/metadata/annotate_pipelines.go index 407aaea6e0..d1a2e946c6 100644 --- a/bundle/deploy/metadata/annotate_pipelines.go +++ b/bundle/deploy/metadata/annotate_pipelines.go @@ -20,10 +20,6 @@ func (m *annotatePipelines) Name() string { func (m *annotatePipelines) Apply(_ context.Context, b *bundle.Bundle) diag.Diagnostics { for _, pipeline := range b.Config.Resources.Pipelines { - if pipeline.CreatePipeline == nil { - continue - } - pipeline.CreatePipeline.Deployment = &pipelines.PipelineDeployment{ Kind: pipelines.DeploymentKindBundle, MetadataFilePath: metadataFilePath(b), diff --git a/bundle/deploy/metadata/annotate_pipelines_test.go b/bundle/deploy/metadata/annotate_pipelines_test.go index 6062927249..87ea20ab89 100644 --- a/bundle/deploy/metadata/annotate_pipelines_test.go +++ b/bundle/deploy/metadata/annotate_pipelines_test.go @@ -21,12 +21,12 @@ func TestAnnotatePipelinesMutator(t *testing.T) { Resources: config.Resources{ Pipelines: map[string]*resources.Pipeline{ "my-pipeline-1": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Name: "My Pipeline One", }, }, "my-pipeline-2": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Name: "My Pipeline Two", }, }, diff --git a/bundle/deploy/metadata/compute_test.go b/bundle/deploy/metadata/compute_test.go index 64f899695d..8755fa9a4f 100644 --- a/bundle/deploy/metadata/compute_test.go +++ b/bundle/deploy/metadata/compute_test.go @@ -37,13 +37,13 @@ func TestComputeMetadataMutator(t *testing.T) { Jobs: map[string]*resources.Job{ "my-job-1": { ID: "1111", - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "My Job One", }, }, "my-job-2": { ID: "2222", - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "My Job Two", }, }, diff --git a/bundle/deploy/terraform/check_dashboards_modified_remotely_test.go b/bundle/deploy/terraform/check_dashboards_modified_remotely_test.go index 46bdc1f38e..98d20a4739 100644 --- a/bundle/deploy/terraform/check_dashboards_modified_remotely_test.go +++ b/bundle/deploy/terraform/check_dashboards_modified_remotely_test.go @@ -29,7 +29,7 @@ func mockDashboardBundle(t *testing.T) *bundle.Bundle { Resources: config.Resources{ Dashboards: map[string]*resources.Dashboard{ "dash1": { - Dashboard: &dashboards.Dashboard{ + Dashboard: dashboards.Dashboard{ DisplayName: "My Special Dashboard", }, }, diff --git a/bundle/deploy/terraform/convert.go b/bundle/deploy/terraform/convert.go index d549b97973..a5821a240d 100644 --- a/bundle/deploy/terraform/convert.go +++ b/bundle/deploy/terraform/convert.go @@ -9,7 +9,6 @@ import ( "github.com/databricks/cli/bundle/deploy/terraform/tfdyn" "github.com/databricks/cli/bundle/internal/tf/schema" "github.com/databricks/cli/libs/dyn" - "github.com/databricks/databricks-sdk-go/service/apps" tfjson "github.com/hashicorp/terraform-json" ) @@ -203,7 +202,7 @@ func TerraformToBundle(state *resourcesState, config *config.Root) error { } cur := config.Resources.Apps[resource.Name] if cur == nil { - cur = &resources.App{ModifiedStatus: resources.ModifiedStatusDeleted, App: &apps.App{}} + cur = &resources.App{ModifiedStatus: resources.ModifiedStatusDeleted} } else { // If the app exists in terraform and bundle, we always set modified status to updated // because we don't really know if the app source code was updated or not. diff --git a/bundle/deploy/terraform/convert_test.go b/bundle/deploy/terraform/convert_test.go index bbad15acb3..882893596a 100644 --- a/bundle/deploy/terraform/convert_test.go +++ b/bundle/deploy/terraform/convert_test.go @@ -45,7 +45,7 @@ func convertToResourceStruct[T any](t *testing.T, resource *T, data any) { func TestBundleToTerraformJob(t *testing.T) { src := resources.Job{ - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "my job", JobClusters: []jobs.JobCluster{ { @@ -123,7 +123,7 @@ func TestBundleToTerraformJobPermissions(t *testing.T) { func TestBundleToTerraformJobTaskLibraries(t *testing.T) { src := resources.Job{ - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "my job", Tasks: []jobs.Task{ { @@ -160,7 +160,7 @@ func TestBundleToTerraformJobTaskLibraries(t *testing.T) { func TestBundleToTerraformForEachTaskLibraries(t *testing.T) { src := resources.Job{ - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "my job", Tasks: []jobs.Task{ { @@ -203,7 +203,7 @@ func TestBundleToTerraformForEachTaskLibraries(t *testing.T) { func TestBundleToTerraformPipeline(t *testing.T) { src := resources.Pipeline{ - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Name: "my pipeline", Libraries: []pipelines.PipelineLibrary{ { @@ -292,7 +292,7 @@ func TestBundleToTerraformPipelinePermissions(t *testing.T) { func TestBundleToTerraformModel(t *testing.T) { src := resources.MlflowModel{ - Model: &ml.Model{ + Model: ml.Model{ Name: "name", Description: "description", Tags: []ml.ModelTag{ @@ -332,7 +332,7 @@ func TestBundleToTerraformModel(t *testing.T) { func TestBundleToTerraformModelPermissions(t *testing.T) { src := resources.MlflowModel{ - Model: &ml.Model{ + Model: ml.Model{ Name: "name", }, Permissions: []resources.MlflowModelPermission{ @@ -363,7 +363,7 @@ func TestBundleToTerraformModelPermissions(t *testing.T) { func TestBundleToTerraformExperiment(t *testing.T) { src := resources.MlflowExperiment{ - Experiment: &ml.Experiment{ + Experiment: ml.Experiment{ Name: "name", }, } @@ -386,7 +386,7 @@ func TestBundleToTerraformExperiment(t *testing.T) { func TestBundleToTerraformExperimentPermissions(t *testing.T) { src := resources.MlflowExperiment{ - Experiment: &ml.Experiment{ + Experiment: ml.Experiment{ Name: "name", }, Permissions: []resources.MlflowExperimentPermission{ @@ -417,7 +417,7 @@ func TestBundleToTerraformExperimentPermissions(t *testing.T) { func TestBundleToTerraformModelServing(t *testing.T) { src := resources.ModelServingEndpoint{ - CreateServingEndpoint: &serving.CreateServingEndpoint{ + CreateServingEndpoint: serving.CreateServingEndpoint{ Name: "name", Config: &serving.EndpointCoreConfigInput{ ServedModels: []serving.ServedModelInput{ @@ -464,7 +464,7 @@ func TestBundleToTerraformModelServing(t *testing.T) { func TestBundleToTerraformModelServingPermissions(t *testing.T) { src := resources.ModelServingEndpoint{ - CreateServingEndpoint: &serving.CreateServingEndpoint{ + CreateServingEndpoint: serving.CreateServingEndpoint{ Name: "name", // Need to specify this to satisfy the equivalence test: @@ -513,7 +513,7 @@ func TestBundleToTerraformModelServingPermissions(t *testing.T) { func TestBundleToTerraformRegisteredModel(t *testing.T) { src := resources.RegisteredModel{ - CreateRegisteredModelRequest: &catalog.CreateRegisteredModelRequest{ + CreateRegisteredModelRequest: catalog.CreateRegisteredModelRequest{ Name: "name", CatalogName: "catalog", SchemaName: "schema", @@ -542,7 +542,7 @@ func TestBundleToTerraformRegisteredModel(t *testing.T) { func TestBundleToTerraformRegisteredModelGrants(t *testing.T) { src := resources.RegisteredModel{ - CreateRegisteredModelRequest: &catalog.CreateRegisteredModelRequest{ + CreateRegisteredModelRequest: catalog.CreateRegisteredModelRequest{ Name: "name", CatalogName: "catalog", SchemaName: "schema", @@ -575,11 +575,11 @@ func TestBundleToTerraformRegisteredModelGrants(t *testing.T) { func TestBundleToTerraformDeletedResources(t *testing.T) { job1 := resources.Job{ - JobSettings: &jobs.JobSettings{}, + JobSettings: jobs.JobSettings{}, } job2 := resources.Job{ ModifiedStatus: resources.ModifiedStatusDeleted, - JobSettings: &jobs.JobSettings{}, + JobSettings: jobs.JobSettings{}, } config := config.Root{ Resources: config.Resources{ @@ -752,84 +752,84 @@ func TestTerraformToBundleEmptyRemoteResources(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "test_job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "test_job", }, }, }, Pipelines: map[string]*resources.Pipeline{ "test_pipeline": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Name: "test_pipeline", }, }, }, Models: map[string]*resources.MlflowModel{ "test_mlflow_model": { - Model: &ml.Model{ + Model: ml.Model{ Name: "test_mlflow_model", }, }, }, Experiments: map[string]*resources.MlflowExperiment{ "test_mlflow_experiment": { - Experiment: &ml.Experiment{ + Experiment: ml.Experiment{ Name: "test_mlflow_experiment", }, }, }, ModelServingEndpoints: map[string]*resources.ModelServingEndpoint{ "test_model_serving": { - CreateServingEndpoint: &serving.CreateServingEndpoint{ + CreateServingEndpoint: serving.CreateServingEndpoint{ Name: "test_model_serving", }, }, }, RegisteredModels: map[string]*resources.RegisteredModel{ "test_registered_model": { - CreateRegisteredModelRequest: &catalog.CreateRegisteredModelRequest{ + CreateRegisteredModelRequest: catalog.CreateRegisteredModelRequest{ Name: "test_registered_model", }, }, }, QualityMonitors: map[string]*resources.QualityMonitor{ "test_monitor": { - CreateMonitor: &catalog.CreateMonitor{ + CreateMonitor: catalog.CreateMonitor{ TableName: "test_monitor", }, }, }, Schemas: map[string]*resources.Schema{ "test_schema": { - CreateSchema: &catalog.CreateSchema{ + CreateSchema: catalog.CreateSchema{ Name: "test_schema", }, }, }, Volumes: map[string]*resources.Volume{ "test_volume": { - CreateVolumeRequestContent: &catalog.CreateVolumeRequestContent{ + CreateVolumeRequestContent: catalog.CreateVolumeRequestContent{ Name: "test_volume", }, }, }, Clusters: map[string]*resources.Cluster{ "test_cluster": { - ClusterSpec: &compute.ClusterSpec{ + ClusterSpec: compute.ClusterSpec{ ClusterName: "test_cluster", }, }, }, Dashboards: map[string]*resources.Dashboard{ "test_dashboard": { - Dashboard: &dashboards.Dashboard{ + Dashboard: dashboards.Dashboard{ DisplayName: "test_dashboard", }, }, }, Apps: map[string]*resources.App{ "test_app": { - App: &apps.App{ + App: apps.App{ Description: "test_app", }, }, @@ -886,144 +886,144 @@ func TestTerraformToBundleModifiedResources(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "test_job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "test_job", }, }, "test_job_new": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "test_job_new", }, }, }, Pipelines: map[string]*resources.Pipeline{ "test_pipeline": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Name: "test_pipeline", }, }, "test_pipeline_new": { - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Name: "test_pipeline_new", }, }, }, Models: map[string]*resources.MlflowModel{ "test_mlflow_model": { - Model: &ml.Model{ + Model: ml.Model{ Name: "test_mlflow_model", }, }, "test_mlflow_model_new": { - Model: &ml.Model{ + Model: ml.Model{ Name: "test_mlflow_model_new", }, }, }, Experiments: map[string]*resources.MlflowExperiment{ "test_mlflow_experiment": { - Experiment: &ml.Experiment{ + Experiment: ml.Experiment{ Name: "test_mlflow_experiment", }, }, "test_mlflow_experiment_new": { - Experiment: &ml.Experiment{ + Experiment: ml.Experiment{ Name: "test_mlflow_experiment_new", }, }, }, ModelServingEndpoints: map[string]*resources.ModelServingEndpoint{ "test_model_serving": { - CreateServingEndpoint: &serving.CreateServingEndpoint{ + CreateServingEndpoint: serving.CreateServingEndpoint{ Name: "test_model_serving", }, }, "test_model_serving_new": { - CreateServingEndpoint: &serving.CreateServingEndpoint{ + CreateServingEndpoint: serving.CreateServingEndpoint{ Name: "test_model_serving_new", }, }, }, RegisteredModels: map[string]*resources.RegisteredModel{ "test_registered_model": { - CreateRegisteredModelRequest: &catalog.CreateRegisteredModelRequest{ + CreateRegisteredModelRequest: catalog.CreateRegisteredModelRequest{ Name: "test_registered_model", }, }, "test_registered_model_new": { - CreateRegisteredModelRequest: &catalog.CreateRegisteredModelRequest{ + CreateRegisteredModelRequest: catalog.CreateRegisteredModelRequest{ Name: "test_registered_model_new", }, }, }, QualityMonitors: map[string]*resources.QualityMonitor{ "test_monitor": { - CreateMonitor: &catalog.CreateMonitor{ + CreateMonitor: catalog.CreateMonitor{ TableName: "test_monitor", }, }, "test_monitor_new": { - CreateMonitor: &catalog.CreateMonitor{ + CreateMonitor: catalog.CreateMonitor{ TableName: "test_monitor_new", }, }, }, Schemas: map[string]*resources.Schema{ "test_schema": { - CreateSchema: &catalog.CreateSchema{ + CreateSchema: catalog.CreateSchema{ Name: "test_schema", }, }, "test_schema_new": { - CreateSchema: &catalog.CreateSchema{ + CreateSchema: catalog.CreateSchema{ Name: "test_schema_new", }, }, }, Volumes: map[string]*resources.Volume{ "test_volume": { - CreateVolumeRequestContent: &catalog.CreateVolumeRequestContent{ + CreateVolumeRequestContent: catalog.CreateVolumeRequestContent{ Name: "test_volume", }, }, "test_volume_new": { - CreateVolumeRequestContent: &catalog.CreateVolumeRequestContent{ + CreateVolumeRequestContent: catalog.CreateVolumeRequestContent{ Name: "test_volume_new", }, }, }, Clusters: map[string]*resources.Cluster{ "test_cluster": { - ClusterSpec: &compute.ClusterSpec{ + ClusterSpec: compute.ClusterSpec{ ClusterName: "test_cluster", }, }, "test_cluster_new": { - ClusterSpec: &compute.ClusterSpec{ + ClusterSpec: compute.ClusterSpec{ ClusterName: "test_cluster_new", }, }, }, Dashboards: map[string]*resources.Dashboard{ "test_dashboard": { - Dashboard: &dashboards.Dashboard{ + Dashboard: dashboards.Dashboard{ DisplayName: "test_dashboard", }, }, "test_dashboard_new": { - Dashboard: &dashboards.Dashboard{ + Dashboard: dashboards.Dashboard{ DisplayName: "test_dashboard_new", }, }, }, Apps: map[string]*resources.App{ "test_app": { - App: &apps.App{ + App: apps.App{ Name: "test_app", }, }, "test_app_new": { - App: &apps.App{ + App: apps.App{ Name: "test_app_new", }, }, diff --git a/bundle/deploy/terraform/interpolate_test.go b/bundle/deploy/terraform/interpolate_test.go index 91a7bd54a7..a9cc1dc80f 100644 --- a/bundle/deploy/terraform/interpolate_test.go +++ b/bundle/deploy/terraform/interpolate_test.go @@ -22,7 +22,7 @@ func TestInterpolate(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "my_job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tags: map[string]string{ "other_pipeline": "${resources.pipelines.other_pipeline.id}", "other_job": "${resources.jobs.other_job.id}", @@ -51,7 +51,7 @@ func TestInterpolate(t *testing.T) { }, Models: map[string]*resources.MlflowModel{ "my_model": { - Model: &ml.Model{ + Model: ml.Model{ Name: "my_model", }, }, @@ -86,7 +86,7 @@ func TestInterpolateUnknownResourceType(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "my_job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tags: map[string]string{ "other_unknown": "${resources.unknown.other_unknown.id}", }, diff --git a/bundle/deploy/terraform/tfdyn/convert_app_test.go b/bundle/deploy/terraform/tfdyn/convert_app_test.go index 4305692f70..f95a6419a5 100644 --- a/bundle/deploy/terraform/tfdyn/convert_app_test.go +++ b/bundle/deploy/terraform/tfdyn/convert_app_test.go @@ -19,7 +19,7 @@ func TestConvertApp(t *testing.T) { Config: map[string]any{ "command": []string{"python", "app.py"}, }, - App: &apps.App{ + App: apps.App{ Name: "app_id", Description: "app description", Resources: []apps.AppResource{ @@ -104,7 +104,7 @@ func TestConvertAppWithNoDescription(t *testing.T) { Config: map[string]any{ "command": []string{"python", "app.py"}, }, - App: &apps.App{ + App: apps.App{ Name: "app_id", Resources: []apps.AppResource{ { diff --git a/bundle/deploy/terraform/tfdyn/convert_cluster_test.go b/bundle/deploy/terraform/tfdyn/convert_cluster_test.go index 09388ab4d6..2e1f71f30a 100644 --- a/bundle/deploy/terraform/tfdyn/convert_cluster_test.go +++ b/bundle/deploy/terraform/tfdyn/convert_cluster_test.go @@ -15,7 +15,7 @@ import ( func TestConvertCluster(t *testing.T) { src := resources.Cluster{ - ClusterSpec: &compute.ClusterSpec{ + ClusterSpec: compute.ClusterSpec{ NumWorkers: 3, SparkVersion: "13.3.x-scala2.12", ClusterName: "cluster", diff --git a/bundle/deploy/terraform/tfdyn/convert_dashboard_test.go b/bundle/deploy/terraform/tfdyn/convert_dashboard_test.go index 0f95b60937..5d84949092 100644 --- a/bundle/deploy/terraform/tfdyn/convert_dashboard_test.go +++ b/bundle/deploy/terraform/tfdyn/convert_dashboard_test.go @@ -15,7 +15,7 @@ import ( func TestConvertDashboard(t *testing.T) { src := resources.Dashboard{ - Dashboard: &dashboards.Dashboard{ + Dashboard: dashboards.Dashboard{ DisplayName: "my dashboard", WarehouseId: "f00dcafe", ParentPath: "/some/path", diff --git a/bundle/deploy/terraform/tfdyn/convert_experiment_test.go b/bundle/deploy/terraform/tfdyn/convert_experiment_test.go index 68fe5cef5a..44c2cd820a 100644 --- a/bundle/deploy/terraform/tfdyn/convert_experiment_test.go +++ b/bundle/deploy/terraform/tfdyn/convert_experiment_test.go @@ -15,7 +15,7 @@ import ( func TestConvertExperiment(t *testing.T) { src := resources.MlflowExperiment{ - Experiment: &ml.Experiment{ + Experiment: ml.Experiment{ Name: "name", }, Permissions: []resources.MlflowExperimentPermission{ diff --git a/bundle/deploy/terraform/tfdyn/convert_job_test.go b/bundle/deploy/terraform/tfdyn/convert_job_test.go index 320469d858..8f4cfc2fa8 100644 --- a/bundle/deploy/terraform/tfdyn/convert_job_test.go +++ b/bundle/deploy/terraform/tfdyn/convert_job_test.go @@ -16,7 +16,7 @@ import ( func TestConvertJob(t *testing.T) { src := resources.Job{ - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "my job", JobClusters: []jobs.JobCluster{ { diff --git a/bundle/deploy/terraform/tfdyn/convert_model_serving_endpoint_test.go b/bundle/deploy/terraform/tfdyn/convert_model_serving_endpoint_test.go index 4c8c97e3a3..029478a10a 100644 --- a/bundle/deploy/terraform/tfdyn/convert_model_serving_endpoint_test.go +++ b/bundle/deploy/terraform/tfdyn/convert_model_serving_endpoint_test.go @@ -15,7 +15,7 @@ import ( func TestConvertModelServingEndpoint(t *testing.T) { src := resources.ModelServingEndpoint{ - CreateServingEndpoint: &serving.CreateServingEndpoint{ + CreateServingEndpoint: serving.CreateServingEndpoint{ Name: "name", Config: &serving.EndpointCoreConfigInput{ ServedModels: []serving.ServedModelInput{ diff --git a/bundle/deploy/terraform/tfdyn/convert_model_test.go b/bundle/deploy/terraform/tfdyn/convert_model_test.go index 97cccc2694..951965eaad 100644 --- a/bundle/deploy/terraform/tfdyn/convert_model_test.go +++ b/bundle/deploy/terraform/tfdyn/convert_model_test.go @@ -15,7 +15,7 @@ import ( func TestConvertModel(t *testing.T) { src := resources.MlflowModel{ - Model: &ml.Model{ + Model: ml.Model{ Name: "name", Description: "description", Tags: []ml.ModelTag{ diff --git a/bundle/deploy/terraform/tfdyn/convert_pipeline_test.go b/bundle/deploy/terraform/tfdyn/convert_pipeline_test.go index dfc7038fe4..45eb0b902e 100644 --- a/bundle/deploy/terraform/tfdyn/convert_pipeline_test.go +++ b/bundle/deploy/terraform/tfdyn/convert_pipeline_test.go @@ -15,7 +15,7 @@ import ( func TestConvertPipeline(t *testing.T) { src := resources.Pipeline{ - CreatePipeline: &pipelines.CreatePipeline{ + CreatePipeline: pipelines.CreatePipeline{ Name: "my pipeline", // This fields is not part of TF schema yet, but once we upgrade to TF version that supports it, this test will fail because run_as // will be exposed which is expected and test will need to be updated. diff --git a/bundle/deploy/terraform/tfdyn/convert_quality_monitor_test.go b/bundle/deploy/terraform/tfdyn/convert_quality_monitor_test.go index 16b30de71e..4e457ca3b3 100644 --- a/bundle/deploy/terraform/tfdyn/convert_quality_monitor_test.go +++ b/bundle/deploy/terraform/tfdyn/convert_quality_monitor_test.go @@ -16,7 +16,7 @@ import ( func TestConvertQualityMonitor(t *testing.T) { src := resources.QualityMonitor{ TableName: "test_table_name", - CreateMonitor: &catalog.CreateMonitor{ + CreateMonitor: catalog.CreateMonitor{ AssetsDir: "assets_dir", OutputSchemaName: "output_schema_name", InferenceLog: &catalog.MonitorInferenceLog{ diff --git a/bundle/deploy/terraform/tfdyn/convert_registered_model_test.go b/bundle/deploy/terraform/tfdyn/convert_registered_model_test.go index bf2a5ab640..633ec3eee4 100644 --- a/bundle/deploy/terraform/tfdyn/convert_registered_model_test.go +++ b/bundle/deploy/terraform/tfdyn/convert_registered_model_test.go @@ -15,7 +15,7 @@ import ( func TestConvertRegisteredModel(t *testing.T) { src := resources.RegisteredModel{ - CreateRegisteredModelRequest: &catalog.CreateRegisteredModelRequest{ + CreateRegisteredModelRequest: catalog.CreateRegisteredModelRequest{ Name: "name", CatalogName: "catalog", SchemaName: "schema", diff --git a/bundle/deploy/terraform/tfdyn/convert_schema_test.go b/bundle/deploy/terraform/tfdyn/convert_schema_test.go index 12822bb3ce..0f48ff66b0 100644 --- a/bundle/deploy/terraform/tfdyn/convert_schema_test.go +++ b/bundle/deploy/terraform/tfdyn/convert_schema_test.go @@ -15,7 +15,7 @@ import ( func TestConvertSchema(t *testing.T) { src := resources.Schema{ - CreateSchema: &catalog.CreateSchema{ + CreateSchema: catalog.CreateSchema{ Name: "name", CatalogName: "catalog", Comment: "comment", diff --git a/bundle/deploy/terraform/tfdyn/convert_volume_test.go b/bundle/deploy/terraform/tfdyn/convert_volume_test.go index 09b69489e3..176596f1df 100644 --- a/bundle/deploy/terraform/tfdyn/convert_volume_test.go +++ b/bundle/deploy/terraform/tfdyn/convert_volume_test.go @@ -15,7 +15,7 @@ import ( func TestConvertVolume(t *testing.T) { src := resources.Volume{ - CreateVolumeRequestContent: &catalog.CreateVolumeRequestContent{ + CreateVolumeRequestContent: catalog.CreateVolumeRequestContent{ CatalogName: "catalog", Comment: "comment", Name: "name", diff --git a/bundle/libraries/expand_glob_references_test.go b/bundle/libraries/expand_glob_references_test.go index 2dfbddb743..2ef333feeb 100644 --- a/bundle/libraries/expand_glob_references_test.go +++ b/bundle/libraries/expand_glob_references_test.go @@ -29,7 +29,7 @@ func TestGlobReferencesExpandedForTaskLibraries(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { TaskKey: "task", @@ -110,7 +110,7 @@ func TestGlobReferencesExpandedForForeachTaskLibraries(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { TaskKey: "task", @@ -195,7 +195,7 @@ func TestGlobReferencesExpandedForEnvironmentsDeps(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { TaskKey: "task", diff --git a/bundle/libraries/match_test.go b/bundle/libraries/match_test.go index 78765cbd4a..bf06cb2168 100644 --- a/bundle/libraries/match_test.go +++ b/bundle/libraries/match_test.go @@ -23,7 +23,7 @@ func TestValidateEnvironments(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Environments: []jobs.JobEnvironment{ { Spec: &compute.Environment{ @@ -55,7 +55,7 @@ func TestValidateEnvironmentsNoFile(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Environments: []jobs.JobEnvironment{ { Spec: &compute.Environment{ @@ -89,7 +89,7 @@ func TestValidateTaskLibraries(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { Libraries: []compute.Library{ @@ -122,7 +122,7 @@ func TestValidateTaskLibrariesNoFile(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { Libraries: []compute.Library{ diff --git a/bundle/libraries/switch_to_patched_wheels.go b/bundle/libraries/switch_to_patched_wheels.go index 58155f3493..d7f442bb58 100644 --- a/bundle/libraries/switch_to_patched_wheels.go +++ b/bundle/libraries/switch_to_patched_wheels.go @@ -25,11 +25,7 @@ func (c switchToPatchedWheels) Apply(ctx context.Context, b *bundle.Bundle) diag continue } - job := jobRef.JobSettings - - if job == nil { - continue - } + job := &jobRef.JobSettings for taskInd, task := range job.Tasks { // Update resources.jobs.*.task[*].libraries[*].whl diff --git a/bundle/libraries/upload_test.go b/bundle/libraries/upload_test.go index 3ce67eeb6a..5c58b88e5f 100644 --- a/bundle/libraries/upload_test.go +++ b/bundle/libraries/upload_test.go @@ -40,7 +40,7 @@ func TestArtifactUploadForWorkspace(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { Libraries: []compute.Library{ @@ -128,7 +128,7 @@ func TestArtifactUploadForVolumes(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { Libraries: []compute.Library{ @@ -248,7 +248,7 @@ func TestUploadMultipleLibraries(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { Libraries: []compute.Library{ diff --git a/bundle/permissions/validate_test.go b/bundle/permissions/validate_test.go index aa0b486d38..16dc8c7056 100644 --- a/bundle/permissions/validate_test.go +++ b/bundle/permissions/validate_test.go @@ -24,8 +24,8 @@ func TestValidateSharedRootPermissionsForShared(t *testing.T) { }, Resources: config.Resources{ Jobs: map[string]*resources.Job{ - "job_1": {JobSettings: &jobs.JobSettings{Name: "job_1"}}, - "job_2": {JobSettings: &jobs.JobSettings{Name: "job_2"}}, + "job_1": {JobSettings: jobs.JobSettings{Name: "job_1"}}, + "job_2": {JobSettings: jobs.JobSettings{Name: "job_2"}}, }, }, }, @@ -49,8 +49,8 @@ func TestValidateSharedRootPermissionsForSharedError(t *testing.T) { }, Resources: config.Resources{ Jobs: map[string]*resources.Job{ - "job_1": {JobSettings: &jobs.JobSettings{Name: "job_1"}}, - "job_2": {JobSettings: &jobs.JobSettings{Name: "job_2"}}, + "job_1": {JobSettings: jobs.JobSettings{Name: "job_1"}}, + "job_2": {JobSettings: jobs.JobSettings{Name: "job_2"}}, }, }, }, diff --git a/bundle/permissions/workspace_root_test.go b/bundle/permissions/workspace_root_test.go index f9c5da7d67..417c6bde6f 100644 --- a/bundle/permissions/workspace_root_test.go +++ b/bundle/permissions/workspace_root_test.go @@ -34,24 +34,24 @@ func TestApplyWorkspaceRootPermissions(t *testing.T) { }, Resources: config.Resources{ Jobs: map[string]*resources.Job{ - "job_1": {JobSettings: &jobs.JobSettings{Name: "job_1"}}, - "job_2": {JobSettings: &jobs.JobSettings{Name: "job_2"}}, + "job_1": {JobSettings: jobs.JobSettings{Name: "job_1"}}, + "job_2": {JobSettings: jobs.JobSettings{Name: "job_2"}}, }, Pipelines: map[string]*resources.Pipeline{ - "pipeline_1": {CreatePipeline: &pipelines.CreatePipeline{}}, - "pipeline_2": {CreatePipeline: &pipelines.CreatePipeline{}}, + "pipeline_1": {CreatePipeline: pipelines.CreatePipeline{}}, + "pipeline_2": {CreatePipeline: pipelines.CreatePipeline{}}, }, Models: map[string]*resources.MlflowModel{ - "model_1": {Model: &ml.Model{}}, - "model_2": {Model: &ml.Model{}}, + "model_1": {Model: ml.Model{}}, + "model_2": {Model: ml.Model{}}, }, Experiments: map[string]*resources.MlflowExperiment{ - "experiment_1": {Experiment: &ml.Experiment{}}, - "experiment_2": {Experiment: &ml.Experiment{}}, + "experiment_1": {Experiment: ml.Experiment{}}, + "experiment_2": {Experiment: ml.Experiment{}}, }, ModelServingEndpoints: map[string]*resources.ModelServingEndpoint{ - "endpoint_1": {CreateServingEndpoint: &serving.CreateServingEndpoint{}}, - "endpoint_2": {CreateServingEndpoint: &serving.CreateServingEndpoint{}}, + "endpoint_1": {CreateServingEndpoint: serving.CreateServingEndpoint{}}, + "endpoint_2": {CreateServingEndpoint: serving.CreateServingEndpoint{}}, }, }, }, @@ -94,24 +94,24 @@ func TestApplyWorkspaceRootPermissionsForAllPaths(t *testing.T) { }, Resources: config.Resources{ Jobs: map[string]*resources.Job{ - "job_1": {JobSettings: &jobs.JobSettings{Name: "job_1"}}, - "job_2": {JobSettings: &jobs.JobSettings{Name: "job_2"}}, + "job_1": {JobSettings: jobs.JobSettings{Name: "job_1"}}, + "job_2": {JobSettings: jobs.JobSettings{Name: "job_2"}}, }, Pipelines: map[string]*resources.Pipeline{ - "pipeline_1": {CreatePipeline: &pipelines.CreatePipeline{}}, - "pipeline_2": {CreatePipeline: &pipelines.CreatePipeline{}}, + "pipeline_1": {CreatePipeline: pipelines.CreatePipeline{}}, + "pipeline_2": {CreatePipeline: pipelines.CreatePipeline{}}, }, Models: map[string]*resources.MlflowModel{ - "model_1": {Model: &ml.Model{}}, - "model_2": {Model: &ml.Model{}}, + "model_1": {Model: ml.Model{}}, + "model_2": {Model: ml.Model{}}, }, Experiments: map[string]*resources.MlflowExperiment{ - "experiment_1": {Experiment: &ml.Experiment{}}, - "experiment_2": {Experiment: &ml.Experiment{}}, + "experiment_1": {Experiment: ml.Experiment{}}, + "experiment_2": {Experiment: ml.Experiment{}}, }, ModelServingEndpoints: map[string]*resources.ModelServingEndpoint{ - "endpoint_1": {CreateServingEndpoint: &serving.CreateServingEndpoint{}}, - "endpoint_2": {CreateServingEndpoint: &serving.CreateServingEndpoint{}}, + "endpoint_1": {CreateServingEndpoint: serving.CreateServingEndpoint{}}, + "endpoint_2": {CreateServingEndpoint: serving.CreateServingEndpoint{}}, }, }, }, diff --git a/bundle/render/render_text_output_test.go b/bundle/render/render_text_output_test.go index d092e77c8c..a754ecdd69 100644 --- a/bundle/render/render_text_output_test.go +++ b/bundle/render/render_text_output_test.go @@ -514,34 +514,30 @@ func TestRenderSummary(t *testing.T) { "job1": { ID: "1", URL: "https://url1", - JobSettings: &jobs.JobSettings{Name: "job1-name"}, + JobSettings: jobs.JobSettings{Name: "job1-name"}, }, "job2": { ID: "2", URL: "https://url2", - JobSettings: &jobs.JobSettings{Name: "job2-name"}, - }, - "job3": { - ID: "3", - URL: "https://url3", // This emulates deleted job + JobSettings: jobs.JobSettings{Name: "job2-name"}, }, }, Pipelines: map[string]*resources.Pipeline{ "pipeline2": { ID: "4", // no URL - CreatePipeline: &pipelines.CreatePipeline{Name: "pipeline2-name"}, + CreatePipeline: pipelines.CreatePipeline{Name: "pipeline2-name"}, }, "pipeline1": { ID: "3", URL: "https://url3", - CreatePipeline: &pipelines.CreatePipeline{Name: "pipeline1-name"}, + CreatePipeline: pipelines.CreatePipeline{Name: "pipeline1-name"}, }, }, Schemas: map[string]*resources.Schema{ "schema1": { ID: "catalog.schema", - CreateSchema: &catalog.CreateSchema{ + CreateSchema: catalog.CreateSchema{ Name: "schema", }, // no URL @@ -550,7 +546,7 @@ func TestRenderSummary(t *testing.T) { ModelServingEndpoints: map[string]*resources.ModelServingEndpoint{ "endpoint1": { ID: "7", - CreateServingEndpoint: &serving.CreateServingEndpoint{ + CreateServingEndpoint: serving.CreateServingEndpoint{ Name: "my_serving_endpoint", }, URL: "https://url4", diff --git a/bundle/resources/completion_test.go b/bundle/resources/completion_test.go index 56559f18c9..8e736a36b4 100644 --- a/bundle/resources/completion_test.go +++ b/bundle/resources/completion_test.go @@ -17,15 +17,15 @@ func TestCompletions_SkipDuplicates(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "foo": { - JobSettings: &jobs.JobSettings{}, + JobSettings: jobs.JobSettings{}, }, "bar": { - JobSettings: &jobs.JobSettings{}, + JobSettings: jobs.JobSettings{}, }, }, Pipelines: map[string]*resources.Pipeline{ "foo": { - CreatePipeline: &pipelines.CreatePipeline{}, + CreatePipeline: pipelines.CreatePipeline{}, }, }, }, @@ -45,12 +45,12 @@ func TestCompletions_Filter(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "foo": { - JobSettings: &jobs.JobSettings{}, + JobSettings: jobs.JobSettings{}, }, }, Pipelines: map[string]*resources.Pipeline{ "bar": { - CreatePipeline: &pipelines.CreatePipeline{}, + CreatePipeline: pipelines.CreatePipeline{}, }, }, }, diff --git a/bundle/resources/lookup_test.go b/bundle/resources/lookup_test.go index d95da977ac..328aca60f1 100644 --- a/bundle/resources/lookup_test.go +++ b/bundle/resources/lookup_test.go @@ -30,10 +30,10 @@ func TestLookup_NotFound(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "foo": { - JobSettings: &jobs.JobSettings{}, + JobSettings: jobs.JobSettings{}, }, "bar": { - JobSettings: &jobs.JobSettings{}, + JobSettings: jobs.JobSettings{}, }, }, }, @@ -51,12 +51,12 @@ func TestLookup_MultipleFound(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "foo": { - JobSettings: &jobs.JobSettings{}, + JobSettings: jobs.JobSettings{}, }, }, Pipelines: map[string]*resources.Pipeline{ "foo": { - CreatePipeline: &pipelines.CreatePipeline{}, + CreatePipeline: pipelines.CreatePipeline{}, }, }, }, @@ -74,7 +74,7 @@ func TestLookup_Nominal(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "foo": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Name: "Foo job", }, }, @@ -102,12 +102,12 @@ func TestLookup_NominalWithFilters(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "foo": { - JobSettings: &jobs.JobSettings{}, + JobSettings: jobs.JobSettings{}, }, }, Pipelines: map[string]*resources.Pipeline{ "bar": { - CreatePipeline: &pipelines.CreatePipeline{}, + CreatePipeline: pipelines.CreatePipeline{}, }, }, }, diff --git a/bundle/run/app_test.go b/bundle/run/app_test.go index cd06503280..0d3d325d93 100644 --- a/bundle/run/app_test.go +++ b/bundle/run/app_test.go @@ -55,7 +55,7 @@ func setupBundle(t *testing.T) (context.Context, *bundle.Bundle, *mocks.MockWork Resources: config.Resources{ Apps: map[string]*resources.App{ "my_app": { - App: &apps.App{ + App: apps.App{ Name: "my_app", }, SourceCodePath: "./my_app", diff --git a/bundle/run/job.go b/bundle/run/job.go index 2489ca619d..dbd2ffcc78 100644 --- a/bundle/run/job.go +++ b/bundle/run/job.go @@ -31,7 +31,7 @@ type jobRunner struct { } func (r *jobRunner) Name() string { - if r.job == nil || r.job.JobSettings == nil { + if r.job == nil { return "" } return r.job.JobSettings.Name diff --git a/bundle/run/job_args.go b/bundle/run/job_args.go index b1596bbb01..40434f8396 100644 --- a/bundle/run/job_args.go +++ b/bundle/run/job_args.go @@ -121,7 +121,7 @@ const ( func (r *jobRunner) posArgsHandler() argsHandler { job := r.job - if job == nil || job.JobSettings == nil { + if job == nil { return nopArgsHandler{} } diff --git a/bundle/run/job_args_test.go b/bundle/run/job_args_test.go index 7099949079..41a3c29e23 100644 --- a/bundle/run/job_args_test.go +++ b/bundle/run/job_args_test.go @@ -11,7 +11,7 @@ import ( func TestJobParameterArgs(t *testing.T) { a := jobParameterArgs{ &resources.Job{ - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Parameters: []jobs.JobParameterDefinition{ { Name: "foo", @@ -70,7 +70,7 @@ func TestJobParameterArgs(t *testing.T) { func TestJobTaskNotebookParamArgs(t *testing.T) { a := jobTaskNotebookParamArgs{ &resources.Job{ - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { NotebookTask: &jobs.NotebookTask{ diff --git a/bundle/run/job_options_test.go b/bundle/run/job_options_test.go index 08e18d95d8..f5ae401d1b 100644 --- a/bundle/run/job_options_test.go +++ b/bundle/run/job_options_test.go @@ -188,7 +188,7 @@ func TestJobOptionsSqlParamsMultiple(t *testing.T) { func TestJobOptionsValidateIfJobHasJobParameters(t *testing.T) { job := &resources.Job{ - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Parameters: []jobs.JobParameterDefinition{ { Name: "param", @@ -219,7 +219,7 @@ func TestJobOptionsValidateIfJobHasJobParameters(t *testing.T) { func TestJobOptionsValidateIfJobHasNoJobParameters(t *testing.T) { job := &resources.Job{ - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Parameters: []jobs.JobParameterDefinition{}, }, } diff --git a/bundle/run/job_test.go b/bundle/run/job_test.go index daf6cf063e..0b96404df3 100644 --- a/bundle/run/job_test.go +++ b/bundle/run/job_test.go @@ -18,7 +18,7 @@ import ( func TestConvertPythonParams(t *testing.T) { job := &resources.Job{ - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ {PythonWheelTask: &jobs.PythonWheelTask{ PackageName: "my_test_code", @@ -132,7 +132,7 @@ func TestJobRunnerCancelWithNoActiveRuns(t *testing.T) { } func TestJobRunnerRestart(t *testing.T) { - for _, jobSettings := range []*jobs.JobSettings{ + for _, jobSettings := range []jobs.JobSettings{ {}, { Continuous: &jobs.Continuous{ @@ -209,7 +209,7 @@ func TestJobRunnerRestart(t *testing.T) { func TestJobRunnerRestartForContinuousUnpausedJobs(t *testing.T) { job := &resources.Job{ ID: "123", - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Continuous: &jobs.Continuous{ PauseStatus: jobs.PauseStatusUnpaused, }, diff --git a/bundle/run/pipeline.go b/bundle/run/pipeline.go index 8ba62989f6..3a08e4acaf 100644 --- a/bundle/run/pipeline.go +++ b/bundle/run/pipeline.go @@ -79,7 +79,7 @@ type pipelineRunner struct { } func (r *pipelineRunner) Name() string { - if r.pipeline == nil || r.pipeline.CreatePipeline == nil { + if r.pipeline == nil { return "" } return r.pipeline.CreatePipeline.Name diff --git a/bundle/tests/run_as_test.go b/bundle/tests/run_as_test.go index b9d1a7d546..58174e44c3 100644 --- a/bundle/tests/run_as_test.go +++ b/bundle/tests/run_as_test.go @@ -52,9 +52,9 @@ func TestRunAsForAllowed(t *testing.T) { assert.Equal(t, "", jobs["job_three"].RunAs.UserName) // Assert other resources are not affected. - assert.Equal(t, ml.Model{Name: "skynet"}, *b.Config.Resources.Models["model_one"].Model) - assert.Equal(t, catalog.CreateRegisteredModelRequest{Name: "skynet (in UC)"}, *b.Config.Resources.RegisteredModels["model_two"].CreateRegisteredModelRequest) - assert.Equal(t, ml.Experiment{Name: "experiment_one"}, *b.Config.Resources.Experiments["experiment_one"].Experiment) + assert.Equal(t, ml.Model{Name: "skynet"}, b.Config.Resources.Models["model_one"].Model) + assert.Equal(t, catalog.CreateRegisteredModelRequest{Name: "skynet (in UC)"}, b.Config.Resources.RegisteredModels["model_two"].CreateRegisteredModelRequest) + assert.Equal(t, ml.Experiment{Name: "experiment_one"}, b.Config.Resources.Experiments["experiment_one"].Experiment) } func TestRunAsForAllowedWithTargetOverride(t *testing.T) { @@ -92,9 +92,9 @@ func TestRunAsForAllowedWithTargetOverride(t *testing.T) { assert.Equal(t, "", jobs["job_three"].RunAs.UserName) // Assert other resources are not affected. - assert.Equal(t, ml.Model{Name: "skynet"}, *b.Config.Resources.Models["model_one"].Model) - assert.Equal(t, catalog.CreateRegisteredModelRequest{Name: "skynet (in UC)"}, *b.Config.Resources.RegisteredModels["model_two"].CreateRegisteredModelRequest) - assert.Equal(t, ml.Experiment{Name: "experiment_one"}, *b.Config.Resources.Experiments["experiment_one"].Experiment) + assert.Equal(t, ml.Model{Name: "skynet"}, b.Config.Resources.Models["model_one"].Model) + assert.Equal(t, catalog.CreateRegisteredModelRequest{Name: "skynet (in UC)"}, b.Config.Resources.RegisteredModels["model_two"].CreateRegisteredModelRequest) + assert.Equal(t, ml.Experiment{Name: "experiment_one"}, b.Config.Resources.Experiments["experiment_one"].Experiment) } func TestRunAsErrorForPipelines(t *testing.T) { @@ -308,8 +308,8 @@ func TestLegacyRunAs(t *testing.T) { }, pipelines["nyc_taxi_pipeline"].Permissions[1]) // Assert other resources are not affected. - assert.Equal(t, ml.Model{Name: "skynet"}, *b.Config.Resources.Models["model_one"].Model) - assert.Equal(t, catalog.CreateRegisteredModelRequest{Name: "skynet (in UC)"}, *b.Config.Resources.RegisteredModels["model_two"].CreateRegisteredModelRequest) - assert.Equal(t, ml.Experiment{Name: "experiment_one"}, *b.Config.Resources.Experiments["experiment_one"].Experiment) - assert.Equal(t, serving.CreateServingEndpoint{Name: "skynet"}, *b.Config.Resources.ModelServingEndpoints["model_serving_one"].CreateServingEndpoint) + assert.Equal(t, ml.Model{Name: "skynet"}, b.Config.Resources.Models["model_one"].Model) + assert.Equal(t, catalog.CreateRegisteredModelRequest{Name: "skynet (in UC)"}, b.Config.Resources.RegisteredModels["model_two"].CreateRegisteredModelRequest) + assert.Equal(t, ml.Experiment{Name: "experiment_one"}, b.Config.Resources.Experiments["experiment_one"].Experiment) + assert.Equal(t, serving.CreateServingEndpoint{Name: "skynet"}, b.Config.Resources.ModelServingEndpoints["model_serving_one"].CreateServingEndpoint) } diff --git a/bundle/trampoline/conditional_transform_test.go b/bundle/trampoline/conditional_transform_test.go index 57aa9aac39..0e4517953a 100644 --- a/bundle/trampoline/conditional_transform_test.go +++ b/bundle/trampoline/conditional_transform_test.go @@ -29,7 +29,7 @@ func TestNoTransformByDefault(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job1": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { TaskKey: "key1", @@ -78,7 +78,7 @@ func TestTransformWithExperimentalSettingSetToTrue(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job1": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { TaskKey: "key1", diff --git a/bundle/trampoline/python_dbr_warning_test.go b/bundle/trampoline/python_dbr_warning_test.go index 4d9fa7b334..2aa6572999 100644 --- a/bundle/trampoline/python_dbr_warning_test.go +++ b/bundle/trampoline/python_dbr_warning_test.go @@ -20,7 +20,7 @@ func TestIncompatibleWheelTasksWithNewCluster(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job1": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { TaskKey: "key1", @@ -60,7 +60,7 @@ func TestIncompatibleWheelTasksWithJobClusterKey(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job1": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ JobClusters: []jobs.JobCluster{ { JobClusterKey: "cluster1", @@ -113,7 +113,7 @@ func TestIncompatibleWheelTasksWithExistingClusterId(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job1": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { TaskKey: "key1", @@ -160,7 +160,7 @@ func TestNoIncompatibleWheelTasks(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job1": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ JobClusters: []jobs.JobCluster{ { JobClusterKey: "cluster1", @@ -266,7 +266,7 @@ func TestTasksWithPyPiPackageAreCompatible(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job1": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ JobClusters: []jobs.JobCluster{ { JobClusterKey: "cluster1", @@ -310,7 +310,7 @@ func TestNoWarningWhenPythonWheelWrapperIsOn(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job1": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { TaskKey: "key1", diff --git a/bundle/trampoline/python_wheel_test.go b/bundle/trampoline/python_wheel_test.go index d75a3eca35..4164159dda 100644 --- a/bundle/trampoline/python_wheel_test.go +++ b/bundle/trampoline/python_wheel_test.go @@ -77,7 +77,7 @@ func TestTransformFiltersWheelTasksOnly(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "job1": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { TaskKey: "key1", @@ -123,7 +123,7 @@ func TestNoPanicWithNoPythonWheelTasks(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "test": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { TaskKey: "notebook_task", diff --git a/bundle/trampoline/trampoline_test.go b/bundle/trampoline/trampoline_test.go index 1a80bb126c..b020a5ad4f 100644 --- a/bundle/trampoline/trampoline_test.go +++ b/bundle/trampoline/trampoline_test.go @@ -69,7 +69,7 @@ func TestGenerateTrampoline(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "test": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: tasks, }, }, diff --git a/integration/bundle/artifacts_test.go b/integration/bundle/artifacts_test.go index 125b5febd9..83d5af2297 100644 --- a/integration/bundle/artifacts_test.go +++ b/integration/bundle/artifacts_test.go @@ -63,7 +63,7 @@ func TestUploadArtifactFileToCorrectRemotePath(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "test": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { Libraries: []compute.Library{ @@ -127,7 +127,7 @@ func TestUploadArtifactFileToCorrectRemotePathWithEnvironments(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "test": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Environments: []jobs.JobEnvironment{ { Spec: &compute.Environment{ @@ -196,7 +196,7 @@ func TestUploadArtifactFileToCorrectRemotePathForVolumes(t *testing.T) { Resources: config.Resources{ Jobs: map[string]*resources.Job{ "test": { - JobSettings: &jobs.JobSettings{ + JobSettings: jobs.JobSettings{ Tasks: []jobs.Task{ { Libraries: []compute.Library{