diff --git a/src/docker.js b/src/docker.js index 7443b3574..1692cd915 100644 --- a/src/docker.js +++ b/src/docker.js @@ -8,6 +8,7 @@ exports = module.exports = { ping, info, + df, downloadImage, createContainer, startContainer, @@ -630,6 +631,12 @@ async function info() { return result; } +async function df() { + const [error, result] = await safe(gConnection.df()); + if (error) throw new BoxError(BoxError.DOCKER_ERROR, 'Error connecting to docker'); + return result; +} + async function update(name, memory, memorySwap) { assert.strictEqual(typeof name, 'string'); assert.strictEqual(typeof memory, 'number'); diff --git a/src/test/docker-test.js b/src/test/docker-test.js new file mode 100644 index 000000000..5aadc593e --- /dev/null +++ b/src/test/docker-test.js @@ -0,0 +1,24 @@ +/* jslint node:true */ +/* global it:false */ +/* global before:false */ +/* global after:false */ +/* global describe:false */ + +'use strict'; + +const common = require('./common.js'), + docker = require('../docker.js'), + expect = require('expect.js'); + +describe('docker', function () { + const { setup, cleanup } = common; + + before(setup); + after(cleanup); + + it('can df', async function () { + const output = await docker.df(); + expect(output).to.be.ok(); + console.log(output); + }); +});