Skip to content

Commit

Permalink
Fix test on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoriano committed Sep 13, 2023
1 parent 31e94c1 commit e478fd6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
9 changes: 2 additions & 7 deletions internal/fields/dependency_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"fmt"
"io"
"net/http"
"net/url"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -73,12 +72,8 @@ func loadECSFieldsSchema(dep buildmanifest.ECSDependency) ([]FieldDefinition, er

func readECSFieldsSchemaFile(dep buildmanifest.ECSDependency) ([]byte, error) {
if strings.HasPrefix(dep.Reference, localFilePrefix) {
uri, err := url.Parse(dep.Reference)
if err != nil {
return nil, err
}

return os.ReadFile(uri.Path)
path := strings.TrimPrefix(dep.Reference, localFilePrefix)
return os.ReadFile(path)
}

gitReference, err := asGitReference(dep.Reference)
Expand Down
4 changes: 1 addition & 3 deletions internal/fields/dependency_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package fields

import (
"encoding/json"
"path/filepath"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -617,10 +616,9 @@ func TestDependencyManagerInjectExternalFields(t *testing.T) {

func TestDependencyManagerWithECS(t *testing.T) {
const ecsNestedPath8_10_0 = "./testdata/ecs_nested_v8.10.0.yml"
ecsPath, _ := filepath.Abs(ecsNestedPath8_10_0)
deps := buildmanifest.Dependencies{
ECS: buildmanifest.ECSDependency{
Reference: "file://" + ecsPath,
Reference: "file://" + ecsNestedPath8_10_0,
},
}
dm, err := CreateFieldDependencyManager(deps)
Expand Down

0 comments on commit e478fd6

Please sign in to comment.