Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix regression tests. #402

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 18 additions & 29 deletions regression/pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

var assert = require('assert');
var async = require('async');
var uuid = require('node-uuid');

var env = require('./env.js');
var gcloud = require('../lib')(env);
Expand All @@ -28,8 +29,20 @@ var Subscription = require('../lib/pubsub/subscription.js');

var pubsub = gcloud.pubsub();

function generateTopicName() {
return 'test-topic-' + uuid.v4();
}

function generateSubName() {
return 'test-subscription-' + uuid.v4();
}

This comment was marked as spam.


describe('pubsub', function() {
var topicNames = ['topic1', 'topic2', 'topic3'];
var topicNames = [
generateTopicName(),
generateTopicName(),
generateTopicName()
];

function deleteAllTopics(callback) {
// TODO: Handle pagination.
Expand Down Expand Up @@ -91,45 +104,21 @@ describe('pubsub', function() {
});

describe('Subscription', function() {
var TOPIC_NAME = 'test-topic';
var TOPIC_NAME = generateTopicName();
var subscriptions = [
{
name: 'sub1',
name: generateSubName(),
options: { ackDeadlineSeconds: 30 }
},
{
name: 'sub2',
name: generateSubName(),
options: { ackDeadlineSeconds: 60 }
}
];

This comment was marked as spam.

var topic;

function deleteAllTopics(callback) {
pubsub.getTopics(function(err, topics) {
if (err) {
callback(err);
return;
}
async.parallel(topics.map(function(topic) {
return topic.delete.bind(topic);
}), callback);
});
}

function deleteAllSubscriptions(callback) {
pubsub.getSubscriptions(function(err, subs) {
if (err) {
callback(err);
return;
}
async.parallel(subs.map(function(sub) {
return sub.delete.bind(sub);
}), callback);
});
}

before(function(done) {
async.parallel([deleteAllTopics, deleteAllSubscriptions], function(err) {
deleteAllTopics(function(err) {

This comment was marked as spam.

assert.ifError(err);
// Create a new test topic.
pubsub.createTopic(TOPIC_NAME, function(err, newTopic) {
Expand Down
2 changes: 1 addition & 1 deletion regression/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ describe('storage', function() {

file.download(function(err, remoteContents) {
assert.ifError(err);
assert.equal(fileContents, remoteContents);
assert.equal(String(fileContents), String(remoteContents));

This comment was marked as spam.

done();
});
});
Expand Down