Skip to content

Commit 080e0cc

Browse files
test(helm-reval): assert info fields are non-empty in go test
1 parent a0da638 commit 080e0cc

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎src/control-plane-services/helm-reval/cmd/reval/cli/server_internal_test.go‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,16 @@ func TestServeManagementRoutes_Info(t *testing.T) {
125125
assert.Equal(t, http.StatusOK, w.Code)
126126
assert.Equal(t, "application/json", w.Header().Get("Content-Type"))
127127

128-
// x_defs are not injected under `go test`, so fields fall back to defaults.
129-
// Assert the schema is wired, not the build-time service name.
128+
// x_defs are not injected under `go test`; resolve() falls back to "unknown"
129+
// for any empty field, so all three values are guaranteed non-empty.
130130
var info map[string]string
131131
require.NoError(t, json.Unmarshal(w.Body.Bytes(), &info))
132132
assert.Contains(t, info, "service")
133133
assert.Contains(t, info, "version")
134134
assert.Contains(t, info, "commit")
135+
for _, field := range []string{"service", "version", "commit"} {
136+
assert.NotEmpty(t, info[field], field+" must be populated")
137+
}
135138
}
136139

137140
func TestServeManagementRoutes_Info_RejectsNonGET(t *testing.T) {

0 commit comments

Comments
 (0)