Skip to content

Commit

Permalink
Fixed TestHostCgroupNS (#2)
Browse files Browse the repository at this point in the history
testing without github skips after fixing other tests


revert

Co-authored-by: Tullio Sebastiani <[email protected]>
  • Loading branch information
tsebastiani and Tullio Sebastiani authored Mar 17, 2023
1 parent 83fde51 commit 5f74a09
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
4 changes: 0 additions & 4 deletions connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,6 @@ func TestPrivateCgroupNs(t *testing.T) {
}

func TestHostCgroupNs(t *testing.T) {
// get the user cgroup ns
if tests.IsRunningOnGithub() {
t.Skipf("joining host machine cgroup namespace not supported on GitHub actions")
}
logger := log.NewTestLogger(t)
var wg sync.WaitGroup

Expand Down
9 changes: 4 additions & 5 deletions tests/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,12 @@ func GetCommmandCgroupNs(logger log.Logger, command string, args []string) strin
if err := cmd2.Run(); err != nil {
logger.Errorf(err.Error())
}
userCgroupNs = strings.Split(stdout.String(), " ")[10]
stdoutStr:=stdout.String()
regex:=regexp.MustCompile(`.*cgroup:\[(\d+)\]`)
userCgroupNs = regex.ReplaceAllString(stdoutStr,"$1")
userCgroupNs = strings.TrimSuffix(userCgroupNs, "\n")
}()
wg.Wait()
// removes linux cgroup notation
regex := regexp.MustCompile(`cgroup:\[(\d+)\]`)
userCgroupNs = regex.ReplaceAllString(userCgroupNs, "$1")
userCgroupNs = strings.TrimSuffix(userCgroupNs, "\n")
return userCgroupNs
}

Expand Down

0 comments on commit 5f74a09

Please sign in to comment.