fix: Use OS-aware path joiner

This commit is contained in:
Ilya Kuznetsov 2024-12-17 15:07:22 +01:00
parent 00376711a3
commit 7d8ae48f6b
2 changed files with 4 additions and 11 deletions

View File

@ -5,7 +5,7 @@ import (
"fmt" "fmt"
"log" "log"
"os" "os"
"path" "path/filepath"
"reflect" "reflect"
"github.com/databricks/cli/bundle/config" "github.com/databricks/cli/bundle/config"
@ -129,9 +129,9 @@ func main() {
} }
func generateSchema(workdir, outputFile string) { func generateSchema(workdir, outputFile string) {
annotationsPath := path.Join(workdir, "annotations.yml") annotationsPath := filepath.Join(workdir, "annotations.yml")
annotationsOpenApiPath := path.Join(workdir, "annotations_openapi.yml") annotationsOpenApiPath := filepath.Join(workdir, "annotations_openapi.yml")
annotationsOpenApiOverridesPath := path.Join(workdir, "annotations_openapi_overrides.yml") annotationsOpenApiOverridesPath := filepath.Join(workdir, "annotations_openapi_overrides.yml")
// Input file, the databricks openapi spec. // Input file, the databricks openapi spec.
inputFile := os.Getenv("DATABRICKS_OPENAPI_SPEC") inputFile := os.Getenv("DATABRICKS_OPENAPI_SPEC")

View File

@ -5,7 +5,6 @@ import (
"os" "os"
"path" "path"
"reflect" "reflect"
"runtime"
"testing" "testing"
"github.com/databricks/cli/bundle/config" "github.com/databricks/cli/bundle/config"
@ -41,9 +40,6 @@ func copyFile(src, dst string) error {
// 2. replace all "PLACEHOLDER" values with the actual descriptions if possible // 2. replace all "PLACEHOLDER" values with the actual descriptions if possible
// 3. run `make schema` again to regenerate the schema with acutal descriptions // 3. run `make schema` again to regenerate the schema with acutal descriptions
func TestRequiredAnnotationsForNewFields(t *testing.T) { func TestRequiredAnnotationsForNewFields(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip()
}
workdir := t.TempDir() workdir := t.TempDir()
annotationsPath := path.Join(workdir, "annotations.yml") annotationsPath := path.Join(workdir, "annotations.yml")
annotationsOpenApiPath := path.Join(workdir, "annotations_openapi.yml") annotationsOpenApiPath := path.Join(workdir, "annotations_openapi.yml")
@ -68,9 +64,6 @@ func TestRequiredAnnotationsForNewFields(t *testing.T) {
// Checks whether types in annotation files are still present in Config type // Checks whether types in annotation files are still present in Config type
func TestNoDetachedAnnotations(t *testing.T) { func TestNoDetachedAnnotations(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip()
}
files := []string{ files := []string{
"annotations.yml", "annotations.yml",
"annotations_openapi.yml", "annotations_openapi.yml",