Skip to content

Commit 00d918c

Browse files
authored
Improve test coverage. (GoogleCloudPlatform#139)
* Improve test coverage. * Experimenting with serial vs parallel tests. * Increase timeout
1 parent b3ae019 commit 00d918c

35 files changed

+373
-50
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545
]
4646
},
4747
"scripts": {
48-
"ava": "ava --match='!*: dependencies should install*' --timeout=1m --fail-fast --concurrency=5",
48+
"ava": "ava --match='!*: dependencies should install*' --timeout=2m --fail-fast --concurrency=5",
4949
"ava:deps": "npm run deps_appengine && npm run ava",
50-
"cover": "npm run deps_appengine && nyc ava --match='!*: dependencies should install*'",
50+
"cover": "npm run deps_appengine && nyc ava --match='!*: dependencies should install*' --timeout=2m --fail-fast --concurrency=5 --cache",
5151
"deps_appengine": "ava --match='*: dependencies should install*'",
5252
"deps_bigquery": "cd bigquery; npm i; cd ../",
5353
"deps_computeengine": "cd computeengine; npm i; cd ../",

pubsub/iam.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,12 @@ function testSubscriptionPermissionsExample (subscriptionName, callback) {
185185
}
186186
// [END test_subscription_permissions]
187187

188+
exports.getTopicPolicyExample = getTopicPolicyExample;
189+
exports.getSubscriptionPolicyExample = getSubscriptionPolicyExample;
188190
exports.setTopicPolicyExample = setTopicPolicyExample;
189191
exports.setSubscriptionPolicyExample = setSubscriptionPolicyExample;
192+
exports.testTopicPermissionsExample = testTopicPermissionsExample;
193+
exports.testSubscriptionPermissionsExample = testSubscriptionPermissionsExample;
190194

191195
// Run the examples
192196
exports.main = function (cb) {

pubsub/subscription.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,10 @@ exports.createTopicExample = createTopicExample;
290290
exports.deleteTopicExample = deleteTopicExample;
291291
exports.subscribeExample = subscribeExample;
292292
exports.deleteSubscriptionExample = deleteSubscriptionExample;
293+
exports.publishExample = publishExample;
294+
exports.getAllTopicsExample = getAllTopicsExample;
295+
exports.getAllSubscriptionsExample = getAllSubscriptionsExample;
296+
exports.subscribeExample = subscribeExample;
293297
exports.pubsub = pubsub;
294298
exports.main = function (cb) {
295299
var topicName = 'messageCenter';

test/appengine/all.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ sampleTests.forEach(function (sample) {
317317
sample.env.SERVER_URL = sample.env.SERVER_URL + port + '/parse';
318318
}
319319
port++;
320-
test.cb(sample.dir + ': dependencies should install', function (t) {
320+
test.cb.serial(sample.dir + ': dependencies should install', function (t) {
321321
testInstallation(sample, t.end);
322322
});
323323

@@ -330,13 +330,13 @@ sampleTests.forEach(function (sample) {
330330
return;
331331
}
332332

333-
test.cb(sample.dir + ' should return 200 and Hello World', function (t) {
333+
test.cb.serial(sample.dir + ' should return 200 and Hello World', function (t) {
334334
testLocalApp(sample, t.end);
335335
});
336336
});
337337

338338
if (process.env.TRAVIS && process.env.DEPLOY_TESTS) {
339-
test.cb('should deploy all samples', function (t) {
339+
test.cb.serial('should deploy all samples', function (t) {
340340
// 30 minutes because deployments are slow
341341
this.timeout(30 * 60 * 1000);
342342

test/bigquery/dataset_size.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
var test = require('ava');
1717
var datasetSizeExample = require('../../bigquery/dataset_size');
1818

19-
test.cb('should return the size of a dataset', function (t) {
19+
test.cb.serial('should return the size of a dataset', function (t) {
2020
datasetSizeExample.main(
2121
'bigquery-public-data',
2222
'hacker_news',

test/bigquery/getting_started.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
var test = require('ava');
1717
var gettingStartedExample = require('../../bigquery/getting_started');
1818

19-
test.cb('should run a query', function (t) {
19+
test.cb.serial('should run a query', function (t) {
2020
gettingStartedExample.main(
2121
function (err, rows) {
2222
t.ifError(err);

test/bigquery/load_data_from_csv.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var datasetId = 'nodejs_docs_samples';
2222
var tableName = 'test_' + new Date().getTime() + '_' +
2323
Math.floor(Math.random() * 10000);
2424

25-
test.cb('should load data from a csv file', function (t) {
25+
test.cb.serial('should load data from a csv file', function (t) {
2626
async.series([
2727
function (cb) {
2828
loadDataFromCsvExample.createTable(datasetId, tableName, cb);

test/bigquery/load_data_from_gcs.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var datasetId = 'nodejs_docs_samples';
2323
var tableName = 'test_' + new Date().getTime() + '_' +
2424
Math.floor(Math.random() * 10000);
2525

26-
test.cb('should load data from a csv file in a GCS bucket', function (t) {
26+
test.cb.serial('should load data from a csv file in a GCS bucket', function (t) {
2727
async.series([
2828
function (cb) {
2929
loadDataFromCsvExample.createTable(datasetId, tableName, cb);

test/computeengine/mailjet.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var proxyquire = require('proxyquire').noPreserveCache();
1818
process.env.MAILJET_API_KEY = 'foo';
1919
process.env.MAILJET_API_SECRET = 'bar';
2020

21-
test.cb('should send an email', function (t) {
21+
test.cb.serial('should send an email', function (t) {
2222
proxyquire('../../computeengine/mailjet.js', {
2323
nodemailer: {
2424
createTransport: function (arg) {

test/computeengine/sendgrid.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var test = require('ava');
1717
var proxyquire = require('proxyquire').noPreserveCache();
1818
process.env.SENDGRID_API_KEY = 'foo';
1919

20-
test.cb('should send an email', function (t) {
20+
test.cb.serial('should send an email', function (t) {
2121
proxyquire('../../computeengine/sendgrid.js', {
2222
sendgrid: function (key) {
2323
t.is(key, 'foo');

0 commit comments

Comments
 (0)