def renew_credential_loop(self):
     while True:
         time.sleep(self.RENEW_CREDENTIAL_INTERVAL_TIME)
         auth_request = etcd3.etcdrpc.AuthenticateRequest(
             name=self.user, password=self.password)
         resp = self.auth_stub.Authenticate(auth_request, self.timeout)
         self.metadata = (('token', resp.token), )
         self.call_credentials = grpc.metadata_call_credentials(
             EtcdTokenCallCredentials(resp.token))
示例#2
0
 def test_token_callback(self):
     e = EtcdTokenCallCredentials('foo')
     callback = mock.MagicMock()
     e(None, callback)
     metadata = (('token', 'foo'),)
     callback.assert_called_once_with(metadata, None)