github.com/docker/compose-on-kubernetes@v0.5.0/internal/apiserver/apiserver_test.go (about) 1 package apiserver 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 "k8s.io/apimachinery/pkg/runtime" 8 "k8s.io/apimachinery/pkg/runtime/serializer" 9 ) 10 11 func supportsProtobufCodec(c serializer.CodecFactory) bool { 12 for _, v := range c.SupportedMediaTypes() { 13 if v.MediaType == runtime.ContentTypeProtobuf { 14 return true 15 } 16 } 17 return false 18 } 19 20 func TestRemoveProtobuf(t *testing.T) { 21 codecs := serializer.NewCodecFactory(Scheme) 22 assert.True(t, supportsProtobufCodec(codecs)) 23 removeProtobufMediaType(&codecs) 24 assert.False(t, supportsProtobufCodec(codecs)) 25 }