From f9667e633bae44167b6ee9fecd00a349e826188d Mon Sep 17 00:00:00 2001 From: Itamar Holder Date: Mon, 7 Jun 2021 10:49:01 +0300 Subject: [PATCH] Make DevicesGroup's "TestingSkipFinalCheck" attribute public Users would like to have the possibility to skip checks for their tests the same way they are skipped within the tests in runc. Not exposing this variable makes it very hard to test components that use this library. To avoid copying-and-pasting the code into outside projects this variable sould be exposed to the users. Signed-off-by: Itamar Holder --- libcontainer/cgroups/fs/devices.go | 4 ++-- libcontainer/cgroups/fs/devices_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libcontainer/cgroups/fs/devices.go b/libcontainer/cgroups/fs/devices.go index 2476186a6..4527a70eb 100644 --- a/libcontainer/cgroups/fs/devices.go +++ b/libcontainer/cgroups/fs/devices.go @@ -13,7 +13,7 @@ import ( ) type DevicesGroup struct { - testingSkipFinalCheck bool + TestingSkipFinalCheck bool } func (s *DevicesGroup) Name() string { @@ -90,7 +90,7 @@ func (s *DevicesGroup) Set(path string, r *configs.Resources) error { // // This safety-check is skipped for the unit tests because we cannot // currently mock devices.list correctly. - if !s.testingSkipFinalCheck { + if !s.TestingSkipFinalCheck { currentAfter, err := loadEmulator(path) if err != nil { return err diff --git a/libcontainer/cgroups/fs/devices_test.go b/libcontainer/cgroups/fs/devices_test.go index 4819eee53..bdd196783 100644 --- a/libcontainer/cgroups/fs/devices_test.go +++ b/libcontainer/cgroups/fs/devices_test.go @@ -29,7 +29,7 @@ func TestDevicesSetAllow(t *testing.T) { }, } - d := &DevicesGroup{testingSkipFinalCheck: true} + d := &DevicesGroup{TestingSkipFinalCheck: true} if err := d.Set(path, r); err != nil { t.Fatal(err) }