Skip to content

Commit

Permalink
[api test] Finish tests for jitsu cloud <provider> <datacenter>
Browse files Browse the repository at this point in the history
  • Loading branch information
indexzero committed Feb 6, 2013
1 parent 709a2a0 commit 8c02015
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
32 changes: 28 additions & 4 deletions lib/jitsu/commands/apps.js
Expand Up @@ -8,7 +8,8 @@
var analyzer = require('require-analyzer'),
opener = require('opener'),
jitsu = require('../../jitsu'),
utile = jitsu.common;
utile = jitsu.common,
async = utile.async;

var apps = exports;

Expand Down Expand Up @@ -866,9 +867,32 @@ apps.cloud = function (name, provider, datacenter, drones) {
jitsu.log.info('Deploying application in cloud with:')
jitsu.inspect.putObject(cloud);

jitsu.apps.datacenter(app.name, cloud, function (err, res) {
console.dir(res);
callback(new Error('not implemented'));
async.series({
//
// 1. Fetch the endpoints so that we can properly
// tell the user what datacenter they are in later.
//
endpoints: function getEndpoints(next) {
jitsu.apps.endpoints(next);
},
//
// 2. Start the app with the specified cloud information.
//
start: function start(next) {
jitsu.apps.datacenter(app.name, cloud, next);
}
}, function (err, result) {
var endpoints = result.endpoints,
tld = result.endpoints[provider][datacenter];

if (err) {
jitsu.log.error('Error starting ' + name.magenta);
return callback(err);
}

jitsu.log.info('App ' + name.magenta + ' is now started');
jitsu.log.info(('http://' + app.subdomain + tld.replace('api', '')).magenta + ' on Port ' + '80'.magenta);
callback(null, app);
});
}

Expand Down
3 changes: 2 additions & 1 deletion test/commands/apps-test.js
Expand Up @@ -18,7 +18,7 @@ var shouldNodejitsuOk = macros.shouldNodejitsuOk,

var mainDirectory = process.cwd();

var cloud = [{ drones: 0, provider: 'joyent', datacenter: 'us-east-1' }],
var cloud = [{ drones: 2, provider: 'joyent', datacenter: 'us-east-1' }],
endpoints = {
"endpoints": {
"joyent": {
Expand Down Expand Up @@ -652,6 +652,7 @@ vows.describe('jitsu/commands/apps').addBatch({
app: {
name: 'example-app',
maxDrones: 2,
subdomain: 'example-app',
config: {
cloud: [{
provider: 'joyent',
Expand Down

0 comments on commit 8c02015

Please sign in to comment.