Auto-merge for PR #637 via VersionBot

Remove trailing slashes from working directories of services
This commit is contained in:
resin-io-versionbot[bot] 2018-04-29 10:33:51 +00:00 committed by GitHub
commit 4e5f8cabb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 2 deletions

View File

@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/).
## v7.5.1 - 2018-04-29
* Remove trailing slashes from working directories of services #637 [Cameron Diver]
## v7.5.0 - 2018-04-27
* Add tests for validation code #636 [Cameron Diver]

View File

@ -1,7 +1,7 @@
{
"name": "resin-supervisor",
"description": "This is resin.io's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as Resin's API informs it to.",
"version": "7.5.0",
"version": "7.5.1",
"license": "Apache-2.0",
"repository": {
"type": "git",

View File

@ -62,7 +62,7 @@ getUser = (service, imageInfo) ->
return service.user ? imageInfo?.Config?.User ? ''
getWorkingDir = (service, imageInfo) ->
return service.workingDir ? imageInfo?.Config?.WorkingDir ? ''
return (service.workingDir ? imageInfo?.Config?.WorkingDir ? '').replace(/(^.+)\/$/, '$1')
buildHealthcheckTest = (test) ->
if _.isString(test)

View File

@ -147,3 +147,17 @@ describe 'compose/service.cofee', ->
expect(makeComposeServiceWithLimit('64gb').memLimit).to.equal(68719476736)
expect(makeComposeServiceWithLimit('64Gb').memLimit).to.equal(68719476736)
describe 'getWorkingDir', ->
makeComposeServiceWithWorkdir = (workdir) ->
new Service(
appId: 123456,
serviceId: 123456,
serviceName: 'foobar'
workingDir: workdir
)
it 'should remove a trailing slash', ->
expect(makeComposeServiceWithWorkdir('/usr/src/app/').workingDir).to.equal('/usr/src/app')
expect(makeComposeServiceWithWorkdir('/').workingDir).to.equal('/')
expect(makeComposeServiceWithWorkdir('/usr/src/app').workingDir).to.equal('/usr/src/app')
expect(makeComposeServiceWithWorkdir('').workingDir).to.equal('')