mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-24 14:12:18 +00:00
Make ToUnstructured match stdlib omitempty and anonymous behavior
Kubernetes-commit: 09912f3521932db99fe19f993db240fd43f3240e
This commit is contained in:
parent
17ad09eb27
commit
ebd18c5e7c
@ -32,6 +32,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
@ -338,7 +339,10 @@ func TestGoldenResponse(t *testing.T) {
|
|||||||
|
|
||||||
var got []interface{}
|
var got []interface{}
|
||||||
for e := range w.ResultChan() {
|
for e := range w.ResultChan() {
|
||||||
u, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&e)
|
u, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&metav1.WatchEvent{
|
||||||
|
Type: string(e.Type),
|
||||||
|
Object: runtime.RawExtension{Object: e.Object},
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to convert watch event to unstructured content: %v", err)
|
t.Fatalf("failed to convert watch event to unstructured content: %v", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user