Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@

### Bundles
* The error reported when a direct-only resource (catalogs, external locations, vector search endpoints) is used with the terraform engine now also suggests setting `bundle.engine: direct` in `databricks.yml`, in addition to the `DATABRICKS_BUNDLE_ENGINE` environment variable ([#5295](https://github.com/databricks/cli/pull/5295)).

### Dependency updates
* Bump Go toolchain to 1.26.3 ([#5302](https://github.com/databricks/cli/pull/5302)).
6 changes: 2 additions & 4 deletions bundle/config/resources/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ func TestDashboardConfigIsSupersetOfSDKDashboard(t *testing.T) {

// Create a map of SDK fields by name and their JSON tags
sdkFields := make(map[string]string)
for i := range sdkType.NumField() {
field := sdkType.Field(i)
for field := range sdkType.Fields() {
jsonTag := field.Tag.Get("json")
jsonName := getJSONTagName(jsonTag)
if jsonName != "" {
Expand All @@ -40,8 +39,7 @@ func TestDashboardConfigIsSupersetOfSDKDashboard(t *testing.T) {

// Create a map of config fields by name and their JSON tags
configFields := make(map[string]string)
for i := range configType.NumField() {
field := configType.Field(i)
for field := range configType.Fields() {
jsonTag := field.Tag.Get("json")
jsonName := getJSONTagName(jsonTag)
if jsonName != "" {
Expand Down
10 changes: 3 additions & 7 deletions bundle/config/resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ import (
func TestCustomMarshallerIsImplemented(t *testing.T) {
rt := reflect.TypeFor[Resources]()

for i := range rt.NumField() {
field := rt.Field(i)

for field := range rt.Fields() {
// Fields in Resources are expected be of the form map[string]*resourceStruct
assert.Equal(t, reflect.Map, field.Type.Kind(), "Resource %s is not a map", field.Name)
kt := field.Type.Key()
Expand Down Expand Up @@ -95,8 +93,7 @@ func TestResourcesAllResourcesCompleteness(t *testing.T) {
types = append(types, group.Description.PluralName)
}

for i := range rt.NumField() {
field := rt.Field(i)
for field := range rt.Fields() {
jsonTag := field.Tag.Get("json")

if idx := strings.Index(jsonTag, ","); idx != -1 {
Expand All @@ -112,8 +109,7 @@ func TestSupportedResources(t *testing.T) {
actual := SupportedResources()

typ := reflect.TypeFor[Resources]()
for i := range typ.NumField() {
field := typ.Field(i)
for field := range typ.Fields() {
jsonTags := strings.Split(field.Tag.Get("json"), ",")
pluralName := jsonTags[0]
assert.Equal(t, actual[pluralName].PluralName, pluralName)
Expand Down
8 changes: 2 additions & 6 deletions bundle/deploy/terraform/tfdyn/convert_job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,7 @@ func TestSupportedTypeTasksComplete(t *testing.T) {
taskType := reflect.TypeFor[jobs.Task]()
var tasksWithSource []string

for i := range taskType.NumField() {
field := taskType.Field(i)

for field := range taskType.Fields() {
// Skip non-task fields (like DependsOn, Libraries, etc.)
if !strings.HasSuffix(field.Name, "Task") {
continue
Expand Down Expand Up @@ -351,9 +349,7 @@ func findSourceFieldsShallow(t reflect.Type) []string {

var paths []string

for i := range t.NumField() {
field := t.Field(i)

for field := range t.Fields() {
// Check if this field is named "Source"
if field.Name == "Source" {
paths = append(paths, "")
Expand Down
3 changes: 1 addition & 2 deletions bundle/direct/dresources/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ func TestAppDoUpdate_UpdateMaskHasAllFields(t *testing.T) {

fields := reflect.TypeFor[apps.App]()
var allFields []string
for i := range fields.NumField() {
field := fields.Field(i)
for field := range fields.Fields() {
jsonTag := field.Tag.Get("json")
if jsonTag == "" || jsonTag == "-" {
continue
Expand Down
6 changes: 2 additions & 4 deletions bundle/direct/dresources/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ import (
func assertFieldsCovered(t *testing.T, sdkType, remoteType reflect.Type, skip map[string]bool) {
t.Helper()
remoteFields := map[string]bool{}
for i := range remoteType.NumField() {
f := remoteType.Field(i)
for f := range remoteType.Fields() {
if !f.Anonymous {
remoteFields[f.Name] = true
}
}

for i := range sdkType.NumField() {
field := sdkType.Field(i)
for field := range sdkType.Fields() {
if skip[field.Name] {
assert.NotContains(t, remoteFields, field.Name, "field %s is in skip list but present in %s; remove it from skip", field.Name, remoteType.Name())
continue
Expand Down
12 changes: 4 additions & 8 deletions bundle/docsgen/nodes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestBuildNodes_ChildExpansion(t *testing.T) {
Items: &jsonschema.Schema{
Type: "object",
Properties: map[string]*jsonschema.Schema{
"listSub": {Reference: strPtr("#/$defs/github.com/listSub")},
"listSub": {Reference: new("#/$defs/github.com/listSub")},
},
},
},
Expand Down Expand Up @@ -61,9 +61,9 @@ func TestBuildNodes_ChildExpansion(t *testing.T) {
"myMap": {
Type: "object",
AdditionalProperties: &jsonschema.Schema{
Reference: strPtr("#/$defs/github.com/myMap"),
Reference: new("#/$defs/github.com/myMap"),
Properties: map[string]*jsonschema.Schema{
"mapSub": {Type: "object", Reference: strPtr("#/$defs/github.com/mapSub")},
"mapSub": {Type: "object", Reference: new("#/$defs/github.com/mapSub")},
},
},
},
Expand All @@ -73,7 +73,7 @@ func TestBuildNodes_ChildExpansion(t *testing.T) {
"github.com/myMap": {
Type: "object",
Properties: map[string]*jsonschema.Schema{
"mapSub": {Type: "boolean", Reference: strPtr("#/$defs/github.com/mapSub")},
"mapSub": {Type: "boolean", Reference: new("#/$defs/github.com/mapSub")},
},
},
"github.com/mapSub": {
Expand Down Expand Up @@ -170,7 +170,3 @@ func TestDoNotSuggestFields(t *testing.T) {
assert.Len(t, nodes[0].Attributes, 1)
assert.Equal(t, "nestedNotDoNotSuggestField", nodes[0].Attributes[0].Title)
}

func strPtr(s string) *string {
return &s
}
6 changes: 3 additions & 3 deletions bundle/internal/schema/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ func (p *openapiParser) findRef(typ reflect.Type) (jsonschema.Schema, bool) {

// Check for embedded Databricks Go SDK types.
if typ.Kind() == reflect.Struct {
for i := range typ.NumField() {
if !typ.Field(i).Anonymous {
for field := range typ.Fields() {
if !field.Anonymous {
continue
}

// Deference current type if it's a pointer.
ctyp := typ.Field(i).Type
ctyp := field.Type
for ctyp.Kind() == reflect.Ptr {
ctyp = ctyp.Elem()
}
Expand Down
4 changes: 2 additions & 2 deletions bundle/internal/tf/codegen/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/databricks/cli/bundle/internal/tf/codegen

go 1.25.8
go 1.26.0

toolchain go1.25.10
toolchain go1.26.3

require (
github.com/hashicorp/go-version v1.9.0
Expand Down
43 changes: 20 additions & 23 deletions cmd/pipelines/history_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@ func TestUpdatesBefore(t *testing.T) {
}{
{
name: "before 700",
timestamp: int64Ptr(700),
timestamp: new(int64(700)),
expectedCount: 3,
expectedFirst: 600,
},
{
name: "before 1000",
timestamp: int64Ptr(1000),
timestamp: new(int64(1000)),
expectedCount: 5,
expectedFirst: 1000,
},
{
name: "before 200",
timestamp: int64Ptr(200),
timestamp: new(int64(200)),
expectedCount: 1,
expectedFirst: 200,
},
{
name: "before 100",
timestamp: int64Ptr(100),
timestamp: new(int64(100)),
expectedCount: 0,
expectedFirst: 0,
},
Expand Down Expand Up @@ -79,25 +79,25 @@ func TestUpdatesAfter(t *testing.T) {
}{
{
name: "after 500",
timestamp: int64Ptr(500),
timestamp: new(int64(500)),
expectedCount: 3,
expectedFirst: 1000,
},
{
name: "after 200",
timestamp: int64Ptr(200),
timestamp: new(int64(200)),
expectedCount: 5,
expectedFirst: 1000,
},
{
name: "after 1000",
timestamp: int64Ptr(1000),
timestamp: new(int64(1000)),
expectedCount: 1,
expectedFirst: 1000,
},
{
name: "after 1200",
timestamp: int64Ptr(1200),
timestamp: new(int64(1200)),
expectedCount: 0,
expectedFirst: 0,
},
Expand Down Expand Up @@ -181,15 +181,15 @@ func TestFilterUpdates(t *testing.T) {
name: "start time nil, end time set",
updates: updates,
startTime: nil,
endTime: int64Ptr(700),
endTime: new(int64(700)),
expectedCount: 3,
expectedFirst: 600,
expectedLast: 200,
},
{
name: "start time set, end time nil",
updates: updates,
startTime: int64Ptr(500),
startTime: new(int64(500)),
endTime: nil,
expectedCount: 3,
expectedFirst: 1000,
Expand All @@ -198,25 +198,25 @@ func TestFilterUpdates(t *testing.T) {
{
name: "both times set within range",
updates: updates,
startTime: int64Ptr(300),
endTime: int64Ptr(900),
startTime: new(int64(300)),
endTime: new(int64(900)),
expectedCount: 3,
expectedFirst: 800,
expectedLast: 400,
},
{
name: "both times set, no overlap",
updates: updates,
startTime: int64Ptr(1200),
endTime: int64Ptr(1500),
startTime: new(int64(1200)),
endTime: new(int64(1500)),
expectedCount: 0,
expectedFirst: 0,
expectedLast: 0,
},
{
name: "start time after all updates",
updates: updates,
startTime: int64Ptr(1200),
startTime: new(int64(1200)),
endTime: nil,
expectedCount: 0,
expectedFirst: 0,
Expand All @@ -226,25 +226,25 @@ func TestFilterUpdates(t *testing.T) {
name: "end time before all updates",
updates: updates,
startTime: nil,
endTime: int64Ptr(100),
endTime: new(int64(100)),
expectedCount: 0,
expectedFirst: 0,
expectedLast: 0,
},
{
name: "start time after end time but within range",
updates: updates,
startTime: int64Ptr(700),
endTime: int64Ptr(500),
startTime: new(int64(700)),
endTime: new(int64(500)),
expectedCount: 0,
expectedFirst: 0,
expectedLast: 0,
},
{
name: "start and end time match exact values in list",
updates: updates,
startTime: int64Ptr(400),
endTime: int64Ptr(800),
startTime: new(int64(400)),
endTime: new(int64(800)),
expectedCount: 3,
expectedFirst: 800,
expectedLast: 400,
Expand Down Expand Up @@ -289,6 +289,3 @@ func TestFilterUpdates(t *testing.T) {
})
}
}

// Helper function to create int64 pointers
func int64Ptr(v int64) *int64 { return &v }
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/databricks/cli

go 1.25.8
go 1.26.0

toolchain go1.25.10
toolchain go1.26.3

require (
dario.cat/mergo v1.0.2 // BSD-3-Clause
Expand Down
Loading
Loading