Fixed lint issues and missing documentation

This commit is contained in:
bwilliams committed 2026-10-13 12:21:32 +01:00
1 parent 7fd321df97
commit 6e6dec68c0
34 files changed
+346 -156

No files matched your search

+4 -13
View File
@@ -159,7 +159,7 @@ func TestSourceSection(t *testing.T) {
if got := c.Map(); !reflect.DeepEqual(got, want) {
t.Errorf("Map = %v; want %v", got, want)
}
wantFlat := map[string]any{"enabled": true, "interval": time.Minute}
wantFlat := map[string]any{"enabled": true, "interval": "1m0s"}
if got := c.Flatten(); !reflect.DeepEqual(got, wantFlat) {
t.Errorf("Flatten = %v; want %v (no prefix)", got, wantFlat)
}
@@ -169,7 +169,7 @@ func TestSourceSection(t *testing.T) {
if k, err := c.TypeOf("enabled"); err != nil || k != reflect.Bool {
t.Errorf("TypeOf(enabled) = %v, %v; want Bool", k, err)
}
if v, err := c.ValueOf("interval"); err != nil || v != time.Minute {
if v, err := c.ValueOf("interval"); err != nil || v != "1m0s" {
t.Errorf("ValueOf(interval) = %v, %v", v, err)
}
if err := c.SetValue("interval", "5s"); err != nil || c.Interval != 5*time.Second {
@@ -180,19 +180,10 @@ func TestSourceSection(t *testing.T) {
}
}
// sourceSection is the method set shared by every concrete source section.
type sourceSection interface {
Map() map[string]any
Flatten() map[string]any
TypeOf(string) (reflect.Kind, error)
ValueOf(string) (any, error)
SetValue(string, any) error
}
func TestConcreteSourceSections(t *testing.T) {
tests := []struct {
prefix string
section sourceSection
section Section
apiRoot bool
blockShutdown bool
}{
@@ -220,7 +211,7 @@ func TestConcreteSourceSections(t *testing.T) {
wantMap := map[string]any{"enabled": true, "interval": "2m0s"}
wantFlat := map[string]any{
tt.prefix + ".enabled": true,
tt.prefix + ".interval": 2 * time.Minute,
tt.prefix + ".interval": "2m0s",
}
if tt.apiRoot {
if err := s.SetValue("api_root", "http://localhost:8080"); err != nil {