Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

748 B
Raw Blame
package config

import (
	"reflect"
	"strings"
	"testing"
)

func TestAIConfig_DoesNotExposeLegacyJSONFields(t *testing.T) {
	typeOfConfig := reflect.TypeOf(AIConfig{})
	forbidden := map[string]struct{}{
		"provider":               {},
		"api_key":                {},
		"base_url":               {},
		"autonomous_mode":        {},
		"patrol_schedule_preset": {},
	}

	for i := 0; i < typeOfConfig.NumField(); i++ {
		field := typeOfConfig.Field(i)
		jsonTag := field.Tag.Get("json")
		if jsonTag == "" || jsonTag == "-" {
			continue
		}
		jsonName := strings.Split(jsonTag, ",")[0]
		if _, blocked := forbidden[jsonName]; blocked {
			t.Fatalf("AIConfig should not include deprecated JSON field %q (Go field: %s)", jsonName, field.Name)
		}
	}
}