Skip to content

Commit 637dd73

Browse files
committed
style(api): use validation.TenantKind in test tables
Replace bare "Tenant" string literals with the validation.TenantKind constant in all test table entries, struct fields, and TypeMeta. Prevents silent drift if the canonical kind string is ever renamed. Assisted-By: Claude <[email protected]> Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent d188aaf commit 637dd73

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

‎pkg/registry/apps/application/rest_validation_test.go‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ func TestValidateNameFormat(t *testing.T) {
5151

5252
// Tenant kind enforces alphanumeric-only — see
5353
// packages/apps/tenant/templates/_helpers.tpl for the reason.
54-
{"tenant accepts alphanumeric", "Tenant", "foo", false},
55-
{"tenant accepts digits", "Tenant", "foo123", false},
56-
{"tenant rejects single hyphen", "Tenant", "foo-bar", true},
57-
{"tenant rejects leading hyphen", "Tenant", "-foo", true},
58-
{"tenant rejects trailing hyphen", "Tenant", "foo-", true},
59-
{"tenant rejects uppercase", "Tenant", "Foo", true},
60-
{"tenant rejects underscore", "Tenant", "foo_bar", true},
61-
{"tenant rejects empty", "Tenant", "", true},
54+
{"tenant accepts alphanumeric", validation.TenantKind, "foo", false},
55+
{"tenant accepts digits", validation.TenantKind, "foo123", false},
56+
{"tenant rejects single hyphen", validation.TenantKind, "foo-bar", true},
57+
{"tenant rejects leading hyphen", validation.TenantKind, "-foo", true},
58+
{"tenant rejects trailing hyphen", validation.TenantKind, "foo-", true},
59+
{"tenant rejects uppercase", validation.TenantKind, "Foo", true},
60+
{"tenant rejects underscore", validation.TenantKind, "foo_bar", true},
61+
{"tenant rejects empty", validation.TenantKind, "", true},
6262
}
6363

6464
for _, tt := range tests {
@@ -96,7 +96,7 @@ func TestUpdate_ForceAllowCreate_RejectsTenantDashName(t *testing.T) {
9696
resourceCfg := &config.ResourceConfig{
9797
Resources: []config.Resource{
9898
{
99-
Application: config.ApplicationConfig{Kind: "Tenant"},
99+
Application: config.ApplicationConfig{Kind: validation.TenantKind},
100100
},
101101
},
102102
}
@@ -116,9 +116,9 @@ func TestUpdate_ForceAllowCreate_RejectsTenantDashName(t *testing.T) {
116116
gvk: schema.GroupVersionKind{
117117
Group: appsv1alpha1.GroupName,
118118
Version: "v1alpha1",
119-
Kind: "Tenant",
119+
Kind: validation.TenantKind,
120120
},
121-
kindName: "Tenant",
121+
kindName: validation.TenantKind,
122122
releaseConfig: config.ReleaseConfig{
123123
Prefix: "tenant-",
124124
},
@@ -127,7 +127,7 @@ func TestUpdate_ForceAllowCreate_RejectsTenantDashName(t *testing.T) {
127127
newApp := &appsv1alpha1.Application{
128128
TypeMeta: metav1.TypeMeta{
129129
APIVersion: "apps.cozystack.io/v1alpha1",
130-
Kind: "Tenant",
130+
Kind: validation.TenantKind,
131131
},
132132
ObjectMeta: metav1.ObjectMeta{
133133
Name: "foo-bar",

0 commit comments

Comments
 (0)