fix: Add SyncRoot mock to tests

This commit is contained in:
Ilya Kuznetsov 2024-11-05 19:03:27 +01:00
parent ae26beabfe
commit fbb9be9bdc
No known key found for this signature in database
GPG Key ID: 91F3DDCF5D21CDDF
2 changed files with 9 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import (
"github.com/databricks/cli/bundle/config"
"github.com/databricks/cli/bundle/config/mutator"
"github.com/databricks/cli/bundle/config/resources"
"github.com/databricks/cli/libs/vfs"
"github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/databricks/databricks-sdk-go/service/jobs"
"github.com/stretchr/testify/require"
@ -55,6 +56,7 @@ func TestApplyPresetsPrefix(t *testing.T) {
NamePrefix: tt.prefix,
},
},
SyncRoot: vfs.MustNew(t.TempDir()),
}
ctx := context.Background()
@ -101,6 +103,7 @@ func TestApplyPresetsPrefixForUcSchema(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
b := &bundle.Bundle{
SyncRoot: vfs.MustNew(t.TempDir()),
Config: config.Root{
Resources: config.Resources{
Schemas: map[string]*resources.Schema{
@ -180,6 +183,7 @@ func TestApplyPresetsTags(t *testing.T) {
Tags: tt.tags,
},
},
SyncRoot: vfs.MustNew(t.TempDir()),
}
ctx := context.Background()
@ -239,6 +243,7 @@ func TestApplyPresetsJobsMaxConcurrentRuns(t *testing.T) {
JobsMaxConcurrentRuns: tt.setting,
},
},
SyncRoot: vfs.MustNew(t.TempDir()),
}
ctx := context.Background()
diag := bundle.Apply(ctx, b, mutator.ApplyPresets())
@ -264,6 +269,7 @@ func TestApplyPresetsPrefixWithoutJobSettings(t *testing.T) {
NamePrefix: "prefix-",
},
},
SyncRoot: vfs.MustNew(t.TempDir()),
}
ctx := context.Background()
@ -355,6 +361,7 @@ func TestApplyPresetsResourceNotDefined(t *testing.T) {
TriggerPauseStatus: config.Paused,
},
},
SyncRoot: vfs.MustNew(t.TempDir()),
}
ctx := context.Background()

View File

@ -11,6 +11,7 @@ import (
"github.com/databricks/cli/bundle/config/resources"
"github.com/databricks/cli/libs/diag"
"github.com/databricks/cli/libs/tags"
"github.com/databricks/cli/libs/vfs"
sdkconfig "github.com/databricks/databricks-sdk-go/config"
"github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/databricks/databricks-sdk-go/service/compute"
@ -133,6 +134,7 @@ func mockBundle(mode config.Mode) *bundle.Bundle {
},
},
},
SyncRoot: vfs.MustNew("/Users/lennart.kats@databricks.com"),
// Use AWS implementation for testing.
Tagging: tags.ForCloud(&sdkconfig.Config{
Host: "https://company.cloud.databricks.com",