summaryrefslogtreecommitdiffstats
path: root/client/go/vespa/find_user_test.go
blob: 3d533b08c56641908ead7180367032d2f27d2a6b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package vespa

import (
	"fmt"
	"os"
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestFindVespaUser(t *testing.T) {
	var uName string

	t.Setenv("VESPA_USER", "nobody")
	uName = FindVespaUser()
	assert.Equal(t, "nobody", uName)

	t.Setenv("VESPA_USER", "")
	uName = FindVespaUser()
	assert.NotEqual(t, "", uName)
}

func TestFindVespaUidAndGid(t *testing.T) {
	uid, gid := FindVespaUidAndGid()
	fmt.Fprintln(os.Stderr, "INFO: result from FindVespaUidAndGid() is", uid, "and", gid)
}