Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
  • Loading branch information
soulxu committed Jan 23, 2024
1 parent d3b0b67 commit 01a90af
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/v1alpha1/envoypatchpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ type JSONPatchOperation struct {
// From is the location of the source document/field where the operation will be performed
// Refer to https://datatracker.ietf.org/doc/html/rfc6901 for more details.
// +optional
From string `json:"from,omitempty"`
From *string `json:"from,omitempty"`
// Value is the new value of the path location.
Value apiextensionsv1.JSON `json:"value"`
}
Expand Down
2 changes: 1 addition & 1 deletion internal/ir/xds.go
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ type JSONPatchOperation struct {
// From is the location of the source document/field where the operation will be performed
// Refer to https://datatracker.ietf.org/doc/html/rfc6901 for more details.
// +optional
From string `json:"from,omitempty" yaml:"from,omitempty"`
From *string `json:"from,omitempty" yaml:"from,omitempty"`
// Value is the new value of the path location.
Value apiextensionsv1.JSON `json:"value" yaml:"value"`
}
Expand Down
19 changes: 19 additions & 0 deletions internal/xds/translator/testdata/in/xds-ir/jsonpatch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,25 @@ envoyPatchPolicies:
tls_certificate:
certificate_chain:
inline_bytes: Y2VydC1kYXRh
- type: "type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment"
name: "first-route-dest"
operation:
op: add
path: "/endpoints/1"
value:
lbEndpoints:
- endpoint:

Check failure on line 80 in internal/xds/translator/testdata/in/xds-ir/jsonpatch.yaml

View workflow job for this annotation

GitHub Actions / lint

80:11 [indentation] wrong indentation: expected 8 but found 10

Check failure on line 80 in internal/xds/translator/testdata/in/xds-ir/jsonpatch.yaml

View workflow job for this annotation

GitHub Actions / lint

80:11 [indentation] wrong indentation: expected 8 but found 10
address:
socketAddress:
address: 1.2.3.4
portValue: 50000
loadBalancingWeight: 1
- type: "type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment"
name: "first-route-dest"
operation:
op: "move"
from: "/endpoints/0/load_balancing_weight"
path: "/endpoints/1/load_balancing_weight"
http:
- name: "first-listener"
address: "0.0.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
address: 1.2.3.4
portValue: 50000
loadBalancingWeight: 1
loadBalancingWeight: 50
locality:
region: first-route-dest/backend/0
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: 1.2.3.4
portValue: 50000
loadBalancingWeight: 1
loadBalancingWeight: 50

0 comments on commit 01a90af

Please sign in to comment.