orchestrator: allow to register several configuration for a given service

Use the first one by default and if the index is not known. Remove
service registration as this is not used yet.
This commit is contained in:
Vincent Bernat
2022-06-29 15:39:19 +02:00
parent 2664377db7
commit f67d2493b0
7 changed files with 83 additions and 23 deletions

View File

@@ -24,6 +24,10 @@ func TestConfigurationEndpoint(t *testing.T) {
"hello": "Hello world!",
"bye": "Goodbye world!",
})
c.RegisterConfiguration(InletService, map[string]string{
"hello": "Hello pal!",
"bye": "Goodbye pal!",
})
helpers.TestHTTPEndpoints(t, h.Address, helpers.HTTPEndpointCases{
{
@@ -33,6 +37,31 @@ func TestConfigurationEndpoint(t *testing.T) {
`bye: Goodbye world!`,
`hello: Hello world!`,
},
}, {
URL: "/api/v0/orchestrator/configuration/inlet/0",
ContentType: "application/x-yaml; charset=utf-8",
FirstLines: []string{
`bye: Goodbye world!`,
`hello: Hello world!`,
},
}, {
URL: "/api/v0/orchestrator/configuration/inlet/1",
ContentType: "application/x-yaml; charset=utf-8",
FirstLines: []string{
`bye: Goodbye pal!`,
`hello: Hello pal!`,
},
}, {
URL: "/api/v0/orchestrator/configuration/inlet/2",
ContentType: "application/x-yaml; charset=utf-8",
FirstLines: []string{
`bye: Goodbye world!`,
`hello: Hello world!`,
},
}, {
URL: "/api/v0/orchestrator/configuration/console/0",
ContentType: "application/json; charset=utf-8",
StatusCode: 404,
},
})
}