fixup! fixup! run: user LookupId
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
This commit is contained in:
parent
67fbdef360
commit
bd77f131fd
|
|
@ -41,7 +41,7 @@ type RunCommand struct {
|
|||
// for testing
|
||||
var (
|
||||
userLookup = user.Lookup
|
||||
userLookupId = user.LookupId
|
||||
userLookupID = user.LookupId
|
||||
)
|
||||
|
||||
func (r *RunCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error {
|
||||
|
|
@ -131,7 +131,7 @@ func addDefaultHOME(u string, envs []string) ([]string, error) {
|
|||
// Otherwise the user is set to uid and HOME is /
|
||||
userObj, err := userLookup(u)
|
||||
if err != nil {
|
||||
if uo, e := userLookupId(u); e == nil {
|
||||
if uo, e := userLookupID(u); e == nil {
|
||||
userObj = uo
|
||||
} else {
|
||||
return nil, err
|
||||
|
|
|
|||
|
|
@ -114,10 +114,10 @@ func Test_addDefaultHOME(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
userLookup = func(username string) (*user.User, error) { return test.mockUser, test.lookupError }
|
||||
userLookupId = func(username string) (*user.User, error) { return test.mockUserId, nil }
|
||||
userLookupID = func(username string) (*user.User, error) { return test.mockUserId, nil }
|
||||
defer func() {
|
||||
userLookup = user.Lookup
|
||||
userLookupId = user.LookupId
|
||||
userLookupID = user.LookupId
|
||||
}()
|
||||
actual, err := addDefaultHOME(test.user, test.initial)
|
||||
testutil.CheckErrorAndDeepEqual(t, false, err, test.expected, actual)
|
||||
|
|
|
|||
Loading…
Reference in New Issue