mirror of
https://github.com/docker/compose.git
synced 2025-04-08 17:05:13 +02:00
Fix e2e tests using golden files on windows
This commit is contained in:
parent
07a29e2d0e
commit
c73998bd2d
@ -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"))
|
||||
})
|
||||
|
2
tests/e2e/testdata/ls-out-default-windows.golden
vendored
Normal file
2
tests/e2e/testdata/ls-out-default-windows.golden
vendored
Normal 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
|
3
tests/e2e/testdata/ls-out-test-example-windows.golden
vendored
Normal file
3
tests/e2e/testdata/ls-out-test-example-windows.golden
vendored
Normal 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
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user