Skip to content

Commit 5d8132d

Browse files
committed
Make integration tests work
1 parent 6f59623 commit 5d8132d

File tree

4 files changed

+25
-54
lines changed

4 files changed

+25
-54
lines changed

grpc-gcp/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@
4343
"eslint-plugin-node": "8.0.0",
4444
"eslint-plugin-prettier": "3.0.0",
4545
"google-auth-library": "3.1.1",
46-
"google-gax": "0.25.5",
46+
"google-gax": "^1.15.1",
4747
"google-protobuf": "3.7.0",
48-
"grpc-tools": "1.7.1",
4948
"grpc": "^1.24.2",
49+
"grpc-tools": "^1.8.1",
5050
"gts": "0.9.0",
5151
"mocha": "6.0.2",
5252
"nyc": "13.3.0",

grpc-gcp/test/codegen.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ for p in $(find ../../third_party/googleapis/google -type f -name *.proto); do
99
$PROTOC \
1010
--proto_path=../../third_party/googleapis \
1111
--js_out=import_style=commonjs,binary:./ \
12-
--grpc_out=./ \
12+
--grpc_out=generate_package_definition:./ \
1313
"$p"
1414
done

grpc-gcp/test/integration/local_service_test.js

Lines changed: 17 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ for (const grpcLibName of ['grpc', '@grpc/grpc-js']) {
8585
}
8686
port = boundPort;
8787
server.start();
88+
done();
8889
});
8990
});
9091
after(function() {
@@ -196,17 +197,17 @@ for (const grpcLibName of ['grpc', '@grpc/grpc-js']) {
196197
});
197198
describe('Call argument handling', function() {
198199
describe('Unary call', function() {
199-
it('Should handle undefined options', function(done) {
200-
var call = client.unary({}, metadata, undefined, function(err, data) {
200+
it('Should handle missing options', function(done) {
201+
var call = client.unary({}, metadata, function(err, data) {
201202
assert.ifError(err);
202203
});
203204
call.on('metadata', function(metadata) {
204205
assert.deepStrictEqual(metadata.get('key'), ['value']);
205206
done();
206207
});
207208
});
208-
it('Should handle two undefined arguments', function(done) {
209-
var call = client.unary({}, undefined, undefined, function(
209+
it('Should handle missing metadata and options', function(done) {
210+
var call = client.unary({}, function(
210211
err,
211212
data
212213
) {
@@ -216,18 +217,10 @@ for (const grpcLibName of ['grpc', '@grpc/grpc-js']) {
216217
done();
217218
});
218219
});
219-
it('Should handle one undefined argument', function(done) {
220-
var call = client.unary({}, undefined, function(err, data) {
221-
assert.ifError(err);
222-
});
223-
call.on('metadata', function(metadata) {
224-
done();
225-
});
226-
});
227220
});
228221
describe('Client stream call', function() {
229-
it('Should handle undefined options', function(done) {
230-
var call = client.clientStream(metadata, undefined, function(
222+
it('Should handle missing options', function(done) {
223+
var call = client.clientStream(metadata, function(
231224
err,
232225
data
233226
) {
@@ -239,8 +232,8 @@ for (const grpcLibName of ['grpc', '@grpc/grpc-js']) {
239232
});
240233
call.end();
241234
});
242-
it('Should handle two undefined arguments', function(done) {
243-
var call = client.clientStream(undefined, undefined, function(
235+
it('Should handle missing metadata and options', function(done) {
236+
var call = client.clientStream(function(
244237
err,
245238
data
246239
) {
@@ -251,60 +244,36 @@ for (const grpcLibName of ['grpc', '@grpc/grpc-js']) {
251244
});
252245
call.end();
253246
});
254-
it('Should handle one undefined argument', function(done) {
255-
var call = client.clientStream(undefined, function(err, data) {
256-
assert.ifError(err);
257-
});
258-
call.on('metadata', function(metadata) {
259-
done();
260-
});
261-
call.end();
262-
});
263247
});
264248
describe('Server stream call', function() {
265-
it('Should handle undefined options', function(done) {
266-
var call = client.serverStream({}, metadata, undefined);
249+
it('Should handle missing options', function(done) {
250+
var call = client.serverStream({}, metadata);
267251
call.on('data', function() {});
268252
call.on('metadata', function(metadata) {
269253
assert.deepStrictEqual(metadata.get('key'), ['value']);
270254
done();
271255
});
272256
});
273-
it('Should handle two undefined arguments', function(done) {
274-
var call = client.serverStream({}, undefined, undefined);
275-
call.on('data', function() {});
276-
call.on('metadata', function(metadata) {
277-
done();
278-
});
279-
});
280-
it('Should handle one undefined argument', function(done) {
281-
var call = client.serverStream({}, undefined);
257+
it('Should handle missing metadata and options', function(done) {
258+
var call = client.serverStream({});
282259
call.on('data', function() {});
283260
call.on('metadata', function(metadata) {
284261
done();
285262
});
286263
});
287264
});
288265
describe('Bidi stream call', function() {
289-
it('Should handle undefined options', function(done) {
290-
var call = client.bidiStream(metadata, undefined);
266+
it('Should handle missing options', function(done) {
267+
var call = client.bidiStream(metadata);
291268
call.on('data', function() {});
292269
call.on('metadata', function(metadata) {
293270
assert.deepStrictEqual(metadata.get('key'), ['value']);
294271
done();
295272
});
296273
call.end();
297274
});
298-
it('Should handle two undefined arguments', function(done) {
299-
var call = client.bidiStream(undefined, undefined);
300-
call.on('data', function() {});
301-
call.on('metadata', function(metadata) {
302-
done();
303-
});
304-
call.end();
305-
});
306-
it('Should handle one undefined argument', function(done) {
307-
var call = client.bidiStream(undefined);
275+
it('Should handle missing metadata and options', function(done) {
276+
var call = client.bidiStream();
308277
call.on('data', function() {});
309278
call.on('metadata', function(metadata) {
310279
done();

grpc-gcp/test/integration/spanner_test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
const assert = require('assert');
2626
const {GoogleAuth} = require('google-auth-library');
27-
const spannerGrpc = require('../google/spanner/v1/spanner_grpc_pb.js');
27+
const spannerPackageDef = require('../google/spanner/v1/spanner_grpc_pb.js');
2828
const spanner = require('../google/spanner/v1/spanner_pb.js');
2929
const fs = require('fs');
3030
const gax = require('google-gax');
@@ -71,7 +71,9 @@ for (const grpcLibName of ['grpc', '@grpc/grpc-js']) {
7171
gcpApiConfig: apiConfig,
7272
};
7373

74-
client = new spannerGrpc.SpannerClient(
74+
const spannerGrpc = grpc.loadPackageDefinition(spannerPackageDef);
75+
76+
client = new spannerGrpc.google.spanner.v1.Spanner(
7577
_TARGET,
7678
channelCreds,
7779
channelOptions
@@ -312,7 +314,7 @@ for (const grpcLibName of ['grpc', '@grpc/grpc-js']) {
312314

313315
describe('SpannerClient generated by google-gax', () => {
314316
const PROTO_DIR = __dirname + '/../../../third_party/googleapis';
315-
const gaxGrpc = new gax.GrpcClient();
317+
const gaxGrpc = new gax.GrpcClient({ grpc });
316318
const protos = gaxGrpc.loadProto(
317319
PROTO_DIR,
318320
'google/spanner/v1/spanner.proto'

0 commit comments

Comments
 (0)