Skip to content

Commit

Permalink
Address the comments.
Browse files Browse the repository at this point in the history
Co-authored-by: Thomas Schubart <[email protected]>
  • Loading branch information
utam0k and Furisto committed Mar 10, 2022
1 parent 9523397 commit 63741ad
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ spec:
serviceAccountName: integration-svc
containers:
- name: tests
image: eu.gcr.io/gitpod-core-dev/build/integration-tests:to-cgv2-itest.35
image: eu.gcr.io/gitpod-core-dev/build/integration-tests:to-cgv2-itest.39
imagePullPolicy: Always
#args: ["-username=sagor999"]
#args: ["-enterprise=true"]
Expand Down
22 changes: 18 additions & 4 deletions test/tests/workspace/cgroup_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"context"
"fmt"
"path/filepath"
"sort"
"strings"
"testing"
"time"

Expand All @@ -17,12 +19,13 @@ import (
agent "github.com/gitpod-io/gitpod/test/pkg/agent/workspace/api"
"github.com/gitpod-io/gitpod/test/pkg/integration"
"github.com/gitpod-io/gitpod/test/tests/workspace/common"
"github.com/google/go-cmp/cmp"
)

func TestCgroupV2(t *testing.T) {
f := features.New("cgroup v2").
WithLabel("component", "workspace").
Assess("it should create a new cgroup when cgroup v2 enable", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context {
Assess("it should create a new cgroup when cgroup v2 is enabled", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()

Expand Down Expand Up @@ -92,9 +95,20 @@ func TestCgroupV2(t *testing.T) {
t.Fatalf("cgroup v2 controllers check failed: %s\n%s", respCheckControllers.Stdout, respCheckControllers.Stderr)
}

expect := "cpuset cpu io memory hugetlb pids rdma"
if respCheckControllers.Stdout == expect {
t.Fatalf("cgroup v2 controllers check failed:\nexpect %s\nact%s", expect, respCheckControllers.Stdout)
expect := []string{
"cpuset",
"cpu",
"io",
"memory",
"hugetlb",
"pids",
"rdma",
}
sort.Strings(expect)
act := strings.Split(strings.TrimSuffix(respCheckControllers.Stdout, "\n"), " ")
sort.Strings(act)
if diff := cmp.Diff(act, expect); len(diff) != 0 {
t.Errorf("cgroup v2 controllers mismatch (-want +got):\n%s", diff)
}

return ctx
Expand Down

0 comments on commit 63741ad

Please sign in to comment.