diff options
author | Konstantin Baranov <konstantin.baranov@workato.com> | 2020-10-20 20:03:04 -0700 |
---|---|---|
committer | Konstantin Baranov <konstantin.baranov@workato.com> | 2020-10-20 20:03:04 -0700 |
commit | d579ed85052dfba0579bd3286b6ae04210e4f975 (patch) | |
tree | 092dd5c579c1f5761644e57b46befa459cc7cf04 /runsc/container | |
parent | a2a27eedf44303a60f580e03be617124ce35bb17 (diff) |
Do not even try forcing cgroups in tests
Diffstat (limited to 'runsc/container')
-rw-r--r-- | runsc/container/container.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/runsc/container/container.go b/runsc/container/container.go index 878432dbb..d44b27958 100644 --- a/runsc/container/container.go +++ b/runsc/container/container.go @@ -314,7 +314,8 @@ func New(conf *boot.Config, args Args) (*Container, error) { if args.Spec.Linux == nil { args.Spec.Linux = &specs.Linux{} } - if args.Spec.Linux.CgroupsPath == "" { + // Don't force the use of cgroups in tests because they lack permission to do so. + if args.Spec.Linux.CgroupsPath == "" && !conf.TestOnlyAllowRunAsCurrentUserWithoutChroot { args.Spec.Linux.CgroupsPath = "/" + args.ID } @@ -328,9 +329,6 @@ func New(conf *boot.Config, args Args) (*Container, error) { // If there is cgroup config, install it before creating sandbox process. if err := cg.Install(args.Spec.Linux.Resources); err != nil { switch { - case errors.Is(err, syscall.EROFS) && conf.TestOnlyAllowRunAsCurrentUserWithoutChroot: - log.Warningf("Skipping cgroup configuration in test mode: %v", err) - cg = nil case errors.Is(err, syscall.EACCES) && conf.Rootless: log.Warningf("Skipping cgroup configuration in rootless mode: %v", err) cg = nil |