jx/internal/resource/os_test.go
Matthew Rich 0888ae2045
Some checks failed
Lint / golangci-lint (push) Failing after 9m55s
Declarative Tests / test (push) Failing after 5s
add container-image resource
2024-05-23 22:11:51 -07:00

39 lines
686 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("adm")
assert.Nil(t, e)
assert.Equal(t, 4, gid)
ngid, ne := LookupGID("1001")
assert.Nil(t, ne)
assert.Equal(t, 1001, ngid)
}