MCPcopy Create free account
hub / github.com/cozystack/talm / TestContract_Errors_EndpointRequired

Function TestContract_Errors_EndpointRequired

pkg/engine/contract_errors_test.go:90–112  ·  view source on GitHub ↗

=== required: endpoint === Contract: when values.endpoint is empty (or absent), both charts fail the render with a long required-guard message that explains (a) the field is cluster-wide, (b) why it cannot be auto-derived, (c) which topologies (VIP, external LB, single-node) need what. The message i

(t *testing.T)

Source from the content-addressed store, hash-verified

88// The message is identical between cozystack and generic — pin a
89// substring stable enough to survive minor wording tweaks.
90func TestContract_Errors_EndpointRequired(t *testing.T) {
91 for _, chartPath := range []string{cozystackChartPath, genericChartPath} {
92 t.Run(chartPath, func(t *testing.T) {
93 err := renderExpectingError(t, chartPath, "", helmEngineEmptyLookup, map[string]any{
94 "endpoint": "",
95 "advertisedSubnets": []any{testAdvertisedSubnet},
96 })
97 if err == nil {
98 t.Fatalf("expected required-endpoint error, got nil")
99 }
100 msg := err.Error()
101 if !strings.Contains(msg, "endpoint") {
102 t.Errorf("error must mention 'endpoint', got: %s", msg)
103 }
104 if !strings.Contains(msg, "https://") {
105 t.Errorf("error must show URL example, got: %s", msg)
106 }
107 if !strings.Contains(msg, "talm template") {
108 t.Errorf("error must mention 'talm template' (explains why no auto-derivation), got: %s", msg)
109 }
110 })
111 }
112}
113
114// === fail: advertisedSubnets empty + empty discovery ===
115

Callers

nothing calls this directly

Calls 2

renderExpectingErrorFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected