fix: Skipping in-place tests on Windows

This commit is contained in:
Ilya Kuznetsov 2024-11-18 12:08:10 +01:00
parent e7165ec17a
commit 49f6bc9354
No known key found for this signature in database
GPG Key ID: 91F3DDCF5D21CDDF
2 changed files with 13 additions and 3 deletions

View File

@ -2,6 +2,7 @@ package mutator_test
import (
"context"
"runtime"
"testing"
"github.com/databricks/cli/bundle"
@ -374,6 +375,10 @@ func TestApplyPresetsResourceNotDefined(t *testing.T) {
}
func TestApplyPresetsInPlaceDeployment(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("this test is not applicable on Windows because in-place works only in the Databricks Workspace")
}
testContext := context.Background()
enabled := true
disabled := false

View File

@ -3,6 +3,7 @@ package mutator
import (
"context"
"reflect"
"runtime"
"strings"
"testing"
@ -520,20 +521,24 @@ func TestPipelinesDevelopmentDisabled(t *testing.T) {
}
func TestInPlaceDeploymentEnabled(t *testing.T) {
b, diags := processInPlaceBundle(true)
b, diags := processInPlaceBundle(t, true)
require.NoError(t, diags.Error())
assert.True(t, *b.Config.Presets.InPlaceDeployment)
assert.Equal(t, b.Config.Workspace.FilePath, b.SyncRootPath)
}
func TestInPlaceDeploymentDisabled(t *testing.T) {
b, diags := processInPlaceBundle(false)
b, diags := processInPlaceBundle(t, false)
require.NoError(t, diags.Error())
assert.False(t, *b.Config.Presets.InPlaceDeployment)
assert.NotEqual(t, b.Config.Workspace.FilePath, b.SyncRootPath)
}
func processInPlaceBundle(presetEnabled bool) (*bundle.Bundle, diag.Diagnostics) {
func processInPlaceBundle(t *testing.T, presetEnabled bool) (*bundle.Bundle, diag.Diagnostics) {
if runtime.GOOS == "windows" {
t.Skip("this test is not applicable on Windows because in-place works only in the Databricks Workspace")
}
b := mockBundle(config.Development)
workspacePath := "/Workspace/lennart@company.com/"