mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
tests: in case 'go test' is run in a container, skip TestGetPIDLimit()
In (standard, non-privileged) container environments the /sys/fs/cgroup mountpoint is not available. This would cause the tests to fail, as TestGetPIDLimit() tries to write to the cgroup configuration. The test will work when run as root on a privileged container or directly on a host (as Travis CI does). Setting the CEPH_CSI_RUN_ALL_TESTS environment variable to a non-empty value will cause the test to be executed. Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
15578432a4
commit
a1de56dbd3
@ -17,12 +17,18 @@ limitations under the License.
|
||||
package util
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// minimal test to check if GetPIDLimit() returns an int
|
||||
// changing the limit require root permissions, not tested
|
||||
func TestGetPIDLimix(t *testing.T) {
|
||||
func TestGetPIDLimit(t *testing.T) {
|
||||
runTest := os.Getenv("CEPH_CSI_RUN_ALL_TESTS")
|
||||
if runTest == "" {
|
||||
t.Skip("not running test that requires root permissions and cgroup support")
|
||||
}
|
||||
|
||||
limit, err := GetPIDLimit()
|
||||
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user