mirror of https://github.com/databricks/cli.git
fix: Add SyncRoot mock to tests
This commit is contained in:
parent
ae26beabfe
commit
fbb9be9bdc
|
@ -8,6 +8,7 @@ import (
|
||||||
"github.com/databricks/cli/bundle/config"
|
"github.com/databricks/cli/bundle/config"
|
||||||
"github.com/databricks/cli/bundle/config/mutator"
|
"github.com/databricks/cli/bundle/config/mutator"
|
||||||
"github.com/databricks/cli/bundle/config/resources"
|
"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/catalog"
|
||||||
"github.com/databricks/databricks-sdk-go/service/jobs"
|
"github.com/databricks/databricks-sdk-go/service/jobs"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
@ -55,6 +56,7 @@ func TestApplyPresetsPrefix(t *testing.T) {
|
||||||
NamePrefix: tt.prefix,
|
NamePrefix: tt.prefix,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
SyncRoot: vfs.MustNew(t.TempDir()),
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
@ -101,6 +103,7 @@ func TestApplyPresetsPrefixForUcSchema(t *testing.T) {
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
b := &bundle.Bundle{
|
b := &bundle.Bundle{
|
||||||
|
SyncRoot: vfs.MustNew(t.TempDir()),
|
||||||
Config: config.Root{
|
Config: config.Root{
|
||||||
Resources: config.Resources{
|
Resources: config.Resources{
|
||||||
Schemas: map[string]*resources.Schema{
|
Schemas: map[string]*resources.Schema{
|
||||||
|
@ -180,6 +183,7 @@ func TestApplyPresetsTags(t *testing.T) {
|
||||||
Tags: tt.tags,
|
Tags: tt.tags,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
SyncRoot: vfs.MustNew(t.TempDir()),
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
@ -239,6 +243,7 @@ func TestApplyPresetsJobsMaxConcurrentRuns(t *testing.T) {
|
||||||
JobsMaxConcurrentRuns: tt.setting,
|
JobsMaxConcurrentRuns: tt.setting,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
SyncRoot: vfs.MustNew(t.TempDir()),
|
||||||
}
|
}
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
diag := bundle.Apply(ctx, b, mutator.ApplyPresets())
|
diag := bundle.Apply(ctx, b, mutator.ApplyPresets())
|
||||||
|
@ -264,6 +269,7 @@ func TestApplyPresetsPrefixWithoutJobSettings(t *testing.T) {
|
||||||
NamePrefix: "prefix-",
|
NamePrefix: "prefix-",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
SyncRoot: vfs.MustNew(t.TempDir()),
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
@ -355,6 +361,7 @@ func TestApplyPresetsResourceNotDefined(t *testing.T) {
|
||||||
TriggerPauseStatus: config.Paused,
|
TriggerPauseStatus: config.Paused,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
SyncRoot: vfs.MustNew(t.TempDir()),
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"github.com/databricks/cli/bundle/config/resources"
|
"github.com/databricks/cli/bundle/config/resources"
|
||||||
"github.com/databricks/cli/libs/diag"
|
"github.com/databricks/cli/libs/diag"
|
||||||
"github.com/databricks/cli/libs/tags"
|
"github.com/databricks/cli/libs/tags"
|
||||||
|
"github.com/databricks/cli/libs/vfs"
|
||||||
sdkconfig "github.com/databricks/databricks-sdk-go/config"
|
sdkconfig "github.com/databricks/databricks-sdk-go/config"
|
||||||
"github.com/databricks/databricks-sdk-go/service/catalog"
|
"github.com/databricks/databricks-sdk-go/service/catalog"
|
||||||
"github.com/databricks/databricks-sdk-go/service/compute"
|
"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.
|
// Use AWS implementation for testing.
|
||||||
Tagging: tags.ForCloud(&sdkconfig.Config{
|
Tagging: tags.ForCloud(&sdkconfig.Config{
|
||||||
Host: "https://company.cloud.databricks.com",
|
Host: "https://company.cloud.databricks.com",
|
||||||
|
|
Loading…
Reference in New Issue