Commit 81936400 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #42283 from smarterclayton/deployment_describe

Automatic merge from submit-queue Describers with pod templates should have consistent output Added a test to verify it. Fixes #38698
parents 1d974723 b78321c6
......@@ -2036,7 +2036,7 @@ run_rc_tests() {
# Post-condition: frontend replication controller is created
kube::test::get_object_assert rc "{{range.items}}{{$id_field}}:{{end}}" 'frontend:'
# Describe command should print detailed information
kube::test::describe_object_assert rc 'frontend' "Name:" "Image(s):" "Labels:" "Selector:" "Replicas:" "Pods Status:"
kube::test::describe_object_assert rc 'frontend' "Name:" "Pod Template:" "Labels:" "Selector:" "Replicas:" "Pods Status:" "Volumes:" "GET_HOSTS_FROM:"
# Describe command should print events information by default
kube::test::describe_object_events_assert rc 'frontend'
# Describe command should not print events information when show-events=false
......@@ -2044,7 +2044,7 @@ run_rc_tests() {
# Describe command should print events information when show-events=true
kube::test::describe_object_events_assert rc 'frontend' true
# Describe command (resource only) should print detailed information
kube::test::describe_resource_assert rc "Name:" "Name:" "Image(s):" "Labels:" "Selector:" "Replicas:" "Pods Status:"
kube::test::describe_resource_assert rc "Name:" "Name:" "Pod Template:" "Labels:" "Selector:" "Replicas:" "Pods Status:" "Volumes:" "GET_HOSTS_FROM:"
# Describe command should print events information by default
kube::test::describe_resource_events_assert rc
# Describe command should not print events information when show-events=false
......@@ -2444,7 +2444,7 @@ run_rs_tests() {
# Post-condition: frontend replica set is created
kube::test::get_object_assert rs "{{range.items}}{{$id_field}}:{{end}}" 'frontend:'
# Describe command should print detailed information
kube::test::describe_object_assert rs 'frontend' "Name:" "Image(s):" "Labels:" "Selector:" "Replicas:" "Pods Status:"
kube::test::describe_object_assert rs 'frontend' "Name:" "Pod Template:" "Labels:" "Selector:" "Replicas:" "Pods Status:" "Volumes:"
# Describe command should print events information by default
kube::test::describe_object_events_assert rs 'frontend'
# Describe command should not print events information when show-events=false
......@@ -2452,7 +2452,7 @@ run_rs_tests() {
# Describe command should print events information when show-events=true
kube::test::describe_object_events_assert rs 'frontend' true
# Describe command (resource only) should print detailed information
kube::test::describe_resource_assert rs "Name:" "Name:" "Image(s):" "Labels:" "Selector:" "Replicas:" "Pods Status:"
kube::test::describe_resource_assert rs "Name:" "Pod Template:" "Labels:" "Selector:" "Replicas:" "Pods Status:" "Volumes:"
# Describe command should print events information by default
kube::test::describe_resource_events_assert rs
# Describe command should not print events information when show-events=false
......
......@@ -670,7 +670,13 @@ func TestDescribeDeployment(t *testing.T) {
Spec: v1beta1.DeploymentSpec{
Replicas: util.Int32Ptr(1),
Selector: &metav1.LabelSelector{},
Template: v1.PodTemplateSpec{},
Template: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
{Image: "mytest-image:latest"},
},
},
},
},
})
d := DeploymentDescriber{fake, versionedFake}
......@@ -678,7 +684,7 @@ func TestDescribeDeployment(t *testing.T) {
if err != nil {
t.Errorf("unexpected error: %v", err)
}
if !strings.Contains(out, "bar") || !strings.Contains(out, "foo") {
if !strings.Contains(out, "bar") || !strings.Contains(out, "foo") || !strings.Contains(out, "Containers:") || !strings.Contains(out, "mytest-image:latest") {
t.Errorf("unexpected out: %s", out)
}
}
......
......@@ -734,19 +734,15 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
requiredStrings := [][]string{
{"Name:", "redis-master"},
{"Namespace:", ns},
{"Image(s):", redisImage},
{"Selector:", "app=redis,role=master"},
{"Labels:", "app=redis"},
{"role=master"},
{"Annotations:"},
{"Replicas:", "1 current", "1 desired"},
{"Pods Status:", "1 Running", "0 Waiting", "0 Succeeded", "0 Failed"},
// {"Events:"} would ordinarily go in the list
// here, but in some rare circumstances the
// events are delayed, and instead kubectl
// prints "No events." This string will match
// either way.
{"vents"}}
{"Pod Template:"},
{"Image:", redisImage},
{"Events:"}}
checkOutput(output, requiredStrings)
// Service
......
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