Fix node test. Remove all the server fake credentials references

pull/2605/head
yang-g 9 years ago
parent 70a1337045
commit 52e4de1ea1
  1. 8
      src/node/ext/server_credentials.cc
  2. 1
      src/node/ext/server_credentials.h
  3. 10
      src/node/test/server_test.js
  4. 1
      src/php/ext/grpc/credentials.c
  5. 13
      src/php/ext/grpc/server_credentials.c
  6. 4
      src/python/src/grpc/_adapter/_c/types.h
  7. 10
      src/python/src/grpc/_adapter/_c/types/server_credentials.c
  8. 12
      src/python/src/grpc/_adapter/_c_test.py
  9. 8
      src/python/src/grpc/_cython/adapter_low.py
  10. 4
      src/python/src/grpc/_cython/cygrpc.pyx
  11. 14
      src/python/src/grpc/_cython/cygrpc_test.py

@ -73,8 +73,6 @@ void ServerCredentials::Init(Handle<Object> exports) {
Handle<Function> ctr = tpl->GetFunction();
ctr->Set(NanNew("createSsl"),
NanNew<FunctionTemplate>(CreateSsl)->GetFunction());
ctr->Set(NanNew("createFake"),
NanNew<FunctionTemplate>(CreateFake)->GetFunction());
constructor = new NanCallback(ctr);
exports->Set(NanNew("ServerCredentials"), ctr);
}
@ -144,11 +142,5 @@ NAN_METHOD(ServerCredentials::CreateSsl) {
grpc_ssl_server_credentials_create(root_certs, &key_cert_pair, 1)));
}
NAN_METHOD(ServerCredentials::CreateFake) {
NanScope();
NanReturnValue(
WrapStruct(grpc_fake_transport_security_server_credentials_create()));
}
} // namespace node
} // namespace grpc

