Allows Secret & ConfigMap Keys to look like Environment Variables
This makes environment variable style keys (uppercase with underscores) valid in Secrets and ConfigMap.
This commit is contained in:
@@ -377,11 +377,14 @@ func TestIsValidPercent(t *testing.T) {
|
||||
|
||||
func TestIsConfigMapKey(t *testing.T) {
|
||||
successCases := []string{
|
||||
"a",
|
||||
"good",
|
||||
"good-good",
|
||||
"still.good",
|
||||
"this.is.also.good",
|
||||
".so.is.this",
|
||||
"THIS_IS_GOOD",
|
||||
"so_is_this_17",
|
||||
}
|
||||
|
||||
for i := range successCases {
|
||||
@@ -391,14 +394,16 @@ func TestIsConfigMapKey(t *testing.T) {
|
||||
}
|
||||
|
||||
failureCases := []string{
|
||||
"bad_bad",
|
||||
".",
|
||||
"..",
|
||||
"..bad",
|
||||
"bad.",
|
||||
"b*d",
|
||||
"bad!&bad",
|
||||
}
|
||||
|
||||
for i := range failureCases {
|
||||
if errs := IsConfigMapKey(failureCases[i]); len(errs) == 0 {
|
||||
t.Errorf("[%d] expected success", i)
|
||||
t.Errorf("[%d] expected failure", i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user