Add cleanup scripts
This commit is contained in:
parent
4969a88dfa
commit
6be392841f
@ -28,6 +28,11 @@ AppStore.prototype.setCredentials = function (password, accessToken) {
|
||||
this._credentials = { password: password, accessToken: accessToken };
|
||||
};
|
||||
|
||||
AppStore.prototype.getCloudrons = function () {
|
||||
var res = request.get(this._origin + '/api/v1/cloudrons').query({ accessToken: this._credentials.accessToken, page: 1, per_page: 50 }).end();
|
||||
return res.body.boxes;
|
||||
};
|
||||
|
||||
AppStore.prototype.waitForCloudron = function (boxId) {
|
||||
var creationTime = new Date();
|
||||
process.stdout.write('Waiting for cloudron to come up.');
|
||||
|
43
test/000-cleanup.js
Normal file
43
test/000-cleanup.js
Normal file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
* This test cleans up all t-* cloudrons from previous run.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var AppStore = require('../appstore.js'),
|
||||
assert = require('assert'),
|
||||
Cloudron = require('../cloudron.js'),
|
||||
common = require('../common.js'),
|
||||
request = require('superagent-sync'),
|
||||
semver = require('semver');
|
||||
|
||||
require('colors');
|
||||
|
||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
||||
|
||||
describe('Cleanup old cloudrons', function () {
|
||||
this.timeout(0);
|
||||
|
||||
var appStore = new AppStore('https://api.staging.cloudron.io');
|
||||
|
||||
var owner = common.getOwner();
|
||||
var cloudrons;
|
||||
|
||||
it('can login to the store', function () {
|
||||
var accessToken = appStore.getAccessToken(owner);
|
||||
appStore.setCredentials(owner.password, accessToken);
|
||||
});
|
||||
|
||||
it('can list cloudrons', function () {
|
||||
cloudrons = appStore.getCloudrons();
|
||||
});
|
||||
|
||||
it('can delete the cloudrons', function () {
|
||||
for (var i = 0; i < cloudrons.length; i++) {
|
||||
appStore.deleteCloudron(cloudrons[i]);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user