integration: Enable some tests for Windows (part 2)

Some of the tests that are currently running only on Linux can be made
to run on Windows with a few changes.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
This commit is contained in:
Claudiu Belu
2021-10-12 11:27:43 +03:00
parent d97b40c300
commit 830b3c26ec
8 changed files with 440 additions and 402 deletions

View File

@@ -17,9 +17,12 @@
package client
import (
"bytes"
"context"
"io"
"strconv"
"github.com/containerd/containerd/cio"
"github.com/containerd/containerd/containers"
"github.com/containerd/containerd/oci"
specs "github.com/opencontainers/runtime-spec/specs-go"
@@ -53,3 +56,21 @@ func withExecExitStatus(s *specs.Process, es int) {
func withExecArgs(s *specs.Process, args ...string) {
s.Args = append([]string{"cmd", "/c"}, args...)
}
type bytesBuffer struct {
*bytes.Buffer
}
// Close is a noop operation.
func (b bytesBuffer) Close() error {
return nil
}
func newDirectIO(ctx context.Context, terminal bool) (*directIO, error) {
readb := bytesBuffer{bytes.NewBuffer(nil)}
writeb := io.NopCloser(bytes.NewBuffer(nil))
errb := io.NopCloser(bytes.NewBuffer(nil))
dio := cio.NewDirectIO(readb, writeb, errb, terminal)
return &directIO{DirectIO: *dio}, nil
}