Validate ConfigMapRef and SecretRef name

This commit is contained in:
Michael Fraenkel
2017-02-24 10:07:20 -08:00
parent ee88325f81
commit 62bd5d3de6
2 changed files with 28 additions and 0 deletions

View File

@@ -2316,6 +2316,16 @@ func TestValidateEnvFrom(t *testing.T) {
},
expectedError: "field[0].configMapRef.name: Required value",
},
{
name: "invalid name",
envs: []api.EnvFromSource{
{
ConfigMapRef: &api.ConfigMapEnvSource{
LocalObjectReference: api.LocalObjectReference{Name: "$"}},
},
},
expectedError: "field[0].configMapRef.name: Invalid value",
},
{
name: "invalid prefix",
envs: []api.EnvFromSource{
@@ -2337,6 +2347,16 @@ func TestValidateEnvFrom(t *testing.T) {
},
expectedError: "field[0].secretRef.name: Required value",
},
{
name: "invalid name",
envs: []api.EnvFromSource{
{
SecretRef: &api.SecretEnvSource{
LocalObjectReference: api.LocalObjectReference{Name: "&"}},
},
},
expectedError: "field[0].secretRef.name: Invalid value",
},
{
name: "invalid prefix",
envs: []api.EnvFromSource{