From 9698aa7ad5001a9a60dad518d0abca56fbd339c6 Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Fri, 2 Sep 2016 15:25:20 +1200 Subject: [PATCH] feat(ui): remove the errorMsg filter and replace it with proper error management --- .../container/containerController.js | 21 +- .../containerConsoleController.js | 23 +- .../containers/containersController.js | 4 +- .../createContainerController.js | 35 ++- .../createNetwork/createNetworkController.js | 18 +- .../createVolume/createVolumeController.js | 18 +- app/components/network/networkController.js | 4 +- app/components/networks/networksController.js | 4 +- .../templates/templatesController.js | 48 +++-- app/components/volumes/volumesController.js | 4 +- app/shared/filters.js | 12 -- app/shared/responseHandlers.js | 12 +- app/shared/services.js | 35 ++- test/unit/app/shared/filters.spec.js | 199 ------------------ 14 files changed, 145 insertions(+), 292 deletions(-) diff --git a/app/components/container/containerController.js b/app/components/container/containerController.js index 21d8ff7e6..98f614d61 100644 --- a/app/components/container/containerController.js +++ b/app/components/container/containerController.js @@ -1,6 +1,6 @@ angular.module('container', []) -.controller('ContainerController', ['$scope', '$state','$stateParams', '$filter', 'Container', 'ContainerCommit', 'ImageHelper', 'Messages', 'errorMsgFilter', -function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, ImageHelper, Messages, errorMsgFilter) { +.controller('ContainerController', ['$scope', '$state','$stateParams', '$filter', 'Container', 'ContainerCommit', 'ImageHelper', 'Messages', +function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, ImageHelper, Messages) { $scope.activityTime = 0; $scope.portBindings = []; $scope.config = { @@ -149,13 +149,18 @@ function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, Ima $scope.renameContainer = function () { Container.rename({id: $stateParams.id, 'name': $scope.container.newContainerName}, function (d) { - if (d.name) { - $scope.container.Name = d.name; - Messages.send("Container successfully renamed", d.name); - } else { - var error = errorMsgFilter(d); + if (d.message) { $scope.container.newContainerName = $scope.container.Name; - Messages.error("Unable to rename container", error); + Messages.error("Unable to rename container", d.message); + } else { + $scope.container.Name = $scope.container.newContainerName; + Messages.send("Container successfully renamed", d.name); + } + }, function (e) { + if (e.data.message) { + Messages.error("Failure", e.data.message); + } else { + Messages.error("Failure", 'Unable to rename container'); } }); $scope.container.edit = false; diff --git a/app/components/containerConsole/containerConsoleController.js b/app/components/containerConsole/containerConsoleController.js index 644e5f3dd..2fdfd67b6 100644 --- a/app/components/containerConsole/containerConsoleController.js +++ b/app/components/containerConsole/containerConsoleController.js @@ -1,6 +1,6 @@ angular.module('containerConsole', []) -.controller('ContainerConsoleController', ['$scope', '$stateParams', 'Settings', 'Container', 'Exec', '$timeout', 'Messages', 'errorMsgFilter', -function ($scope, $stateParams, Settings, Container, Exec, $timeout, Messages, errorMsgFilter) { +.controller('ContainerConsoleController', ['$scope', '$stateParams', 'Settings', 'Container', 'Exec', '$timeout', 'Messages', +function ($scope, $stateParams, Settings, Container, Exec, $timeout, Messages) { $scope.state = {}; $scope.state.command = "bash"; $scope.connected = false; @@ -33,7 +33,10 @@ function ($scope, $stateParams, Settings, Container, Exec, $timeout, Messages, e }; Container.exec(execConfig, function(d) { - if (d.Id) { + if (d.message) { + $('#loadConsoleSpinner').hide(); + Messages.error('Error', d.message); + } else { var execId = d.Id; resizeTTY(execId, termHeight, termWidth); var url = window.location.href.split('#')[0] + 'ws/exec?id=' + execId; @@ -43,13 +46,14 @@ function ($scope, $stateParams, Settings, Container, Exec, $timeout, Messages, e url = url.replace('http://', 'ws://'); } initTerm(url, termHeight, termWidth); - } else { - $('#loadConsoleSpinner').hide(); - Messages.error('Error', errorMsgFilter(d)); } }, function (e) { $('#loadConsoleSpinner').hide(); - Messages.error("Failure", e.data); + if (e.data.message) { + Messages.error("Failure", e.data.message); + } else { + Messages.error("Failure", 'Unable to start an exec instance'); + } }); }; @@ -66,10 +70,11 @@ function ($scope, $stateParams, Settings, Container, Exec, $timeout, Messages, e function resizeTTY(execId, height, width) { $timeout(function() { Exec.resize({id: execId, height: height, width: width}, function (d) { - var error = errorMsgFilter(d); - if (error) { + if (d.message) { Messages.error('Error', 'Unable to resize TTY'); } + }, function (e) { + Messages.error("Failure", 'Unable to resize TTY'); }); }, 2000); diff --git a/app/components/containers/containersController.js b/app/components/containers/containersController.js index 5c40bff7e..d399a9e55 100644 --- a/app/components/containers/containersController.js +++ b/app/components/containers/containersController.js @@ -1,6 +1,6 @@ angular.module('containers', []) -.controller('ContainersController', ['$scope', 'Container', 'ContainerHelper', 'Info', 'Settings', 'Messages', 'Config', 'errorMsgFilter', -function ($scope, Container, ContainerHelper, Info, Settings, Messages, Config, errorMsgFilter) { +.controller('ContainersController', ['$scope', 'Container', 'ContainerHelper', 'Info', 'Settings', 'Messages', 'Config', +function ($scope, Container, ContainerHelper, Info, Settings, Messages, Config) { $scope.state = {}; $scope.state.displayAll = Settings.displayAll; diff --git a/app/components/createContainer/createContainerController.js b/app/components/createContainer/createContainerController.js index 23a98f207..e16987228 100644 --- a/app/components/createContainer/createContainerController.js +++ b/app/components/createContainer/createContainerController.js @@ -1,6 +1,6 @@ angular.module('createContainer', []) -.controller('CreateContainerController', ['$scope', '$state', 'Config', 'Container', 'Image', 'Volume', 'Network', 'Messages', 'errorMsgFilter', -function ($scope, $state, Config, Container, Image, Volume, Network, Messages, errorMsgFilter) { +.controller('CreateContainerController', ['$scope', '$state', 'Config', 'Container', 'Image', 'Volume', 'Network', 'Messages', +function ($scope, $state, Config, Container, Image, Volume, Network, Messages) { $scope.state = { alwaysPull: true @@ -86,22 +86,35 @@ function ($scope, $state, Config, Container, Image, Volume, Network, Messages, e // TODO: centralize, already present in templatesController function createContainer(config) { Container.create(config, function (d) { - if (d.Id) { + if (d.message) { + $('#createContainerSpinner').hide(); + Messages.error('Error', d.message); + } else { Container.start({id: d.Id}, {}, function (cd) { - $('#createContainerSpinner').hide(); - Messages.send('Container Started', d.Id); - $state.go('containers', {}, {reload: true}); + if (cd.message) { + $('#createContainerSpinner').hide(); + Messages.error('Error', cd.message); + } else { + $('#createContainerSpinner').hide(); + Messages.send('Container Started', d.Id); + $state.go('containers', {}, {reload: true}); + } }, function (e) { $('#createContainerSpinner').hide(); - Messages.error('Error', errorMsgFilter(e)); + if (e.data.message) { + Messages.error("Failure", e.data.message); + } else { + Messages.error("Failure", 'Unable to start container'); + } }); - } else { - $('#createContainerSpinner').hide(); - Messages.error('Error', errorMsgFilter(d)); } }, function (e) { $('#createContainerSpinner').hide(); - Messages.error('Error', errorMsgFilter(e)); + if (e.data.message) { + Messages.error("Failure", e.data.message); + } else { + Messages.error("Failure", 'Unable to create container'); + } }); } diff --git a/app/components/createNetwork/createNetworkController.js b/app/components/createNetwork/createNetworkController.js index 56ffb79f6..2eb35f913 100644 --- a/app/components/createNetwork/createNetworkController.js +++ b/app/components/createNetwork/createNetworkController.js @@ -1,6 +1,6 @@ angular.module('createNetwork', []) -.controller('CreateNetworkController', ['$scope', '$state', 'Messages', 'Network', 'errorMsgFilter', -function ($scope, $state, Messages, Network, errorMsgFilter) { +.controller('CreateNetworkController', ['$scope', '$state', 'Messages', 'Network', +function ($scope, $state, Messages, Network) { $scope.formValues = { DriverOptions: [], Subnet: '', @@ -27,17 +27,21 @@ function ($scope, $state, Messages, Network, errorMsgFilter) { function createNetwork(config) { $('#createNetworkSpinner').show(); Network.create(config, function (d) { - if (d.Id) { + if (d.message) { + $('#createNetworkSpinner').hide(); + Messages.error('Unable to create network', d.message); + } else { Messages.send("Network created", d.Id); $('#createNetworkSpinner').hide(); $state.go('networks', {}, {reload: true}); - } else { - $('#createNetworkSpinner').hide(); - Messages.error('Unable to create network', errorMsgFilter(d)); } }, function (e) { $('#createNetworkSpinner').hide(); - Messages.error('Unable to create network', e.data); + if (e.data.message) { + Messages.error("Failure", e.data.message); + } else { + Messages.error("Failure", 'Unable to create network'); + } }); } diff --git a/app/components/createVolume/createVolumeController.js b/app/components/createVolume/createVolumeController.js index fb347adb1..1e65ad287 100644 --- a/app/components/createVolume/createVolumeController.js +++ b/app/components/createVolume/createVolumeController.js @@ -1,6 +1,6 @@ angular.module('createVolume', []) -.controller('CreateVolumeController', ['$scope', '$state', 'Volume', 'Messages', 'errorMsgFilter', -function ($scope, $state, Volume, Messages, errorMsgFilter) { +.controller('CreateVolumeController', ['$scope', '$state', 'Volume', 'Messages', +function ($scope, $state, Volume, Messages) { $scope.formValues = { DriverOptions: [] @@ -21,17 +21,21 @@ function ($scope, $state, Volume, Messages, errorMsgFilter) { function createVolume(config) { $('#createVolumeSpinner').show(); Volume.create(config, function (d) { - if (d.Name) { + if (d.message) { + $('#createVolumeSpinner').hide(); + Messages.error('Unable to create volume', d.message); + } else { Messages.send("Volume created", d.Name); $('#createVolumeSpinner').hide(); $state.go('volumes', {}, {reload: true}); - } else { - $('#createVolumeSpinner').hide(); - Messages.error('Unable to create volume', errorMsgFilter(d)); } }, function (e) { $('#createVolumeSpinner').hide(); - Messages.error('Unable to create volume', e.data); + if (e.data.message) { + Messages.error("Failure", e.data.message); + } else { + Messages.error("Failure", 'Unable to create volume'); + } }); } diff --git a/app/components/network/networkController.js b/app/components/network/networkController.js index bb7a3f4b9..159a48677 100644 --- a/app/components/network/networkController.js +++ b/app/components/network/networkController.js @@ -1,6 +1,6 @@ angular.module('network', []) -.controller('NetworkController', ['$scope', 'Network', 'Messages', '$state', '$stateParams', 'errorMsgFilter', -function ($scope, Network, Messages, $state, $stateParams, errorMsgFilter) { +.controller('NetworkController', ['$scope', 'Network', 'Messages', '$state', '$stateParams', +function ($scope, Network, Messages, $state, $stateParams) { $scope.disconnect = function disconnect(networkId, containerId) { $('#loadingViewSpinner').show(); diff --git a/app/components/networks/networksController.js b/app/components/networks/networksController.js index d42c2b949..a2b5dcd61 100644 --- a/app/components/networks/networksController.js +++ b/app/components/networks/networksController.js @@ -1,6 +1,6 @@ angular.module('networks', []) -.controller('NetworksController', ['$scope', '$state', 'Network', 'Config', 'Messages', 'errorMsgFilter', -function ($scope, $state, Network, Config, Messages, errorMsgFilter) { +.controller('NetworksController', ['$scope', '$state', 'Network', 'Config', 'Messages', +function ($scope, $state, Network, Config, Messages) { $scope.state = {}; $scope.state.selectedItemCount = 0; $scope.state.advancedSettings = false; diff --git a/app/components/templates/templatesController.js b/app/components/templates/templatesController.js index 112b04c34..a1295d2fd 100644 --- a/app/components/templates/templatesController.js +++ b/app/components/templates/templatesController.js @@ -1,6 +1,6 @@ angular.module('templates', []) -.controller('TemplatesController', ['$scope', '$q', '$state', '$filter', 'Config', 'Container', 'ContainerHelper', 'Image', 'Volume', 'Network', 'Templates', 'Messages', 'errorMsgFilter', -function ($scope, $q, $state, $filter, Config, Container, ContainerHelper, Image, Volume, Network, Templates, Messages, errorMsgFilter) { +.controller('TemplatesController', ['$scope', '$q', '$state', '$filter', 'Config', 'Container', 'ContainerHelper', 'Image', 'Volume', 'Network', 'Templates', 'Messages', +function ($scope, $q, $state, $filter, Config, Container, ContainerHelper, Image, Volume, Network, Templates, Messages) { $scope.templates = []; $scope.selectedTemplate = null; $scope.formValues = { @@ -13,25 +13,39 @@ function ($scope, $q, $state, $filter, Config, Container, ContainerHelper, Image // TODO: centralize, already present in createContainerController function createContainer(config) { Container.create(config, function (d) { - if (d.Id) { + if (d.message) { + $('#createContainerSpinner').hide(); + Messages.error('Error', d.message); + } else { Container.start({id: d.Id}, {}, function (cd) { - $('#createContainerSpinner').hide(); - Messages.send('Container Started', d.Id); - $state.go('containers', {}, {reload: true}); + if (cd.message) { + $('#createContainerSpinner').hide(); + Messages.error('Error', cd.message); + } else { + $('#createContainerSpinner').hide(); + Messages.send('Container Started', d.Id); + $state.go('containers', {}, {reload: true}); + } }, function (e) { $('#createContainerSpinner').hide(); - Messages.error('Error', errorMsgFilter(e)); + if (e.data.message) { + Messages.error("Failure", e.data.message); + } else { + Messages.error("Failure", 'Unable to start container'); + } }); - } else { - $('#createContainerSpinner').hide(); - Messages.error('Error', errorMsgFilter(d)); } }, function (e) { $('#createContainerSpinner').hide(); - Messages.error('Error', errorMsgFilter(e)); + if (e.data.message) { + Messages.error("Failure", e.data.message); + } else { + Messages.error("Failure", 'Unable to create container'); + } }); } + // TODO: centralize, already present in createContainerController function pullImageAndCreateContainer(imageConfig, containerConfig) { Image.create(imageConfig, function (data) { @@ -105,15 +119,19 @@ function ($scope, $q, $state, $filter, Config, Container, ContainerHelper, Image template.volumes.forEach(function (vol) { volumeQueries.push( Volume.create({}, function (d) { - if (d.Name) { + if (d.message) { + Messages.error('Unable to create volume', d.message); + } else { Messages.send("Volume created", d.Name); containerConfig.Volumes[vol] = {}; containerConfig.HostConfig.Binds.push(d.Name + ':' + vol); - } else { - Messages.error('Unable to create volume', errorMsgFilter(d)); } }, function (e) { - Messages.error('Unable to create volume', e.data); + if (e.data.message) { + Messages.error("Failure", e.data.message); + } else { + Messages.error("Failure", 'Unable to create volume'); + } }).$promise ); }); diff --git a/app/components/volumes/volumesController.js b/app/components/volumes/volumesController.js index cad6790e3..ecb1b2ed9 100644 --- a/app/components/volumes/volumesController.js +++ b/app/components/volumes/volumesController.js @@ -1,6 +1,6 @@ angular.module('volumes', []) -.controller('VolumesController', ['$scope', '$state', 'Volume', 'Messages', 'errorMsgFilter', -function ($scope, $state, Volume, Messages, errorMsgFilter) { +.controller('VolumesController', ['$scope', '$state', 'Volume', 'Messages', +function ($scope, $state, Volume, Messages) { $scope.state = {}; $scope.state.selectedItemCount = 0; $scope.sortType = 'Name'; diff --git a/app/shared/filters.js b/app/shared/filters.js index 23c1f86c3..4c73cc31b 100644 --- a/app/shared/filters.js +++ b/app/shared/filters.js @@ -191,16 +191,4 @@ angular.module('uifordocker.filters', []) return function (obj) { return _.isEmpty(obj); }; -}) - -.filter('errorMsg', function () { - return function (object) { - var idx = 0; - var msg = ''; - while (object[idx] && typeof(object[idx]) === 'string') { - msg += object[idx]; - idx++; - } - return msg; - }; }); diff --git a/app/shared/responseHandlers.js b/app/shared/responseHandlers.js index 486205a55..95b7e9c92 100644 --- a/app/shared/responseHandlers.js +++ b/app/shared/responseHandlers.js @@ -21,13 +21,13 @@ function jsonObjectsToArrayHandler(data) { return angular.fromJson(str); } -// The Docker API often returns an empty string on success (Docker 1.9 -> Docker 1.12). +// The Docker API often returns an empty string or a valid JSON object on success (Docker 1.9 -> Docker 1.12). // On error, it returns either an error message as a string (Docker < 1.12) or a JSON object with the field message -// container the error (Docker = 1.12). -// This handler returns an empty object on success or a newly created JSON object with -// the field message containing the error message on failure. -// Used by the API in: container deletion, network deletion. -function deleteGenericHandler(data) { +// container the error (Docker = 1.12) +// This handler ensure a valid JSON object is returned in any case. +// Used by the API in: container deletion, network deletion, network creation, volume creation, +// container exec, exec resize. +function genericHandler(data) { var response = {}; // No data is returned when deletion is successful (Docker 1.9 -> 1.12) if (!data) { diff --git a/app/shared/services.js b/app/shared/services.js index 39e8c0edb..32848d97e 100644 --- a/app/shared/services.js +++ b/app/shared/services.js @@ -8,28 +8,43 @@ angular.module('uifordocker.services', ['ngResource', 'ngSanitize']) }, { query: {method: 'GET', params: {all: 0, action: 'json'}, isArray: true}, get: {method: 'GET', params: {action: 'json'}}, - start: {method: 'POST', params: {id: '@id', action: 'start'}}, stop: {method: 'POST', params: {id: '@id', t: 5, action: 'stop'}}, restart: {method: 'POST', params: {id: '@id', t: 5, action: 'restart'}}, kill: {method: 'POST', params: {id: '@id', action: 'kill'}}, pause: {method: 'POST', params: {id: '@id', action: 'pause'}}, unpause: {method: 'POST', params: {id: '@id', action: 'unpause'}}, changes: {method: 'GET', params: {action: 'changes'}, isArray: true}, - create: {method: 'POST', params: {action: 'create'}}, + stats: {method: 'GET', params: {id: '@id', stream: false, action: 'stats'}, timeout: 5000}, + start: { + method: 'POST', params: {id: '@id', action: 'start'}, + transformResponse: genericHandler + }, + create: { + method: 'POST', params: {action: 'create'}, + transformResponse: genericHandler + }, remove: { method: 'DELETE', params: {id: '@id', v: 0}, - transformResponse: deleteGenericHandler + transformResponse: genericHandler }, - rename: {method: 'POST', params: {id: '@id', action: 'rename', name: '@name'}}, - stats: {method: 'GET', params: {id: '@id', stream: false, action: 'stats'}, timeout: 5000}, - exec: {method: 'POST', params: {id: '@id', action: 'exec'}} + rename: { + method: 'POST', params: {id: '@id', action: 'rename', name: '@name'}, + transformResponse: genericHandler + }, + exec: { + method: 'POST', params: {id: '@id', action: 'exec'}, + transformResponse: genericHandler + } }); }]) .factory('Exec', ['$resource', 'Settings', function ExecFactory($resource, Settings) { 'use strict'; // https://docs.docker.com/engine/reference/api/docker_remote_api_<%= remoteApiVersion %>/#/exec-resize return $resource(Settings.url + '/exec/:id/:action', {}, { - resize: {method: 'POST', params: {id: '@id', action: 'resize', h: '@height', w: '@width'}} + resize: { + method: 'POST', params: {id: '@id', action: 'resize', h: '@height', w: '@width'}, + transformResponse: genericHandler + } }); }]) .factory('ContainerCommit', ['$resource', '$http', 'Settings', function ContainerCommitFactory($resource, $http, Settings) { @@ -137,8 +152,8 @@ angular.module('uifordocker.services', ['ngResource', 'ngSanitize']) return $resource(Settings.url + '/networks/:id/:action', {id: '@id'}, { query: {method: 'GET', isArray: true}, get: {method: 'GET'}, - create: {method: 'POST', params: {action: 'create'}}, - remove: { method: 'DELETE', transformResponse: deleteGenericHandler }, + create: {method: 'POST', params: {action: 'create'}, transformResponse: genericHandler}, + remove: { method: 'DELETE', transformResponse: genericHandler }, connect: {method: 'POST', params: {action: 'connect'}}, disconnect: {method: 'POST', params: {action: 'disconnect'}} }); @@ -149,7 +164,7 @@ angular.module('uifordocker.services', ['ngResource', 'ngSanitize']) return $resource(Settings.url + '/volumes/:name/:action', {name: '@name'}, { query: {method: 'GET'}, get: {method: 'GET'}, - create: {method: 'POST', params: {action: 'create'}}, + create: {method: 'POST', params: {action: 'create'}, transformResponse: genericHandler}, remove: {method: 'DELETE'} }); }]) diff --git a/test/unit/app/shared/filters.spec.js b/test/unit/app/shared/filters.spec.js index b9235f38b..b2f701fb4 100644 --- a/test/unit/app/shared/filters.spec.js +++ b/test/unit/app/shared/filters.spec.js @@ -133,203 +133,4 @@ describe('filters', function () { expect(repotagFilter(image)).toBe('ubuntu:latest'); })); }); - - describe('errorMsgFilter', function () { - it('should convert the $resource object to a string message', - inject(function (errorMsgFilter) { - var response = { - '0': 'C', - '1': 'o', - '2': 'n', - '3': 'f', - '4': 'l', - '5': 'i', - '6': 'c', - '7': 't', - '8': ',', - '9': ' ', - '10': 'T', - '11': 'h', - '12': 'e', - '13': ' ', - '14': 'n', - '15': 'a', - '16': 'm', - '17': 'e', - '18': ' ', - '19': 'u', - '20': 'b', - '21': 'u', - '22': 'n', - '23': 't', - '24': 'u', - '25': '-', - '26': 's', - '27': 'l', - '28': 'e', - '29': 'e', - '30': 'p', - '31': '-', - '32': 'r', - '33': 'u', - '34': 'n', - '35': 't', - '36': 'i', - '37': 'm', - '38': 'e', - '39': ' ', - '40': 'i', - '41': 's', - '42': ' ', - '43': 'a', - '44': 'l', - '45': 'r', - '46': 'e', - '47': 'a', - '48': 'd', - '49': 'y', - '50': ' ', - '51': 'a', - '52': 's', - '53': 's', - '54': 'i', - '55': 'g', - '56': 'n', - '57': 'e', - '58': 'd', - '59': ' ', - '60': 't', - '61': 'o', - '62': ' ', - '63': 'b', - '64': '6', - '65': '9', - '66': 'e', - '67': '5', - '68': '3', - '69': 'a', - '70': '6', - '71': '2', - '72': '2', - '73': 'c', - '74': '8', - '75': '.', - '76': ' ', - '77': 'Y', - '78': 'o', - '79': 'u', - '80': ' ', - '81': 'h', - '82': 'a', - '83': 'v', - '84': 'e', - '85': ' ', - '86': 't', - '87': 'o', - '88': ' ', - '89': 'd', - '90': 'e', - '91': 'l', - '92': 'e', - '93': 't', - '94': 'e', - '95': ' ', - '96': '(', - '97': 'o', - '98': 'r', - '99': ' ', - '100': 'r', - '101': 'e', - '102': 'n', - '103': 'a', - '104': 'm', - '105': 'e', - '106': ')', - '107': ' ', - '108': 't', - '109': 'h', - '110': 'a', - '111': 't', - '112': ' ', - '113': 'c', - '114': 'o', - '115': 'n', - '116': 't', - '117': 'a', - '118': 'i', - '119': 'n', - '120': 'e', - '121': 'r', - '122': ' ', - '123': 't', - '124': 'o', - '125': ' ', - '126': 'b', - '127': 'e', - '128': ' ', - '129': 'a', - '130': 'b', - '131': 'l', - '132': 'e', - '133': ' ', - '134': 't', - '135': 'o', - '136': ' ', - '137': 'a', - '138': 's', - '139': 's', - '140': 'i', - '141': 'g', - '142': 'n', - '143': ' ', - '144': 'u', - '145': 'b', - '146': 'u', - '147': 'n', - '148': 't', - '149': 'u', - '150': '-', - '151': 's', - '152': 'l', - '153': 'e', - '154': 'e', - '155': 'p', - '156': '-', - '157': 'r', - '158': 'u', - '159': 'n', - '160': 't', - '161': 'i', - '162': 'm', - '163': 'e', - '164': ' ', - '165': 't', - '166': 'o', - '167': ' ', - '168': 'a', - '169': ' ', - '170': 'c', - '171': 'o', - '172': 'n', - '173': 't', - '174': 'a', - '175': 'i', - '176': 'n', - '177': 'e', - '178': 'r', - '179': ' ', - '180': 'a', - '181': 'g', - '182': 'a', - '183': 'i', - '184': 'n', - '185': '.', - '186': '\n', - '$promise': {}, - '$resolved': true - }; - var message = 'Conflict, The name ubuntu-sleep-runtime is already assigned to b69e53a622c8. You have to delete (or rename) that container to be able to assign ubuntu-sleep-runtime to a container again.\n'; - expect(errorMsgFilter(response)).toBe(message); - })); - }); });