Browse Source
Allow multiple null ports (it means autogenerate) (#381)
davidfowl/aspnet-urls
David Fowler
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
18 additions and
1 deletions
-
src/Microsoft.Tye.Core/ConfigModel/ConfigApplication.cs
-
test/UnitTests/TyeDeserializationValidationTests.cs
|
|
|
@ -106,7 +106,7 @@ namespace Microsoft.Tye.ConfigModel |
|
|
|
throw new TyeYamlException(CoreStrings.FormatMultipleBindingWithSameName("service")); |
|
|
|
} |
|
|
|
|
|
|
|
if (service.Bindings.Count(o => o.Port == binding.Port) > 1) |
|
|
|
if (service.Bindings.Count(o => o.Port != null && o.Port == binding.Port) > 1) |
|
|
|
{ |
|
|
|
throw new TyeYamlException(CoreStrings.FormatMultipleBindingWithSamePort("service")); |
|
|
|
} |
|
|
|
|
|
|
|
@ -171,6 +171,23 @@ services: |
|
|
|
Assert.Contains(CoreStrings.FormatMultipleBindingWithSamePort("service"), exception.Message); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void ServicesMustHaveUniqueNonNullPorts() |
|
|
|
{ |
|
|
|
var input = @"
|
|
|
|
services: |
|
|
|
- name: app |
|
|
|
bindings: |
|
|
|
- protocol: http |
|
|
|
name: a |
|
|
|
- protocol: https |
|
|
|
name: b";
|
|
|
|
|
|
|
|
using var parser = new YamlParser(input); |
|
|
|
var app = parser.ParseConfigApplication(); |
|
|
|
app.Validate(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Theory] |
|
|
|
[InlineData("image", "executable")] |
|
|
|
|