Skip to content

Commit 7effff0

Browse files
authored
Add test for proxy to make sure all payloads are visited (#211)
* Before switching from reflect to protoreflect * switched to protoreflect, temporal.api.failure.v1.Failure produces what's expected. * Before removing list * Draft done, need to implement any and failures * Draft done, need to implement any and failures * Add all API libs * Some reason any not working * can't recurse into commands * Everything seems to be working, need to ensure edge cases are being tested individually and then clean up code * Everything except TestEverything should be working, I think * Everything test passes! * Everything test passes! * Clean up code
1 parent 4c00816 commit 7effff0

2 files changed

Lines changed: 367 additions & 4 deletions

File tree

cmd/proxygenerator/interceptor.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ func containsMessage(
503503
}
504504

505505
// checkMessage examines the given message descriptor md and, if it (transitively) contains a
506-
// payload, appends it result slice.
506+
// payload, appends its result slice.
507507
func checkMessage(md protoreflect.MessageDescriptor,
508508
targetMessages []string,
509509
memo map[protoreflect.FullName]bool,
@@ -590,7 +590,7 @@ func protoFullNameToGoPackageAndType(md protoreflect.MessageDescriptor) (pkgPath
590590
return pkgPath, typeName, nil
591591
}
592592

593-
func gatherMatchesToRypeRecords(
593+
func gatherMatchesToTypeRecords(
594594
mds []protoreflect.MessageDescriptor,
595595
targetTypes []types.Type,
596596
directMatchTypes []types.Type,
@@ -657,6 +657,7 @@ func walk(desired []types.Type, directMatchTypes []types.Type, typ types.Type, r
657657
record := TypeRecord{}
658658
(*records)[typeName] = &record
659659

660+
// Look for all functions with this `typ` type
660661
for _, meth := range typeutil.IntuitiveMethodSet(elemType(typ), nil) {
661662
// Ignore non-exported methods
662663
if !meth.Obj().Exported() {
@@ -766,11 +767,11 @@ func generateInterceptor(cfg config) error {
766767
}
767768
allFailureContainingMessages, err := gatherMessagesContainingTargets(protoFiles, failureMessageNames, excludedEntryPoints)
768769

769-
payloadRecords, err := gatherMatchesToRypeRecords(allPayloadContainingMessages, payloadTypes, payloadDirectMatchType)
770+
payloadRecords, err := gatherMatchesToTypeRecords(allPayloadContainingMessages, payloadTypes, payloadDirectMatchType)
770771
if err != nil {
771772
return err
772773
}
773-
failureRecords, err := gatherMatchesToRypeRecords(allFailureContainingMessages, failureTypes, make([]types.Type, 0))
774+
failureRecords, err := gatherMatchesToTypeRecords(allFailureContainingMessages, failureTypes, make([]types.Type, 0))
774775
if err != nil {
775776
return err
776777
}

0 commit comments

Comments
 (0)