Revert "add volume support"
This reverts commit b8bb69f730.
Revert this for now, we will try a simpler non-object volume first
This commit is contained in:
@@ -1,92 +0,0 @@
|
||||
/* jslint node:true */
|
||||
/* global it:false */
|
||||
/* global describe:false */
|
||||
/* global before:false */
|
||||
/* global after:false */
|
||||
|
||||
'use strict';
|
||||
|
||||
let async = require('async'),
|
||||
BoxError = require('../boxerror.js'),
|
||||
database = require('../database.js'),
|
||||
expect = require('expect.js'),
|
||||
volumes = require('../volumes.js');
|
||||
|
||||
const AUDIT_SOURCE = { ip: '1.2.3.4' };
|
||||
|
||||
function setup(done) {
|
||||
async.series([
|
||||
database.initialize,
|
||||
database._clear,
|
||||
], done);
|
||||
}
|
||||
|
||||
function cleanup(done) {
|
||||
async.series([
|
||||
database._clear,
|
||||
database.uninitialize
|
||||
], done);
|
||||
}
|
||||
|
||||
describe('volumes', function () {
|
||||
before(setup);
|
||||
after(cleanup);
|
||||
|
||||
let volumeId;
|
||||
|
||||
describe('add', function () {
|
||||
it('cannot add invalid name', function (done) {
|
||||
volumes.add('fan&', '/tmp/foo', AUDIT_SOURCE, function (error) {
|
||||
expect(error.reason).to.be(BoxError.BAD_FIELD);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('cannot add invalid path', function (done) {
|
||||
volumes.add('fan', '/tmp/foo', AUDIT_SOURCE, function (error) {
|
||||
expect(error.reason).to.be(BoxError.BAD_FIELD);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('can add valid volume', function (done) {
|
||||
volumes.add('cloudron-test', '/media/cloudron-test', AUDIT_SOURCE, function (error, result) {
|
||||
expect(error).to.be(null);
|
||||
expect(result).to.be.a('string');
|
||||
|
||||
volumeId = result;
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('list', function () {
|
||||
it('can list volumes', function (done) {
|
||||
volumes.list(function (error, results) {
|
||||
expect(error).to.be(null);
|
||||
expect(results.length).to.be(1);
|
||||
expect(results[0].id).to.be(volumeId);
|
||||
expect(results[0].name).to.be('cloudron-test');
|
||||
expect(results[0].hostPath).to.be('/media/cloudron-test');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('del', function () {
|
||||
it('cannot remove random volume', function (done) {
|
||||
volumes.del('random', AUDIT_SOURCE, function (error) {
|
||||
expect(error.reason).to.be(BoxError.NOT_FOUND);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('cannot remove existing volume', function (done) {
|
||||
volumes.del(volumeId, AUDIT_SOURCE, function (error) {
|
||||
expect(error).to.be(null);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user