diff --git a/rest/watch/decoder_test.go b/rest/watch/decoder_test.go index 2e02cf75..c014f065 100644 --- a/rest/watch/decoder_test.go +++ b/rest/watch/decoder_test.go @@ -48,16 +48,16 @@ func TestDecoder(t *testing.T) { out, in := io.Pipe() decoder := restclientwatch.NewDecoder(streaming.NewDecoder(out, getDecoder()), getDecoder()) - expect := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}} encoder := json.NewEncoder(in) + eType := eventType go func() { data, err := runtime.Encode(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), expect) if err != nil { t.Fatalf("Unexpected error %v", err) } event := metav1.WatchEvent{ - Type: string(eventType), + Type: string(eType), Object: runtime.RawExtension{Raw: json.RawMessage(data)}, } if err := encoder.Encode(&event); err != nil { @@ -72,7 +72,7 @@ func TestDecoder(t *testing.T) { if err != nil { t.Fatalf("Unexpected error %v", err) } - if e, a := eventType, action; e != a { + if e, a := eType, action; e != a { t.Errorf("Expected %v, got %v", e, a) } if e, a := expect, got; !apiequality.Semantic.DeepDerivative(e, a) {