Remove global Postgres schema registration in favor of explicit schema-aware sink factory wiring, and update weatherfeeder to register the Postgres sink explicitly. Add optional per-source HTTP timeout and response body limit overrides while keeping feedkit defaults. Remove remaining legacy source/config compatibility surfaces, including singular kind support and old source registry/type aliases, and migrate weatherfeeder sources to plural `Kinds()` metadata. Clean up related docs, tests, and sample config to match the new Postgres, HTTP, and NATS configuration model.
49 lines
1.1 KiB
Go
49 lines
1.1 KiB
Go
package config
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestSourceConfigExpectedKinds(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
cfg SourceConfig
|
|
want []string
|
|
}{
|
|
{
|
|
name: "plural kinds normalized",
|
|
cfg: SourceConfig{
|
|
Kinds: []string{" observation ", "forecast"},
|
|
},
|
|
want: []string{"observation", "forecast"},
|
|
},
|
|
{
|
|
name: "empty kinds",
|
|
cfg: SourceConfig{},
|
|
want: nil,
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
got := tt.cfg.ExpectedKinds()
|
|
if !reflect.DeepEqual(got, tt.want) {
|
|
t.Fatalf("ExpectedKinds() = %#v, want %#v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestSourceModeNormalize(t *testing.T) {
|
|
if got := SourceMode(" Poll ").Normalize(); got != SourceModePoll {
|
|
t.Fatalf("Normalize poll = %q, want %q", got, SourceModePoll)
|
|
}
|
|
if got := SourceMode("STREAM").Normalize(); got != SourceModeStream {
|
|
t.Fatalf("Normalize stream = %q, want %q", got, SourceModeStream)
|
|
}
|
|
if got := SourceMode("").Normalize(); got != SourceModeAuto {
|
|
t.Fatalf("Normalize auto = %q, want %q", got, SourceModeAuto)
|
|
}
|
|
}
|