Extend marathon port discovery to allow port names as identifier

This commit is contained in:
Fabian Gruber 2020-12-16 12:32:03 +01:00 committed by GitHub
parent 7900d266b1
commit ec0075e0d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 95 additions and 11 deletions

View file

@ -1941,13 +1941,53 @@ func TestGetServer(t *testing.T) {
error: `unable to process ports for /app taskID: strconv.Atoi: parsing "aaa": invalid syntax`,
},
},
{
desc: "with port name",
provider: Provider{},
app: application(
appID("/app"),
portDefinition(80, "fist-port"),
portDefinition(81, "second-port"),
portDefinition(82, "third-port"),
withTasks(localhostTask()),
),
extraConf: configuration{},
defaultServer: dynamic.Server{
Scheme: "http",
Port: "name:third-port",
},
expected: expected{
server: dynamic.Server{
URL: "http://localhost:82",
},
},
},
{
desc: "with port name not found",
provider: Provider{},
app: application(
appID("/app"),
portDefinition(80, "fist-port"),
portDefinition(81, "second-port"),
portDefinition(82, "third-port"),
withTasks(localhostTask()),
),
extraConf: configuration{},
defaultServer: dynamic.Server{
Scheme: "http",
Port: "name:other-name",
},
expected: expected{
error: `unable to process ports for /app taskID: no port with name other-name`,
},
},
{
desc: "with application port and no task port",
provider: Provider{},
app: application(
appID("/app"),
appPorts(80),
portDefinition(80),
portDefinition(80, "http"),
withTasks(localhostTask()),
),
extraConf: configuration{},