1
0
mirror of https://github.com/gluster/glusterd2.git synced 2026-02-05 12:45:38 +01:00
Files
glusterd2/e2e/restapi_auth_test.go
Prashanth Pai 936f040f10 e2e: Create separate localstatedirs for each test
Signed-off-by: Prashanth Pai <ppai@redhat.com>
2018-09-17 17:45:31 +05:30

34 lines
647 B
Go

package e2e
import (
"io/ioutil"
"testing"
"github.com/gluster/glusterd2/pkg/restclient"
"github.com/stretchr/testify/require"
)
func TestRESTAPIAuth(t *testing.T) {
r := require.New(t)
tc, err := setupCluster(t, "./config/4.toml")
r.NoError(err)
defer teardownCluster(tc)
g1 := tc.gds[0]
r.True(g1.IsRunning())
secret, err := ioutil.ReadFile(g1.LocalStateDir + "/auth")
r.Nil(err)
client, err := restclient.New("http://"+g1.ClientAddress, "glustercli", string(secret), "", false)
r.Nil(err)
r.NotNil(client)
// Get Peers information, should work if auth works
peers, err := client.Peers()
r.Nil(err)
r.Len(peers, 1)
}