mirror of
https://github.com/hanzoai/status.git
synced 2026-10-30 18:21:48 +00:00
White-labelable status monitoring service with all Gatus branding removed. Defaults to neutral "Status" text. Branding is driven entirely by the ui section in config YAML. - Pure Go build (CGO_ENABLED=0, modernc.org/sqlite) - Multi-stage Dockerfile (node frontend + go backend + alpine runtime) - K8s kustomize overlays for hanzo and lux deployments - GitHub Actions CI for GHCR image push - Pre-built Vue frontend with zero upstream branding
57 lines
1.2 KiB
Go
57 lines
1.2 KiB
Go
package key
|
|
|
|
import "testing"
|
|
|
|
func TestConvertGroupAndNameToKey(t *testing.T) {
|
|
type Scenario struct {
|
|
GroupName string
|
|
Name string
|
|
ExpectedOutput string
|
|
}
|
|
scenarios := []Scenario{
|
|
{
|
|
GroupName: "Core",
|
|
Name: "Front End",
|
|
ExpectedOutput: "core_front-end",
|
|
},
|
|
{
|
|
GroupName: "Load balancers",
|
|
Name: "us-west-2",
|
|
ExpectedOutput: "load-balancers_us-west-2",
|
|
},
|
|
{
|
|
GroupName: "a/b test",
|
|
Name: "a",
|
|
ExpectedOutput: "a-b-test_a",
|
|
},
|
|
{
|
|
GroupName: "",
|
|
Name: "name",
|
|
ExpectedOutput: "_name",
|
|
},
|
|
{
|
|
GroupName: "API (v1)",
|
|
Name: "endpoint",
|
|
ExpectedOutput: "api-(v1)_endpoint",
|
|
},
|
|
{
|
|
GroupName: "website (admin)",
|
|
Name: "test",
|
|
ExpectedOutput: "website-(admin)_test",
|
|
},
|
|
{
|
|
GroupName: "search",
|
|
Name: "query&filter",
|
|
ExpectedOutput: "search_query-filter",
|
|
},
|
|
}
|
|
for _, scenario := range scenarios {
|
|
t.Run(scenario.ExpectedOutput, func(t *testing.T) {
|
|
output := ConvertGroupAndNameToKey(scenario.GroupName, scenario.Name)
|
|
if output != scenario.ExpectedOutput {
|
|
t.Errorf("expected '%s', got '%s'", scenario.ExpectedOutput, output)
|
|
}
|
|
})
|
|
}
|
|
}
|