async'ify the groups code

This commit is contained in:
Girish Ramakrishnan
2021-06-28 15:15:28 -07:00
parent 7009c142cb
commit 31498afe39
15 changed files with 392 additions and 1065 deletions
+5 -5
View File
@@ -35,31 +35,31 @@ describe('Volumes', function () {
after(cleanup);
it('cannot add bad name', async function () {
const [error] = await safe(volumes.add({ name: 'music/is', hostPath: '/tmp/music', mountType: 'noop', mountOptions: {} }, AUDIT_SOURCE));
const [error] = await safe(volumes.add({ name: 'music/is', hostPath: '/tmp/music', mountType: 'filesystem', mountOptions: {} }, AUDIT_SOURCE));
if (!error) throw new Error('Expecting bad field error');
expect(error.reason).to.be(BoxError.BAD_FIELD);
});
it('cannot add bad path', async function () {
const [error] = await safe(volumes.add({ name: 'music', hostPath: '/tmp/music', mountType: 'noop', mountOptions: {} }, AUDIT_SOURCE));
const [error] = await safe(volumes.add({ name: 'music', hostPath: '/tmp/music', mountType: 'filesystem', mountOptions: {} }, AUDIT_SOURCE));
if (!error) throw new Error('Expecting bad field error');
expect(error.reason).to.be(BoxError.BAD_FIELD);
});
let volume;
it('can add volume', async function () {
const id = await volumes.add({ name: 'music', hostPath: '/mnt/cloudron-test-music', mountType: 'noop', mountOptions: {} }, AUDIT_SOURCE);
const id = await volumes.add({ name: 'music', hostPath: '/mnt/cloudron-test-music', mountType: 'filesystem', mountOptions: {} }, AUDIT_SOURCE);
expect(id).to.be.a('string');
volume = { id, name: 'music', hostPath: '/mnt/cloudron-test-music' };
});
it('cannot add duplicate path', async function () {
const [error] = await safe(volumes.add({ name: 'music-dup', hostPath: '/mnt/cloudron-test-music', mountType: 'noop', mountOptions: {} }, AUDIT_SOURCE));
const [error] = await safe(volumes.add({ name: 'music-dup', hostPath: '/mnt/cloudron-test-music', mountType: 'filesystem', mountOptions: {} }, AUDIT_SOURCE));
expect(error.reason).to.be(BoxError.ALREADY_EXISTS);
});
it('cannot add duplicate name', async function () {
const [error] = await safe(volumes.add({ name: 'music', hostPath: '/mnt/cloudron-test-music2', mountType: 'noop', mountOptions: {} }, AUDIT_SOURCE));
const [error] = await safe(volumes.add({ name: 'music', hostPath: '/mnt/cloudron-test-music2', mountType: 'filesystem', mountOptions: {} }, AUDIT_SOURCE));
expect(error.reason).to.be(BoxError.ALREADY_EXISTS);
});