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:
@@ -23,7 +23,6 @@ var appdb = require('../appdb.js'),
|
||||
taskdb = require('../taskdb.js'),
|
||||
tokendb = require('../tokendb.js'),
|
||||
userdb = require('../userdb.js'),
|
||||
volumedb = require('../volumedb.js'),
|
||||
_ = require('underscore');
|
||||
|
||||
var USER_0 = {
|
||||
@@ -419,8 +418,7 @@ describe('database', function () {
|
||||
dataDir: null,
|
||||
tags: [],
|
||||
label: null,
|
||||
taskId: null,
|
||||
volumeIds: []
|
||||
taskId: null
|
||||
};
|
||||
|
||||
it('cannot delete referenced domain', function (done) {
|
||||
@@ -608,7 +606,7 @@ describe('database', function () {
|
||||
});
|
||||
|
||||
it('can get all admins', function (done) {
|
||||
userdb.getByRole('owner', function (error) {
|
||||
userdb.getByRole('owner', function (error, all) {
|
||||
expect(error).to.be.ok();
|
||||
expect(error.reason).to.be(BoxError.NOT_FOUND);
|
||||
done();
|
||||
@@ -891,8 +889,7 @@ describe('database', function () {
|
||||
dataDir: null,
|
||||
tags: [],
|
||||
label: null,
|
||||
taskId: null,
|
||||
volumeIds: []
|
||||
taskId: null
|
||||
};
|
||||
|
||||
var APP_1 = {
|
||||
@@ -923,8 +920,7 @@ describe('database', function () {
|
||||
dataDir: null,
|
||||
tags: [],
|
||||
label: null,
|
||||
taskId: null,
|
||||
volumeIds: []
|
||||
taskId: null
|
||||
};
|
||||
|
||||
before(function (done) {
|
||||
@@ -1967,110 +1963,4 @@ describe('database', function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('volumes', function () {
|
||||
before(function (done) {
|
||||
done();
|
||||
});
|
||||
|
||||
after(function (done) {
|
||||
database._clear(done);
|
||||
});
|
||||
|
||||
it('can add volume', function (done) {
|
||||
volumedb.add('id1', 'myvolume', '/tmp/foo', function (error) {
|
||||
expect(error).to.be(null);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('cannot add conflicting name', function (done) {
|
||||
volumedb.add('someotherid', 'myvolume', '/tmp/bar', function (error) {
|
||||
expect(error.reason).to.be(BoxError.ALREADY_EXISTS);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('cannot get random id', function (done) {
|
||||
volumedb.get('randomid', function (error) {
|
||||
expect(error.reason).to.be(BoxError.NOT_FOUND);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('can get existing id', function (done) {
|
||||
volumedb.get('id1', function (error, result) {
|
||||
expect(error).to.be(null);
|
||||
expect(result.name).to.be('myvolume');
|
||||
expect(result.hostPath).to.be('/tmp/foo');
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('cannot update random id', function (done) {
|
||||
volumedb.update('randomid', { name: 'theirvolume', hostPath: '/tmp/bar' }, function (error) {
|
||||
expect(error.reason).to.be(BoxError.NOT_FOUND);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('can add another volume', function (done) {
|
||||
volumedb.add('id2', 'myvolume2', '/tmp/foo2', function (error) {
|
||||
expect(error).to.be(null);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('cannot update to existing path', function (done) {
|
||||
volumedb.update('id1', { name: 'myvolume2', hostPath: '/tmp/foo' }, function (error) {
|
||||
expect(error.reason).to.be(BoxError.ALREADY_EXISTS);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('can update existing id', function (done) {
|
||||
volumedb.update('id1', { hostPath: '/tmp/bar' }, function (error) {
|
||||
expect(error).to.be(null);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('can list', function (done) {
|
||||
volumedb.list(function (error, result) {
|
||||
expect(error).to.be(null);
|
||||
expect(result.length).to.be(2);
|
||||
expect(result[0].name).to.be('myvolume');
|
||||
expect(result[0].hostPath).to.be('/tmp/bar');
|
||||
|
||||
expect(result[1].name).to.be('myvolume2');
|
||||
expect(result[1].hostPath).to.be('/tmp/foo2');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('cannot delete random id', function (done) {
|
||||
volumedb.del('randomid', function (error) {
|
||||
expect(error.reason).to.be(BoxError.NOT_FOUND);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('can delete existing id', function (done) {
|
||||
volumedb.del('id1', function (error) {
|
||||
expect(error).to.be(null);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user