@@ -477,6 +477,9 @@ func TestTruncateK8sName(t *testing.T) {
477477 {"exactly_63" , strings .Repeat ("a" , 63 ), strings .Repeat ("a" , 63 )},
478478 {"over_63" , strings .Repeat ("a" , 70 ), strings .Repeat ("a" , 63 )},
479479 {"trailing_dash_trimmed" , strings .Repeat ("a" , 60 ) + "---" + strings .Repeat ("b" , 5 ), strings .Repeat ("a" , 60 )},
480+ {"trailing_dot_trimmed" , strings .Repeat ("a" , 60 ) + "..." + strings .Repeat ("b" , 5 ), strings .Repeat ("a" , 60 )},
481+ {"trailing_underscore_trimmed" , strings .Repeat ("a" , 60 ) + "___" + strings .Repeat ("b" , 5 ), strings .Repeat ("a" , 60 )},
482+ {"trailing_mixed_trimmed" , strings .Repeat ("a" , 58 ) + "-._.-" + strings .Repeat ("b" , 5 ), strings .Repeat ("a" , 58 )},
480483 }
481484 for _ , tt := range tests {
482485 t .Run (tt .name , func (t * testing.T ) {
@@ -778,3 +781,14 @@ func TestRBACLabels(t *testing.T) {
778781 t .Fatalf ("expected 2 labels, got %d" , len (labels ))
779782 }
780783}
784+
785+ func TestRBACLabels_TruncatesLongProposalName (t * testing.T ) {
786+ longName := strings .Repeat ("a" , 80 )
787+ labels := rbacLabels (longName , "execution-rbac" )
788+ if len (labels [LabelProposal ]) > 63 {
789+ t .Fatalf ("proposal label length %d exceeds 63" , len (labels [LabelProposal ]))
790+ }
791+ if labels [LabelProposal ] != strings .Repeat ("a" , 63 ) {
792+ t .Errorf ("proposal label = %q, want %q" , labels [LabelProposal ], strings .Repeat ("a" , 63 ))
793+ }
794+ }
0 commit comments