Fix client tests to work on Windows.

- Powershell is no longer available in nanoserver, so change commands to
  run accordingly.
- Set platform specific commands for short and long running containers
- Skips 2 tests which do not run on Windows.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
Brian Goff
2020-05-26 16:07:53 -07:00
parent 4e08c2de67
commit 3226283470
4 changed files with 79 additions and 27 deletions

View File

@@ -31,13 +31,13 @@ const newLine = "\r\n"
func withExitStatus(es int) oci.SpecOpts {
return func(_ context.Context, _ oci.Client, _ *containers.Container, s *specs.Spec) error {
s.Process.Args = []string{"powershell", "-noprofile", "exit", strconv.Itoa(es)}
s.Process.Args = []string{"cmd", "/c", "exit", strconv.Itoa(es)}
return nil
}
}
func withProcessArgs(args ...string) oci.SpecOpts {
return oci.WithProcessArgs(append([]string{"powershell", "-noprofile"}, args...)...)
return oci.WithProcessArgs(append([]string{"cmd", "/c"}, args...)...)
}
func withCat() oci.SpecOpts {
@@ -49,9 +49,9 @@ func withTrue() oci.SpecOpts {
}
func withExecExitStatus(s *specs.Process, es int) {
s.Args = []string{"powershell", "-noprofile", "exit", strconv.Itoa(es)}
s.Args = []string{"cmd", "/c", "exit", strconv.Itoa(es)}
}
func withExecArgs(s *specs.Process, args ...string) {
s.Args = append([]string{"powershell", "-noprofile"}, args...)
s.Args = append([]string{"cmd", "/c"}, args...)
}