Files
akvorado/orchestrator/http_test.go
Vincent Bernat baac495b9c orchestrator: provide configuration for other components as YAML
JSON does not allow to marshal fields as embedded (like YAML "inline" tag).
2022-06-22 10:50:24 +02:00

36 lines
751 B
Go

package orchestrator
import (
"testing"
"akvorado/common/helpers"
"akvorado/common/http"
"akvorado/common/reporter"
)
func TestConfigurationEndpoint(t *testing.T) {
r := reporter.NewMock(t)
h := http.NewMock(t, r)
c, err := New(r, DefaultConfiguration(), Dependencies{
HTTP: h,
})
if err != nil {
t.Fatalf("New() error:\n%+v", err)
}
c.RegisterConfiguration(InletService, map[string]string{
"hello": "Hello world!",
"bye": "Goodbye world!",
})
helpers.TestHTTPEndpoints(t, h.Address, helpers.HTTPEndpointCases{
{
URL: "/api/v0/orchestrator/configuration/inlet",
ContentType: "application/x-yaml; charset=utf-8",
FirstLines: []string{
`bye: Goodbye world!`,
`hello: Hello world!`,
},
},
})
}