File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ package labels
19
19
20
20
import (
21
21
"encoding/base64"
22
+ "fmt"
22
23
"hash/fnv"
23
24
24
25
"k8s.io/apimachinery/pkg/util/validation"
@@ -41,7 +42,7 @@ func MustFormatValue(str string) string {
41
42
// If this changes in a future go version this function will panic.
42
43
panic (err )
43
44
}
44
- return base64 .URLEncoding .WithPadding (base64 .NoPadding ).EncodeToString (hasher .Sum (nil ))
45
+ return fmt . Sprintf ( "hash_%s_z" , base64 .URLEncoding .WithPadding (base64 .NoPadding ).EncodeToString (hasher .Sum (nil ) ))
45
46
}
46
47
47
48
// MustEqualValue returns true if the actualLabelValue equals either the inputLabelValue or the hashed
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ func TestNameLabelValue(t *testing.T) {
37
37
{
38
38
name : "return for a name with more than 63 characters" ,
39
39
machineSetName : "machineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetName" ,
40
- want : "FR_ghQ " ,
40
+ want : "hash_FR_ghQ_z " ,
41
41
},
42
42
}
43
43
for _ , tt := range tests {
@@ -71,13 +71,13 @@ func TestMustMatchLabelValueForName(t *testing.T) {
71
71
{
72
72
name : "don't match labels when MachineSet name is long" ,
73
73
machineSetName : "machineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetName" ,
74
- labelValue : "Nx4RdE " ,
74
+ labelValue : "hash_Nx4RdE_z " ,
75
75
want : false ,
76
76
},
77
77
{
78
78
name : "match labels when MachineSet name is long" ,
79
79
machineSetName : "machineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetNamemachineSetName" ,
80
- labelValue : "FR_ghQ " ,
80
+ labelValue : "hash_FR_ghQ_z " ,
81
81
want : true ,
82
82
},
83
83
}
You can’t perform that action at this time.
0 commit comments