From 14852810b4bd53bf6e3b04e9b4017a1ee87a4003 Mon Sep 17 00:00:00 2001 From: lash Date: Thu, 21 Dec 2017 14:30:44 +0100 Subject: cmd/utils: add check on fd hard limit, skip test if below target (#15684) * cmd/utils: Add check on hard limit, skip test if below target * cmd/utils: Cross platform compatible fd limit test * cmd/utils: Remove syscall.Rlimit in test * cmd/utils: comment fd utility method --- cmd/utils/fdlimit_test.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'cmd/utils/fdlimit_test.go') diff --git a/cmd/utils/fdlimit_test.go b/cmd/utils/fdlimit_test.go index 0a950a6c9..48489cf4c 100644 --- a/cmd/utils/fdlimit_test.go +++ b/cmd/utils/fdlimit_test.go @@ -16,12 +16,22 @@ package utils -import "testing" +import ( + "fmt" + "testing" +) // TestFileDescriptorLimits simply tests whether the file descriptor allowance // per this process can be retrieved. func TestFileDescriptorLimits(t *testing.T) { target := 4096 + hardlimit, err := getFdMaxLimit() + if err != nil { + t.Fatal(err) + } + if hardlimit < target { + t.Skip(fmt.Sprintf("system limit is less than desired test target: %d < %d", hardlimit, target)) + } if limit, err := getFdLimit(); err != nil || limit <= 0 { t.Fatalf("failed to retrieve file descriptor limit (%d): %v", limit, err) -- cgit