From 30ce6ef736397981409b343255742344b306a345 Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Thu, 25 Mar 2021 18:05:18 +0100 Subject: [PATCH] add a test case for UID/GID limits --- httpd/httpd_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/httpd/httpd_test.go b/httpd/httpd_test.go index 16ada1f5..61770ec9 100644 --- a/httpd/httpd_test.go +++ b/httpd/httpd_test.go @@ -8,6 +8,7 @@ import ( "fmt" "io" "io/ioutil" + "math" "mime/multipart" "net" "net/http" @@ -419,6 +420,19 @@ func TestUserStatus(t *testing.T) { assert.NoError(t, err) } +func TestUidGidLimits(t *testing.T) { + u := getTestUser() + u.UID = math.MaxInt32 + u.GID = math.MaxInt32 + user, _, err := httpdtest.AddUser(u, http.StatusCreated) + assert.NoError(t, err) + assert.Equal(t, math.MaxInt32, user.GetUID()) + assert.Equal(t, math.MaxInt32, user.GetGID()) + + _, err = httpdtest.RemoveUser(user, http.StatusOK) + assert.NoError(t, err) +} + func TestAddUserNoCredentials(t *testing.T) { u := getTestUser() u.Password = ""