Fix e2e tests using golden files on windows

This commit is contained in:
guillaume.tardif 2020-06-08 14:43:51 +02:00 committed by Guillaume Tardif
parent 07a29e2d0e
commit c73998bd2d
4 changed files with 15 additions and 2 deletions

View File

@ -65,7 +65,7 @@ func (s *E2eSuite) TestContextDefault() {
output := s.NewDockerCommand("context", "show").ExecOrDie()
Expect(output).To(ContainSubstring("default"))
output = s.NewCommand("docker", "context", "ls").ExecOrDie()
golden.Assert(s.T(), output, "ls-out-default.golden")
golden.Assert(s.T(), output, GoldenFile("ls-out-default"))
})
}
@ -187,7 +187,7 @@ func (s *E2eSuite) TestMockBackend() {
currentContext := s.NewDockerCommand("context", "use", "test-example").ExecOrDie()
Expect(currentContext).To(ContainSubstring("test-example"))
output := s.NewDockerCommand("context", "ls").ExecOrDie()
golden.Assert(s.T(), output, "ls-out-test-example.golden")
golden.Assert(s.T(), output, GoldenFile("ls-out-test-example"))
output = s.NewDockerCommand("context", "show").ExecOrDie()
Expect(output).To(ContainSubstring("test-example"))
})

View File

@ -0,0 +1,2 @@
NAME TYPE DESCRIPTION DOCKER ENPOINT KUBERNETES ENDPOINT ORCHESTRATOR
default * docker Current DOCKER_HOST based configuration npipe:////./pipe/docker_engine swarm

View File

@ -0,0 +1,3 @@
NAME TYPE DESCRIPTION DOCKER ENPOINT KUBERNETES ENDPOINT ORCHESTRATOR
default docker Current DOCKER_HOST based configuration npipe:////./pipe/docker_engine swarm
test-example * example

View File

@ -28,6 +28,7 @@
package framework
import (
"runtime"
"strings"
"github.com/robpike/filter"
@ -48,6 +49,13 @@ func Columns(line string) []string {
return filter.Choose(strings.Split(line, " "), nonEmptyString).([]string)
}
func GoldenFile(name string) string {
if runtime.GOOS == "windows" {
return name + "-windows.golden"
}
return name + ".golden"
}
// It runs func
func It(description string, test func()) {
test()