1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-22 06:49:40 +02:00

Added ENV variables to container start.

This commit is contained in:
Kevan Ahlquist 2015-01-20 01:42:08 -06:00
parent 76d7e280f9
commit 4d22a04484
4 changed files with 68 additions and 6 deletions

View file

@ -19,7 +19,7 @@ describe('startContainerController', function () {
});
}));
describe('Starting a container with options', function () {
describe('Create and start a container with port bindings', function () {
it('should issue a correct create request to the Docker remote API', function() {
var controller = createController();
var id = '6abd8bfba81cf8a05a76a4bdefcb36c4b66cd02265f4bfcd0e236468696ebc6c';
@ -30,6 +30,7 @@ describe('startContainerController', function () {
"CpuShares": 1024,
"Cmd": null,
"VolumesFrom": "",
"Env": [],
"ExposedPorts":{
"9000/tcp": {},
},
@ -53,11 +54,40 @@ describe('startContainerController', function () {
scope.config.name = 'container-name';
scope.config.portBindings = [{ip: '10.20.10.15', extPort: '9999', intPort: '9000'}]
//var response = mockContainer.create({});
scope.create();
$httpBackend.flush();
//console.log(response);
});
});
});
describe('Create and start a container with environment variables', function () {
it('should issue a correct create request to the Docker remote API', function() {
var controller = createController();
var id = '6abd8bfba81cf8a05a76a4bdefcb36c4b66cd02265f4bfcd0e236468696ebc6c';
var expectedBody = {
"name": "container-name",
"Memory": 0,
"MemorySwap": 0,
"CpuShares": 1024,
"Cmd": null,
"VolumesFrom": "",
"Env":["SHELL=/bin/bash", "TERM=xterm-256color"],
"ExposedPorts":{},
"HostConfig": {"PortBindings":{}}
};
$httpBackend.expectPOST('/dockerapi/containers/create?name=container-name', expectedBody).respond({
"Id": id,
"Warnings": null
});
$httpBackend.expectPOST('/dockerapi/containers/' + id + '/start?').respond({
"Id": id,
"Warnings": null
});
scope.config.name = 'container-name';
scope.config.env = [{name: 'SHELL', value: '/bin/bash'}, {name: 'TERM', value: 'xterm-256color'}];
scope.create();
$httpBackend.flush();
});
});
});