Skip to content

Commit

Permalink
Use protomarshal
Browse files Browse the repository at this point in the history
  • Loading branch information
barchw committed Dec 16, 2024
1 parent eb998b5 commit 91e4c5c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions internal/istiooperator/istiooperator_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package istiooperator_test

import (
"encoding/json"
meshv1alpha1 "istio.io/api/mesh/v1alpha1"
"istio.io/istio/operator/pkg/values"
"istio.io/istio/pkg/util/protomarshal"
"os"
"path"
"regexp"
Expand Down Expand Up @@ -82,8 +82,7 @@ var _ = Describe("Merge", func() {

var meshConfigTyped meshv1alpha1.MeshConfig

meshConfigSnakeCase := jsonTagsToSnakeCase(iop.Spec.MeshConfig)
err = json.Unmarshal([]byte(meshConfigSnakeCase), &meshConfigTyped)
err = protomarshal.Unmarshal(iop.Spec.MeshConfig, &meshConfigTyped)
Expect(err).ShouldNot(HaveOccurred())

numTrustedProxies := meshConfigTyped.DefaultConfig.GetGatewayTopology().GetNumTrustedProxies()
Expand Down Expand Up @@ -131,9 +130,8 @@ var _ = Describe("Merge", func() {
iop := readIOP(mergedIstioOperatorPath)

var typedMeshConfig meshv1alpha1.MeshConfig
snakeCaseMeshConfig := jsonTagsToSnakeCase(iop.Spec.MeshConfig)

err = json.Unmarshal([]byte(snakeCaseMeshConfig), &typedMeshConfig)
err = protomarshal.Unmarshal(iop.Spec.MeshConfig, &typedMeshConfig)
Expect(err).ShouldNot(HaveOccurred())

numTrustedProxies := typedMeshConfig.DefaultConfig.GetGatewayTopology().GetNumTrustedProxies()
Expand Down

0 comments on commit 91e4c5c

Please sign in to comment.