From ad9e264c3cc021a4b4713ea7543d901fd7d52110 Mon Sep 17 00:00:00 2001 From: Humble Chirammal Date: Fri, 19 May 2023 11:18:12 +0530 Subject: [PATCH] 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 --- test/images/agnhost/VERSION | 2 +- test/images/agnhost/audit-proxy/main.go | 2 +- .../crd-conversion-webhook/converter/converter_test.go | 2 +- .../agnhost/crd-conversion-webhook/converter/framework.go | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/images/agnhost/VERSION b/test/images/agnhost/VERSION index f454b8169e3..85750d29d21 100644 --- a/test/images/agnhost/VERSION +++ b/test/images/agnhost/VERSION @@ -1 +1 @@ -2.44 +2.45 diff --git a/test/images/agnhost/audit-proxy/main.go b/test/images/agnhost/audit-proxy/main.go index e6ac074f111..f94ea0a2d24 100644 --- a/test/images/agnhost/audit-proxy/main.go +++ b/test/images/agnhost/audit-proxy/main.go @@ -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) diff --git a/test/images/agnhost/crd-conversion-webhook/converter/converter_test.go b/test/images/agnhost/crd-conversion-webhook/converter/converter_test.go index b7b9ffa6d4f..69a4b7efce6 100644 --- a/test/images/agnhost/crd-conversion-webhook/converter/converter_test.go +++ b/test/images/agnhost/crd-conversion-webhook/converter/converter_test.go @@ -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) } diff --git a/test/images/agnhost/crd-conversion-webhook/converter/framework.go b/test/images/agnhost/crd-conversion-webhook/converter/framework.go index b8c7ea87cd4..9df06c05ca9 100644 --- a/test/images/agnhost/crd-conversion-webhook/converter/framework.go +++ b/test/images/agnhost/crd-conversion-webhook/converter/framework.go @@ -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 {