Merge pull request #36732 from oulinbao/refactor_describe_containers

Automatic merge from submit-queue

Refactor describe.go with PrefixWriter

**What this PR does / why we need it**:
 refactor describeContainers function and decrease gocyclo result

**Special notes for your reviewer**:
the new PR for 36032
https://github.com/kubernetes/kubernetes/pull/36032

**Release note**:
```release-note
```NONE
pull/6/head
Kubernetes Submit Queue 2016-12-03 01:28:11 -08:00 committed by GitHub
commit 91d8c41147
2 changed files with 682 additions and 600 deletions

File diff suppressed because it is too large Load Diff

View File

@ -363,7 +363,8 @@ func TestDescribeContainers(t *testing.T) {
ContainerStatuses: []api.ContainerStatus{testCase.status},
},
}
describeContainers("Containers", pod.Spec.Containers, pod.Status.ContainerStatuses, EnvValueRetriever(&pod), out, "")
writer := &PrefixWriter{out}
describeContainers("Containers", pod.Spec.Containers, pod.Status.ContainerStatuses, EnvValueRetriever(&pod), writer, "")
output := out.String()
for _, expected := range testCase.expectedElements {
if !strings.Contains(output, expected) {