Skip to content

Commit

Permalink
Travis
Browse files Browse the repository at this point in the history
  • Loading branch information
apocas committed Oct 25, 2017
1 parent 8a60fd1 commit c8d8932
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 14 deletions.
24 changes: 24 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
sudo: required

language: node_js

node_js:
- "8"

before_script:
- docker pull ubuntu

services:
- docker

before_install:
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- sudo apt-get update
- sudo apt-get -y install docker-ce

install:
- npm install

script:
- npm test
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
docker-modem
============
# docker-modem [![Build Status](https://travis-ci.org/apocas/docker-modem.svg?branch=master)](https://travis-ci.org/apocas/docker-modem)

[Docker](https://www.docker.com/)'s Remote API network layer module.

Expand Down
26 changes: 14 additions & 12 deletions test/modem_test.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
var assert = require('assert');
var Modem = require('../lib/modem');

describe('Modem', function () {
beforeEach(function () { delete process.env.DOCKER_HOST; });
describe('Modem', function() {
beforeEach(function() {
delete process.env.DOCKER_HOST;
});

it('should default to /var/run/docker.sock', function () {
it('should default to /var/run/docker.sock', function() {
var modem = new Modem();
assert.ok(modem.socketPath);
assert.strictEqual(modem.socketPath, '/var/run/docker.sock');
});

it('should allow DOCKER_HOST=unix:///path/to/docker.sock', function () {
it('should allow DOCKER_HOST=unix:///path/to/docker.sock', function() {
process.env.DOCKER_HOST = 'unix:///tmp/docker.sock';

var modem = new Modem();
assert.ok(modem.socketPath);
assert.strictEqual(modem.socketPath, '/tmp/docker.sock');
});

it('should interpret DOCKER_HOST=unix:// as /var/run/docker.sock', function () {
it('should interpret DOCKER_HOST=unix:// as /var/run/docker.sock', function() {
process.env.DOCKER_HOST = 'unix://';

var modem = new Modem();
assert.ok(modem.socketPath);
assert.strictEqual(modem.socketPath, '/var/run/docker.sock');
});

it('should interpret DOCKER_HOST=tcp://N.N.N.N:2376 as https', function () {
it('should interpret DOCKER_HOST=tcp://N.N.N.N:2376 as https', function() {
process.env.DOCKER_HOST = 'tcp://192.168.59.103:2376';

var modem = new Modem();
Expand All @@ -38,7 +40,7 @@ describe('Modem', function () {
assert.strictEqual(modem.protocol, 'https');
});

it('should interpret DOCKER_HOST=tcp://N.N.N.N:5555 as http', function () {
it('should interpret DOCKER_HOST=tcp://N.N.N.N:5555 as http', function() {
delete process.env.DOCKER_TLS_VERIFY;
process.env.DOCKER_HOST = 'tcp://192.168.59.105:5555';

Expand All @@ -51,7 +53,7 @@ describe('Modem', function () {
assert.strictEqual(modem.protocol, 'http');
});

it('should interpret DOCKER_HOST=tcp://N.N.N.N:5555 as http', function () {
it('should interpret DOCKER_HOST=tcp://N.N.N.N:5555 as http', function() {
process.env.DOCKER_TLS_VERIFY = '1';
process.env.DOCKER_HOST = 'tcp://192.168.59.105:5555';

Expand All @@ -64,7 +66,7 @@ describe('Modem', function () {
assert.strictEqual(modem.protocol, 'https');
});

it('should accept DOCKER_HOST=N.N.N.N:5555 as http', function () {
it('should accept DOCKER_HOST=N.N.N.N:5555 as http', function() {
delete process.env.DOCKER_TLS_VERIFY;
process.env.DOCKER_HOST = '192.168.59.105:5555';

Expand All @@ -77,7 +79,7 @@ describe('Modem', function () {
assert.strictEqual(modem.protocol, 'http');
});

it('should auto encode querystring option maps as JSON', function () {
it('should auto encode querystring option maps as JSON', function() {
var modem = new Modem();

var opts = {
Expand All @@ -86,8 +88,8 @@ describe('Modem', function () {
"label": ["staging", "env=green"]
},
"t": ["repo:latest", "repo:1.0.0"]
}
var control = 'limit=12&filters={"label"%3A["staging"%2C"env%3Dgreen"]}&t=repo%3Alatest&t=repo%3A1.0.0'
};
var control = 'limit=12&filters={"label"%3A["staging"%2C"env%3Dgreen"]}&t=repo%3Alatest&t=repo%3A1.0.0';
var qs = modem.buildQuerystring(opts);
assert.strictEqual(decodeURI(qs), control);
});
Expand Down

0 comments on commit c8d8932

Please sign in to comment.