improve the error message of update pod

This commit is contained in:
Chao Xu
2015-07-31 16:43:39 -07:00
parent 6129d3d4eb
commit 18d32751fd
8 changed files with 16 additions and 66 deletions

View File

@@ -603,7 +603,7 @@ func TestValidateEnv(t *testing.T) {
{
name: "name not a C identifier",
envs: []api.EnvVar{{Name: "a.b.c"}},
expectedError: `[0].name: invalid value 'a.b.c': must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"`,
expectedError: `[0].name: invalid value 'a.b.c', Details: must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"`,
},
{
name: "value and valueFrom specified",
@@ -617,7 +617,7 @@ func TestValidateEnv(t *testing.T) {
},
},
}},
expectedError: "[0].valueFrom: invalid value '': sources cannot be specified when value is not empty",
expectedError: "[0].valueFrom: invalid value '', Details: sources cannot be specified when value is not empty",
},
{
name: "missing FieldPath on ObjectFieldSelector",
@@ -654,7 +654,7 @@ func TestValidateEnv(t *testing.T) {
},
},
}},
expectedError: "[0].valueFrom.fieldRef.fieldPath: invalid value 'metadata.whoops': error converting fieldPath",
expectedError: "[0].valueFrom.fieldRef.fieldPath: invalid value 'metadata.whoops', Details: error converting fieldPath",
},
{
name: "unsupported fieldPath",
@@ -667,7 +667,7 @@ func TestValidateEnv(t *testing.T) {
},
},
}},
expectedError: "[0].valueFrom.fieldRef.fieldPath: unsupported value 'status.phase': supported values: metadata.name, metadata.namespace",
expectedError: "[0].valueFrom.fieldRef.fieldPath: unsupported value 'status.phase', Details: supported values: metadata.name, metadata.namespace",
},
}
for _, tc := range errorCases {