tests: Adds support for Windows cri-integration tests

Currently, the cri-integration tests do not work on Windows due to various reasons.
One of the reasons is because all the tests are using Linux-specific images.
Previous commits refactored the image pulling / usage in the cri-integration tests,
making it easier to update, and easier to configure a custom registry to pull images
with Windows support.

For Windows runs, custom registries can be created, which will also contain Windows
images, and the cri-integration tests can be configured to use those registries by
specifying the "--repo-list" argument, a YAML file which will contain an alternative
mapping of the default registries. This is similar to how E2E tests are handled for
Windows runs in Kubernetes.

Some of the tests are Skipped, as they do not pass yet on Windows.

Windows does not collect inodes used stats, thus, the tests that were expecting non-zero
inodes stats were failing.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
This commit is contained in:
Claudiu Belu
2021-02-16 12:45:45 +00:00
parent fe5d3496a4
commit 09a0c9471b
21 changed files with 153 additions and 81 deletions

View File

@@ -1,5 +1,3 @@
// +build linux
/*
Copyright The containerd Authors.
@@ -97,6 +95,7 @@ func ConnectDaemons() error {
}
// containerdEndpoint is the same with criEndpoint now
containerdEndpoint = strings.TrimPrefix(*criEndpoint, "unix://")
containerdEndpoint = strings.TrimPrefix(containerdEndpoint, "npipe:")
containerdClient, err = containerd.New(containerdEndpoint, containerd.WithDefaultNamespace(k8sNamespace))
if err != nil {
return errors.Wrap(err, "failed to connect containerd")
@@ -198,7 +197,7 @@ func WithTestAnnotations() ContainerOpts {
}
// Add container resource limits.
func WithResources(r *runtime.LinuxContainerResources) ContainerOpts {
func WithResources(r *runtime.LinuxContainerResources) ContainerOpts { //nolint:unused
return func(c *runtime.ContainerConfig) {
if c.Linux == nil {
c.Linux = &runtime.LinuxContainerConfig{}
@@ -240,7 +239,7 @@ func WithLogPath(path string) ContainerOpts {
}
// WithSupplementalGroups adds supplemental groups.
func WithSupplementalGroups(gids []int64) ContainerOpts {
func WithSupplementalGroups(gids []int64) ContainerOpts { //nolint:unused
return func(c *runtime.ContainerConfig) {
if c.Linux == nil {
c.Linux = &runtime.LinuxContainerConfig{}
@@ -325,7 +324,7 @@ func KillProcess(name string) error {
}
// KillPid kills the process by pid. kill is used.
func KillPid(pid int) error {
func KillPid(pid int) error { //nolint:unused
output, err := exec.Command("kill", strconv.Itoa(pid)).CombinedOutput()
if err != nil {
return errors.Errorf("failed to kill %d - error: %v, output: %q", pid, err, output)
@@ -379,7 +378,7 @@ func CRIConfig() (*criconfig.Config, error) {
}
// SandboxInfo gets sandbox info.
func SandboxInfo(id string) (*runtime.PodSandboxStatus, *server.SandboxInfo, error) {
func SandboxInfo(id string) (*runtime.PodSandboxStatus, *server.SandboxInfo, error) { //nolint:unused
client, err := RawRuntimeClient()
if err != nil {
return nil, nil, errors.Wrap(err, "failed to get raw runtime client")