This repository has been archived by the owner on Feb 14, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This fixes #150. As the `Stack` struct does not support being serialized to protobuf, we must not advertise that we support protobuf. Signed-off-by: Christopher Crone <christopher.crone@docker.com>
- Loading branch information
1 parent
bbd07b4
commit 3a35484
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,25 @@ | ||
package apiserver | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/serializer" | ||
) | ||
|
||
func supportsProtobufCodec(c serializer.CodecFactory) bool { | ||
for _, v := range c.SupportedMediaTypes() { | ||
if v.MediaType == runtime.ContentTypeProtobuf { | ||
return true | ||
} | ||
} | ||
return false | ||
} | ||
|
||
func TestRemoveProtobuf(t *testing.T) { | ||
codecs := serializer.NewCodecFactory(Scheme) | ||
assert.True(t, supportsProtobufCodec(codecs)) | ||
removeProtobufMediaType(&codecs) | ||
assert.False(t, supportsProtobufCodec(codecs)) | ||
} |