-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/go_modules/github.com/databricks/…
…databricks-sdk-go-0.50.0
- Loading branch information
Showing
7 changed files
with
154 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package mutator_test | ||
|
||
import ( | ||
"context" | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/databricks/cli/bundle" | ||
"github.com/databricks/cli/bundle/config" | ||
"github.com/databricks/cli/bundle/config/mutator" | ||
"github.com/databricks/cli/bundle/config/resources" | ||
"github.com/databricks/cli/bundle/internal/bundletest" | ||
"github.com/databricks/cli/libs/dyn" | ||
"github.com/databricks/cli/libs/vfs" | ||
"github.com/databricks/databricks-sdk-go/service/dashboards" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestTranslatePathsDashboards_FilePathRelativeSubDirectory(t *testing.T) { | ||
dir := t.TempDir() | ||
touchEmptyFile(t, filepath.Join(dir, "src", "my_dashboard.lvdash.json")) | ||
|
||
b := &bundle.Bundle{ | ||
SyncRootPath: dir, | ||
SyncRoot: vfs.MustNew(dir), | ||
Config: config.Root{ | ||
Resources: config.Resources{ | ||
Dashboards: map[string]*resources.Dashboard{ | ||
"dashboard": { | ||
CreateDashboardRequest: &dashboards.CreateDashboardRequest{ | ||
Check failure on line 31 in bundle/config/mutator/translate_paths_dashboards_test.go GitHub Actions / tests (macos-latest)
Check failure on line 31 in bundle/config/mutator/translate_paths_dashboards_test.go GitHub Actions / tests (ubuntu-latest)
|
||
DisplayName: "My Dashboard", | ||
Check failure on line 32 in bundle/config/mutator/translate_paths_dashboards_test.go GitHub Actions / tests (macos-latest)
Check failure on line 32 in bundle/config/mutator/translate_paths_dashboards_test.go GitHub Actions / tests (ubuntu-latest)
Check failure on line 32 in bundle/config/mutator/translate_paths_dashboards_test.go GitHub Actions / tests (windows-latest)
|
||
}, | ||
FilePath: "../src/my_dashboard.lvdash.json", | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
bundletest.SetLocation(b, "resources.dashboards", []dyn.Location{{ | ||
File: filepath.Join(dir, "resources/dashboard.yml"), | ||
}}) | ||
|
||
diags := bundle.Apply(context.Background(), b, mutator.TranslatePaths()) | ||
require.NoError(t, diags.Error()) | ||
|
||
// Assert that the file path for the dashboard has been converted to its local absolute path. | ||
assert.Equal( | ||
t, | ||
filepath.Join(dir, "src", "my_dashboard.lvdash.json"), | ||
b.Config.Resources.Dashboards["dashboard"].FilePath, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters