Fix tests

This commit is contained in:
Alfonso Acosta
2016-10-24 09:41:53 +00:00
parent 529759b603
commit 9881a6b631
3 changed files with 9 additions and 2 deletions
+3
View File
@@ -83,6 +83,9 @@ func TestAPITopologyAddsKubernetes(t *testing.T) {
{ContainerID: "container2"},
},
},
Spec: api.PodSpec{
SecurityContext: &api.PodSecurityContext{},
},
}).GetNode("")
buf := &bytes.Buffer{}
encoder := codec.NewEncoder(buf, &codec.MsgpackHandle{})
+1 -1
View File
@@ -64,7 +64,7 @@ func (p *pod) GetNode(probeID string) report.Node {
report.ControlProbeID: probeID,
}
if p.Pod.Spec.SecurityContext.HostNetwork {
if sc := p.Pod.Spec.SecurityContext; sc != nil && sc.HostNetwork {
latests[IsInHostNetwork] = "true"
}
+5 -1
View File
@@ -46,6 +46,9 @@ var (
},
Spec: api.PodSpec{
NodeName: nodeName,
SecurityContext: &api.PodSecurityContext{
HostNetwork: true,
},
},
}
apiPod2 = api.Pod{
@@ -65,7 +68,8 @@ var (
},
},
Spec: api.PodSpec{
NodeName: nodeName,
NodeName: nodeName,
SecurityContext: &api.PodSecurityContext{},
},
}
apiService1 = api.Service{