Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Make unit tests pass on Windows (#179)
Browse files Browse the repository at this point in the history
* Bump riff dependency to latest

* Adjust indirect dependencies and k8s.io/apimachinery to match the changes in
  riff's Gopkg.lock.
* Move k8s.io/apimachinery dependency from indirect to direct group in go.mod.
* Redo go.sum based on Go 1.11.4 after `go clean -modcache`. See:
    - golang/go#29278
    - golang/go#29282
* Add go.sum entries for Windows

* Make unit tests pass and image relocate work on Windows

Fixes https://github.com/pivotal-cf/pfs/issues/175
Fixes https://github.com/pivotal-cf/pfs/issues/135
  • Loading branch information
glyn authored and George Harley committed Dec 17, 2018
1 parent ea85a3f commit d81b3fb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions list.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package scan

import (
"fmt"
"runtime"
"strings"

"github.com/ghodss/yaml"
Expand All @@ -18,6 +19,13 @@ func ListImages(res string, baseDir string) ([]string, error) {
imgs := []string{}

docs := strings.Split(string(contents), "---\n")
if runtime.GOOS == "windows" {
// allow lines to end in LF or CRLF since either may occur
d := strings.Split(string(contents), "---\r\n")
if len(d) > len(docs) {
docs = d
}
}
for _, doc := range docs {
if strings.TrimSpace(doc) != "" {
y := make(map[string]interface{})
Expand Down
2 changes: 1 addition & 1 deletion list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ var _ = Describe("ListImages", func() {
})

It("should return a suitable error", func() {
Expect(err).To(MatchError(HaveSuffix("no such file or directory")))
Expect(os.IsNotExist(err)).To(BeTrue())
})
})

Expand Down

0 comments on commit d81b3fb

Please sign in to comment.