jx/internal/resource/os_test.go
Matthew Rich 43a2274b7e
Some checks failed
Lint / golangci-lint (push) Failing after 9m50s
Declarative Tests / test (push) Failing after 10s
update container/iptables resources
2024-05-05 17:48:54 -07:00

37 lines
691 B
Go

// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
package resource
import (
_ "context"
_ "encoding/json"
"github.com/stretchr/testify/assert"
_ "io"
_ "net/http"
_ "net/http/httptest"
_ "net/url"
_ "strings"
"testing"
)
func TestLookupUID(t *testing.T) {
uid, e := LookupUID("nobody")
assert.Nil(t, e)
assert.Equal(t, 65534, uid)
nuid, ne := LookupUID("10101")
assert.Error(t, ne, "user: unknonwn userid ", ne)
assert.Equal(t, 10101, nuid)
}
func TestLookupGID(t *testing.T) {
gid, e := LookupGID("nobody")
assert.Nil(t, e)
assert.Equal(t, 65534, gid)
ngid, ne := LookupGID("1001")
assert.Nil(t, ne)
assert.Equal(t, 1001, ngid)
}