Unverified Commit 6529abe8 authored by Jeff Knurek's avatar Jeff Knurek Committed by Matthew Fisher

TEST: cleanup code

Signed-off-by: 's avatarJeff Knurek <j.knurek@travelaudience.com>
parent b9460838
...@@ -23,7 +23,7 @@ import ( ...@@ -23,7 +23,7 @@ import (
"sync" "sync"
"time" "time"
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/proto/hapi/release"
"k8s.io/helm/pkg/proto/hapi/services" "k8s.io/helm/pkg/proto/hapi/services"
...@@ -127,6 +127,7 @@ func (env *Environment) DeleteTestPods(testManifests []string) { ...@@ -127,6 +127,7 @@ func (env *Environment) DeleteTestPods(testManifests []string) {
} }
} }
// GetLogs collects the logs from the pods created in testManifests
func (env *Environment) GetLogs(testManifests []string) { func (env *Environment) GetLogs(testManifests []string) {
for _, testManifest := range testManifests { for _, testManifest := range testManifests {
infos, err := env.KubeClient.Build(env.Namespace, bytes.NewBufferString(testManifest)) infos, err := env.KubeClient.Build(env.Namespace, bytes.NewBufferString(testManifest))
...@@ -134,6 +135,10 @@ func (env *Environment) GetLogs(testManifests []string) { ...@@ -134,6 +135,10 @@ func (env *Environment) GetLogs(testManifests []string) {
env.streamError(err.Error()) env.streamError(err.Error())
continue continue
} }
if len(infos) < 1 {
env.streamError(fmt.Sprint("Pod manifest is invalid. Unable to obtain the logs"))
continue
}
podName := infos[0].Object.(*v1.Pod).Name podName := infos[0].Object.(*v1.Pod).Name
logs, err := env.KubeClient.GetPodLogs(podName, env.Namespace) logs, err := env.KubeClient.GetPodLogs(podName, env.Namespace)
if err != nil { if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment