mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 11:38:15 +00:00
test/e2e: Use json.NewSerializerWithOptions in place of json/yaml newSerializers.
condidering NewSerializer* funcs are deprecated with NewSerializerWithOptions(), the test functions are adjusted to the same. Signed-off-by: Humble Chirammal <humble.devassy@gmail.com>
This commit is contained in:
parent
15a1f9a39d
commit
ad9e264c3c
@ -1 +1 @@
|
||||
2.44
|
||||
2.45
|
||||
|
@ -48,7 +48,7 @@ var (
|
||||
func main(cmd *cobra.Command, args []string) {
|
||||
scheme := runtime.NewScheme()
|
||||
auditinstall.Install(scheme)
|
||||
serializer := json.NewSerializer(json.DefaultMetaFactory, scheme, scheme, false)
|
||||
serializer := json.NewSerializerWithOptions(json.DefaultMetaFactory, scheme, scheme, json.SerializerOptions{Pretty: false})
|
||||
encoder = audit.Codecs.EncoderForVersion(serializer, auditv1.SchemeGroupVersion)
|
||||
decoder = audit.Codecs.UniversalDecoder(auditv1.SchemeGroupVersion)
|
||||
|
||||
|
@ -92,7 +92,7 @@ request:
|
||||
return
|
||||
}
|
||||
|
||||
yamlSerializer := json.NewYAMLSerializer(json.DefaultMetaFactory, scheme, scheme)
|
||||
yamlSerializer := json.NewSerializerWithOptions(json.DefaultMetaFactory, scheme, scheme, json.SerializerOptions{Yaml: true})
|
||||
if _, _, err := yamlSerializer.Decode(response.Body.Bytes(), nil, &convertReview); err != nil {
|
||||
t.Fatalf("cannot decode data: \n %v\n Error: %v", response.Body, err)
|
||||
}
|
||||
|
@ -216,8 +216,8 @@ func addToScheme(scheme *runtime.Scheme) {
|
||||
}
|
||||
|
||||
var serializers = map[mediaType]runtime.Serializer{
|
||||
{"application", "json"}: json.NewSerializer(json.DefaultMetaFactory, scheme, scheme, false),
|
||||
{"application", "yaml"}: json.NewYAMLSerializer(json.DefaultMetaFactory, scheme, scheme),
|
||||
{"application", "json"}: json.NewSerializerWithOptions(json.DefaultMetaFactory, scheme, scheme, json.SerializerOptions{Pretty: false}),
|
||||
{"application", "yaml"}: json.NewSerializerWithOptions(json.DefaultMetaFactory, scheme, scheme, json.SerializerOptions{Yaml: true}),
|
||||
}
|
||||
|
||||
func getInputSerializer(contentType string) runtime.Serializer {
|
||||
|
Loading…
Reference in New Issue
Block a user