remove installer.retire
This commit is contained in:
@@ -15,13 +15,11 @@ exports = module.exports = {
|
||||
InstallerError: InstallerError,
|
||||
|
||||
provision: provision,
|
||||
retire: retire,
|
||||
|
||||
_ensureVersion: ensureVersion
|
||||
};
|
||||
|
||||
var INSTALLER_CMD = path.join(__dirname, 'scripts/installer.sh'),
|
||||
RETIRE_CMD = path.join(__dirname, 'scripts/retire.sh'),
|
||||
SUDO = '/usr/bin/sudo';
|
||||
|
||||
function InstallerError(reason, info) {
|
||||
@@ -63,21 +61,6 @@ function spawn(tag, cmd, args, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
function retire(args, callback) {
|
||||
assert.strictEqual(typeof args, 'object');
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
var pargs = [ RETIRE_CMD ];
|
||||
pargs.push('--data', JSON.stringify(args.data));
|
||||
|
||||
debug('retire: calling with args %j', pargs);
|
||||
|
||||
if (process.env.NODE_ENV === 'test') return callback(null);
|
||||
|
||||
// sudo is required for retire()
|
||||
spawn('retire', SUDO, pargs, callback);
|
||||
}
|
||||
|
||||
function ensureVersion(args, callback) {
|
||||
assert.strictEqual(typeof args, 'object');
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
@@ -109,46 +109,6 @@ describe('Server', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('retire', function () {
|
||||
var data = {
|
||||
data: {
|
||||
tlsKey: 'key',
|
||||
tlsCert: 'cert'
|
||||
}
|
||||
};
|
||||
|
||||
before(function (done) {
|
||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; // TODO: use a installer ca signed cert instead
|
||||
server.start(done);
|
||||
});
|
||||
|
||||
after(function (done) {
|
||||
server.stop(done);
|
||||
delete process.env.NODE_TLS_REJECT_UNAUTHORIZED;
|
||||
});
|
||||
|
||||
Object.keys(data).forEach(function (key) {
|
||||
it('fails due to missing ' + key, function (done) {
|
||||
var dataCopy = _.merge({ }, data);
|
||||
delete dataCopy[key];
|
||||
|
||||
request.post(EXTERNAL_SERVER_URL + '/api/v1/installer/retire').send(dataCopy).end(function (error, result) {
|
||||
expect(error).to.not.be.ok();
|
||||
expect(result.statusCode).to.equal(400);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('succeeds', function (done) {
|
||||
request.post(EXTERNAL_SERVER_URL + '/api/v1/installer/retire').send(data).end(function (error, result) {
|
||||
expect(error).to.not.be.ok();
|
||||
expect(result.statusCode).to.equal(202);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('ensureVersion', function () {
|
||||
before(function () {
|
||||
process.env.NODE_ENV = undefined;
|
||||
|
||||
Reference in New Issue
Block a user