Skip to content
This repository has been archived by the owner on Mar 13, 2021. 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 Swapnil Bawaskar committed Jul 16, 2019
1 parent 909ff35 commit 389912f
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 389912f

Please sign in to comment.