@ -63,7 +63,6 @@ class ServerCredentials : public ::node::ObjectWrap {
static NAN_METHOD(New);
static NAN_METHOD(CreateSsl);
static NAN_METHOD(CreateFake);
static NanCallback *constructor;
// Used for typechecking instances of this javascript class
static v8::Persistent<v8::FunctionTemplate> fun_tpl;

@ -34,6 +34,8 @@
'use strict';
var assert = require('assert');
var fs = require('fs');
var path = require('path');
var grpc = require('bindings')('grpc.node');
describe('server', function() {
@ -67,9 +69,13 @@ describe('server', function() {
before(function() {
server = new grpc.Server();
});
it('should bind to an unused port with fake credentials', function() {
it('should bind to an unused port with ssl credentials', function() {
var port;
var creds = grpc.ServerCredentials.createFake();
var key_path = path.join(__dirname, '../test/data/server1.key');
var pem_path = path.join(__dirname, '../test/data/server1.pem');
var key_data = fs.readFileSync(key_path);
var pem_data = fs.readFileSync(pem_path);
var creds = grpc.ServerCredentials.createSsl(null, key_data, pem_data);
assert.doesNotThrow(function() {
port = server.addSecureHttp2Port('0.0.0.0:0', creds);
});

@ -175,7 +175,6 @@ PHP_METHOD(Credentials, createGce) {
RETURN_DESTROY_ZVAL(creds_object);
}
static zend_function_entry credentials_methods[] = {
PHP_ME(Credentials, createDefault, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_ME(Credentials, createSsl, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)

@ -121,21 +121,8 @@ PHP_METHOD(ServerCredentials, createSsl) {
RETURN_DESTROY_ZVAL(creds_object);
}
/**
* Create fake credentials. Only to be used for testing.
* @return ServerCredentials The new fake credentials object
*/
PHP_METHOD(ServerCredentials, createFake) {
grpc_server_credentials *creds =
grpc_fake_transport_security_server_credentials_create();
zval *creds_object = grpc_php_wrap_server_credentials(creds);
RETURN_DESTROY_ZVAL(creds_object);
}
static zend_function_entry server_credentials_methods[] = {
PHP_ME(ServerCredentials, createSsl, NULL,
ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_ME(ServerCredentials, createFake, NULL,
ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_FE_END};
void grpc_init_server_credentials(TSRMLS_D) {

@ -63,8 +63,6 @@ ClientCredentials *pygrpc_ClientCredentials_jwt(
PyTypeObject *type, PyObject *args, PyObject *kwargs);
ClientCredentials *pygrpc_ClientCredentials_refresh_token(
PyTypeObject *type, PyObject *args, PyObject *kwargs);
ClientCredentials *pygrpc_ClientCredentials_fake_transport_security(
PyTypeObject *type, PyObject *ignored);
ClientCredentials *pygrpc_ClientCredentials_iam(
PyTypeObject *type, PyObject *args, PyObject *kwargs);
extern PyTypeObject pygrpc_ClientCredentials_type;
@ -81,8 +79,6 @@ typedef struct ServerCredentials {
void pygrpc_ServerCredentials_dealloc(ServerCredentials *self);
ServerCredentials *pygrpc_ServerCredentials_ssl(
PyTypeObject *type, PyObject *args, PyObject *kwargs);
ServerCredentials *pygrpc_ServerCredentials_fake_transport_security(
PyTypeObject *type, PyObject *ignored);
extern PyTypeObject pygrpc_ServerCredentials_type;

@ -43,9 +43,6 @@
PyMethodDef pygrpc_ServerCredentials_methods[] = {
{"ssl", (PyCFunction)pygrpc_ServerCredentials_ssl,
METH_CLASS|METH_KEYWORDS, ""},
{"fake_transport_security",
(PyCFunction)pygrpc_ServerCredentials_fake_transport_security,
METH_CLASS|METH_NOARGS, ""},
{NULL}
};
const char pygrpc_ServerCredentials_doc[] = "";
@ -137,10 +134,3 @@ ServerCredentials *pygrpc_ServerCredentials_ssl(
return self;
}
ServerCredentials *pygrpc_ServerCredentials_fake_transport_security(
PyTypeObject *type, PyObject *ignored) {
ServerCredentials *self = (ServerCredentials *)type->tp_alloc(type, 0);
self->c_creds = grpc_fake_transport_security_server_credentials_create();
return self;
}

@ -36,14 +36,6 @@ from grpc._adapter import _types
class CTypeSmokeTest(unittest.TestCase):
def testClientCredentialsUpDown(self):
credentials = _c.ClientCredentials.fake_transport_security()
del credentials
def testServerCredentialsUpDown(self):
credentials = _c.ServerCredentials.fake_transport_security()
del credentials
def testCompletionQueueUpDown(self):
completion_queue = _c.CompletionQueue()
del completion_queue
@ -58,10 +50,6 @@ class CTypeSmokeTest(unittest.TestCase):
channel = _c.Channel('[::]:0', [])
del channel
def testSecureChannelUpDown(self):
channel = _c.Channel('[::]:0', [], _c.ClientCredentials.fake_transport_security())
del channel
if __name__ == '__main__':
unittest.main(verbosity=2)

@ -71,10 +71,6 @@ class ClientCredentials(object):
def refresh_token():
raise NotImplementedError()
@staticmethod
def fake_transport_security():
raise NotImplementedError()
@staticmethod
def iam():
raise NotImplementedError()
@ -88,10 +84,6 @@ class ServerCredentials(object):
def ssl():
raise NotImplementedError()
@staticmethod
def fake_transport_security():
raise NotImplementedError()
class CompletionQueue(type_interfaces.CompletionQueue):
def __init__(self):

@ -82,12 +82,8 @@ client_credentials_compute_engine = (
credentials.client_credentials_compute_engine)
client_credentials_jwt = credentials.client_credentials_jwt
client_credentials_refresh_token = credentials.client_credentials_refresh_token
client_credentials_fake_transport_security = (
credentials.client_credentials_fake_transport_security)
client_credentials_iam = credentials.client_credentials_iam
server_credentials_ssl = credentials.server_credentials_ssl
server_credentials_fake_transport_security = (
credentials.server_credentials_fake_transport_security)
CompletionQueue = completion_queue.CompletionQueue
Channel = channel.Channel

@ -76,14 +76,6 @@ class TypeSmokeTest(unittest.TestCase):
timespec = cygrpc.Timespec(now)
self.assertAlmostEqual(now, float(timespec), places=8)
def testClientCredentialsUpDown(self):
credentials = cygrpc.client_credentials_fake_transport_security()
del credentials
def testServerCredentialsUpDown(self):
credentials = cygrpc.server_credentials_fake_transport_security()
del credentials
def testCompletionQueueUpDown(self):
completion_queue = cygrpc.CompletionQueue()
del completion_queue
@ -96,12 +88,6 @@ class TypeSmokeTest(unittest.TestCase):
channel = cygrpc.Channel('[::]:0', cygrpc.ChannelArgs([]))
del channel
def testSecureChannelUpDown(self):
channel = cygrpc.Channel(
'[::]:0', cygrpc.ChannelArgs([]),
cygrpc.client_credentials_fake_transport_security())
del channel
@unittest.skip('TODO(atash): undo skip after #2229 is merged')
def testServerStartNoExplicitShutdown(self):
server = cygrpc.Server()

Loading…
Cancel
Save