mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 01:40:07 +00:00
Add pretty printing.
This commit is contained in:
parent
3d0231e0f8
commit
fdcf273d50
@ -59,6 +59,7 @@ func (storage *ControllerRegistryStorage) Delete(id string) error {
|
|||||||
func (storage *ControllerRegistryStorage) Extract(body string) (interface{}, error) {
|
func (storage *ControllerRegistryStorage) Extract(body string) (interface{}, error) {
|
||||||
result := ReplicationController{}
|
result := ReplicationController{}
|
||||||
err := json.Unmarshal([]byte(body), &result)
|
err := json.Unmarshal([]byte(body), &result)
|
||||||
|
result.Kind = "cluster#replicationController"
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,9 +124,9 @@ func TestExtractControllerJson(t *testing.T) {
|
|||||||
expectNoError(t, err)
|
expectNoError(t, err)
|
||||||
controllerOut, err := storage.Extract(string(body))
|
controllerOut, err := storage.Extract(string(body))
|
||||||
expectNoError(t, err)
|
expectNoError(t, err)
|
||||||
jsonOut, err := json.Marshal(controllerOut)
|
// Extract adds a Kind
|
||||||
expectNoError(t, err)
|
controller.Kind = "cluster#replicationController"
|
||||||
if string(body) != string(jsonOut) {
|
if !reflect.DeepEqual(controller, controllerOut) {
|
||||||
t.Errorf("Expected %#v, found %#v", controller, controllerOut)
|
t.Errorf("Expected %#v, found %#v", controller, controllerOut)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,7 @@ func (sr *ServiceRegistryStorage) Delete(id string) error {
|
|||||||
func (sr *ServiceRegistryStorage) Extract(body string) (interface{}, error) {
|
func (sr *ServiceRegistryStorage) Extract(body string) (interface{}, error) {
|
||||||
var svc Service
|
var svc Service
|
||||||
err := json.Unmarshal([]byte(body), &svc)
|
err := json.Unmarshal([]byte(body), &svc)
|
||||||
|
svc.Kind = "cluster#service"
|
||||||
return svc, err
|
return svc, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user