Merge pull request #898 from balena-io/897-normalise-compose-ports

fix: Normalize ports from compose file on instantiation
This commit is contained in:
CameronDiver 2019-02-11 10:03:25 +00:00 committed by GitHub
commit 7c81061898
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -140,10 +140,7 @@ export class PortMap {
}
public static fromComposePorts(ports: string[]): PortMap[] {
return _(ports)
.map(p => new PortMap(p))
.sortBy(p => p.ports.internalStart)
.value();
return PortMap.normalisePortMaps(ports.map(p => new PortMap(p)));
}
private parsePortString(portStr: string): void {

View File

@ -252,6 +252,15 @@ describe 'Ports', ->
expect(portMapsTarget).to.deep.equal(portMapsCurrent)
describe 'fromComposePorts', ->
it 'should normalise compose ports', ->
expect(PortMap.fromComposePorts([
'80:80',
'81:81',
'82:82',
])).to.deep.equal([
new PortMap('80-82')
])
describe 'normalisePortMaps', ->