Fix describe of statefulset prints pointer not value

This commit is contained in:
Philipp Stehle 2019-12-03 14:33:31 +01:00
parent f680c261e6
commit 772dbbc7d7
2 changed files with 3 additions and 3 deletions

View File

@ -3187,7 +3187,7 @@ func describeStatefulSet(ps *appsv1.StatefulSet, selector labels.Selector, event
if ps.Spec.UpdateStrategy.RollingUpdate != nil { if ps.Spec.UpdateStrategy.RollingUpdate != nil {
ru := ps.Spec.UpdateStrategy.RollingUpdate ru := ps.Spec.UpdateStrategy.RollingUpdate
if ru.Partition != nil { if ru.Partition != nil {
w.Write(LEVEL_1, "Partition:\t%d\n", ru.Partition) w.Write(LEVEL_1, "Partition:\t%d\n", *ru.Partition)
} }
} }

View File

@ -3544,7 +3544,7 @@ func TestDescribeNode(t *testing.T) {
} }
func TestDescribeStatefulSet(t *testing.T) { func TestDescribeStatefulSet(t *testing.T) {
var partition int32 = 2 var partition int32 = 2672
var replicas int32 = 1 var replicas int32 = 1
fake := fake.NewSimpleClientset(&appsv1.StatefulSet{ fake := fake.NewSimpleClientset(&appsv1.StatefulSet{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
@ -3575,7 +3575,7 @@ func TestDescribeStatefulSet(t *testing.T) {
t.Errorf("unexpected error: %v", err) t.Errorf("unexpected error: %v", err)
} }
expectedOutputs := []string{ expectedOutputs := []string{
"bar", "foo", "Containers:", "mytest-image:latest", "Update Strategy", "RollingUpdate", "Partition", "bar", "foo", "Containers:", "mytest-image:latest", "Update Strategy", "RollingUpdate", "Partition", "2672",
} }
for _, o := range expectedOutputs { for _, o := range expectedOutputs {
if !strings.Contains(out, o) { if !strings.Contains(out, o) {