Never set pod.Name in kubelet config code

I think it is time to tighten up input requirements.  The validation code will
reject a pod that has an empty name field.
This commit is contained in:
Tim Hockin
2015-01-05 22:49:37 -08:00
parent 22a241aa57
commit 88fe5c6f46
4 changed files with 2 additions and 13 deletions

View File

@@ -121,7 +121,7 @@ func TestReadFromFile(t *testing.T) {
update := got.(kubelet.PodUpdate)
expected := CreatePodUpdate(kubelet.SET, kubelet.FileSource, api.BoundPod{
ObjectMeta: api.ObjectMeta{
Name: simpleSubdomainSafeHash(file.Name()),
Name: "test",
UID: simpleSubdomainSafeHash(file.Name()),
Namespace: "default",
},
@@ -161,8 +161,6 @@ func TestExtractFromValidDataFile(t *testing.T) {
file := writeTestFile(t, os.TempDir(), "test_pod_config", string(text))
defer os.Remove(file.Name())
expectedPod.Name = simpleSubdomainSafeHash(file.Name())
ch := make(chan interface{}, 1)
c := sourceFile{file.Name(), ch}
err = c.extractFromPath()
@@ -228,7 +226,6 @@ func TestExtractFromDir(t *testing.T) {
}
ioutil.WriteFile(name, data, 0755)
files[i] = file
pods[i].Name = simpleSubdomainSafeHash(name)
}
ch := make(chan interface{}, 1)