Skip to content

Commit

Permalink
rollback labels and valid field and add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
wjiec committed Oct 19, 2023
1 parent 724cb20 commit c8dcbde
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions internal/render/sc.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ func (StorageClass) Header(ns string) Header {
HeaderColumn{Name: "RECLAIMPOLICY"},
HeaderColumn{Name: "VOLUMEBINDINGMODE"},
HeaderColumn{Name: "ALLOWVOLUMEEXPANSION"},
HeaderColumn{Name: "LABELS", Wide: true},
HeaderColumn{Name: "VALID", Wide: true},
HeaderColumn{Name: "AGE", Time: true},
}
}
Expand All @@ -48,6 +50,8 @@ func (s StorageClass) Render(o interface{}, ns string, r *Row) error {
strPtrToStr((*string)(sc.ReclaimPolicy)),
strPtrToStr((*string)(sc.VolumeBindingMode)),
boolPtrToStr(sc.AllowVolumeExpansion),
mapToStr(sc.Labels),
"",
toAge(sc.GetCreationTimestamp()),
}

Expand Down
2 changes: 1 addition & 1 deletion internal/render/sc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ func TestStorageClassRender(t *testing.T) {

assert.NoError(t, c.Render(load(t, "sc"), "", &r))
assert.Equal(t, "-/standard", r.ID)
assert.Equal(t, render.Fields{"standard (default)", "kubernetes.io/gce-pd"}, r.Fields[:2])
assert.Equal(t, render.Fields{"standard (default)", "kubernetes.io/gce-pd", "Delete", "Immediate", "true"}, r.Fields[:5])
}
3 changes: 2 additions & 1 deletion internal/render/testdata/sc.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
},
"provisioner": "kubernetes.io/gce-pd",
"reclaimPolicy": "Delete",
"volumeBindingMode": "Immediate"
"volumeBindingMode": "Immediate",
"allowVolumeExpansion": true
}

0 comments on commit c8dcbde

Please sign in to comment.