Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Arko Dasgupta <[email protected]>
  • Loading branch information
arkodg committed Jan 27, 2024
1 parent d1a49bc commit d008806
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion internal/ir/xds.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ var (
ErrHCHTTPExpectedStatusesInvalid = errors.New("field HTTPHealthChecker.ExpectedStatuses should be specified")
ErrHealthCheckPayloadInvalid = errors.New("one of Text, Binary fields must be set in payload")
ErrHTTPStatusInvalid = errors.New("HTTPStatus should be in [200,600)")

redacted = []byte("[redacted]")
)

// Xds holds the intermediate representation of a Gateway and is
Expand Down Expand Up @@ -162,7 +164,6 @@ func (x Xds) YAMLString() string {

// Printable returns a deep copy of the resource that can be safely logged.
func (x Xds) Printable() *Xds {
redacted := []byte("[redacted]")
out := x.DeepCopy()
for _, listener := range out.HTTP {
// Omit field
Expand Down
16 changes: 15 additions & 1 deletion internal/ir/xds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@ var (
}}},
Routes: []*HTTPRoute{&happyHTTPRoute},
}
redactedHappyHTTPSListener = HTTPListener{
Name: "happy",
Address: "0.0.0.0",
Port: 80,
Hostnames: []string{"example.com"},
TLS: &TLSConfig{
Certificates: []TLSCertificate{{

Name: "happy",
ServerCertificate: []byte{1, 2, 3},
PrivateKey: redacted,
}}},
Routes: []*HTTPRoute{&happyHTTPRoute},
}
invalidAddrHTTPListener = HTTPListener{
Name: "invalid-addr",
Address: "1.0.0",
Expand Down Expand Up @@ -1217,7 +1231,7 @@ func TestPrintable(t *testing.T) {
HTTP: []*HTTPListener{&happyHTTPSListener},
},
want: &Xds{
HTTP: []*HTTPListener{&happyHTTPListener},
HTTP: []*HTTPListener{&redactedHappyHTTPSListener},
},
},
}
Expand Down

0 comments on commit d008806

Please sign in to comment.