mirror of
https://github.com/pgsty/minio.git
synced 2026-07-19 20:20:25 +03:00
loginServer should be a member of lockServer (#3441)
Add a unit test to catch a missing LoginHandler method in lockServer.
This commit is contained in:
committed by
Harshavardhana
parent
f53fcdf10e
commit
29d72b84c0
+12
-18
@@ -48,26 +48,20 @@ func createLockTestServer(t *testing.T) (string, *lockServer, string) {
|
||||
t.Fatalf("unable initialize config file, %s", err)
|
||||
}
|
||||
|
||||
jwt, err := newJWT(defaultJWTExpiry, serverConfig.GetCredential())
|
||||
if err != nil {
|
||||
t.Fatalf("unable to get new JWT, %s", err)
|
||||
}
|
||||
|
||||
err = jwt.Authenticate(serverConfig.GetCredential().AccessKeyID, serverConfig.GetCredential().SecretAccessKey)
|
||||
if err != nil {
|
||||
t.Fatalf("unable for JWT to authenticate, %s", err)
|
||||
}
|
||||
|
||||
token, err := jwt.GenerateToken(serverConfig.GetCredential().AccessKeyID)
|
||||
if err != nil {
|
||||
t.Fatalf("unable for JWT to generate token, %s", err)
|
||||
}
|
||||
|
||||
locker := &lockServer{
|
||||
rpcPath: "rpc-path",
|
||||
mutex: sync.Mutex{},
|
||||
lockMap: make(map[string][]lockRequesterInfo),
|
||||
loginServer: loginServer{},
|
||||
rpcPath: "rpc-path",
|
||||
mutex: sync.Mutex{},
|
||||
lockMap: make(map[string][]lockRequesterInfo),
|
||||
}
|
||||
creds := serverConfig.GetCredential()
|
||||
loginArgs := RPCLoginArgs{Username: creds.AccessKeyID, Password: creds.SecretAccessKey}
|
||||
loginReply := RPCLoginReply{}
|
||||
err = locker.LoginHandler(&loginArgs, &loginReply)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to login to lock server - %v", err)
|
||||
}
|
||||
token := loginReply.Token
|
||||
|
||||
return testPath, locker, token
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user