mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-01 18:58:18 +00:00
Replace negotiation with a new method that can extract info
Alter how runtime.SerializeInfo is represented to simplify negotiation and reduce the need to allocate during negotiation. Simplify the dynamic client's logic around negotiating type. Add more tests for media type handling where necessary.
This commit is contained in:
@@ -71,8 +71,8 @@ func TestDecodeSinglePod(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, gv := range registered.EnabledVersionsForGroup(api.GroupName) {
|
||||
s, _ := api.Codecs.SerializerForFileExtension("yaml")
|
||||
encoder := api.Codecs.EncoderForVersion(s, gv)
|
||||
info, _ := runtime.SerializerInfoForMediaType(api.Codecs.SupportedMediaTypes(), "application/yaml")
|
||||
encoder := api.Codecs.EncoderForVersion(info.Serializer, gv)
|
||||
yaml, err := runtime.Encode(encoder, pod)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
@@ -134,8 +134,8 @@ func TestDecodePodList(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, gv := range registered.EnabledVersionsForGroup(api.GroupName) {
|
||||
s, _ := api.Codecs.SerializerForFileExtension("yaml")
|
||||
encoder := api.Codecs.EncoderForVersion(s, gv)
|
||||
info, _ := runtime.SerializerInfoForMediaType(api.Codecs.SupportedMediaTypes(), "application/yaml")
|
||||
encoder := api.Codecs.EncoderForVersion(info.Serializer, gv)
|
||||
yaml, err := runtime.Encode(encoder, podList)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user