history_require.go ×17
Frontier kind: Joint frontier
unlabeled · c_97f2b37b9db2
2 tests · 2271 LOC · 106 files · introduces 1 test · 39 LOC · 1 file
Introduces — evidence that enters the hierarchy at this concept
Code
17 ranges 39 lines · 1 files
Tests
1 test
Contains — complete concept membership
Neighbourhood graph
The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.
Focus concept
Ancestors (broader)
Descendants (narrower)
Introduced files
Introduced tests
Introduced files, introduced tests, and structurally relevant concept specialization
In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.
Graph controls are ready.
Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.
JavaScript is disabled; use the native relationship evidence on this page to explore the same evidence.
Native relationship evidence
Every exact file and test below is linked only from the concept that introduces it.
Introduced tests
Every collected test enters the hierarchy at exactly one concept.
1 test introduced at this concept.
Introduced code
Every collected source range enters the hierarchy at exactly one concept.
1 file ranked by introduced lines: 39 introduced LOC across 17 ranges.
Expand a file to inspect source; the > gutter marks introduced lines.
go.temporal.io/server/common/testing/historyrequire/history_require.go 39 introduced LOC · 17 ranges
Open complete file
344
}
345
347
>
sanitizeVersion := expectedHistoryEvents [ 0 ]. GetVersion () == 0
348
>
349
>
if ! sanitizeEventID && ! sanitizeVersion {
350
return actualHistoryEvents
351
}
352
354
>
for _ , actualHistoryEvent := range actualHistoryEvents {
355
>
sanitizedActualHistoryEvent := proto . Clone ( actualHistoryEvent ).( * historypb . HistoryEvent )
356
>
if sanitizeEventID {
357
sanitizedActualHistoryEvent . EventId = 0
358
}
360
>
sanitizedActualHistoryEvent . Version = 0
361
>
}
362
>
sanitizedActualHistoryEvents = append ( sanitizedActualHistoryEvents , sanitizedActualHistoryEvent )
363
}
365
}
366
377
continue
378
}
380
>
actualEventAttributes := reflect . ValueOf ( actualHistoryEvent . Attributes ). Elem (). Field ( 0 ). Elem ()
381
>
h . equalExpectedMapToActualAttributes ( expectedEventAttributes , actualEventAttributes , actualHistoryEvent . EventId , "" )
382
}
383
}
480
481
//nolint:revive // cognitive complexity 26 (> max enabled 25)
482
>
func ( h HistoryRequire ) equalExpectedMapToActualAttributes ( expectedMap map [ string ] any , actualAttributesV reflect . Value , eventID int64 , attrPrefix string ) {
history_require.go
483
>
if th , ok := h . t .( helper ); ok {
484
>
th . Helper ()
485
>
}
486
488
actualAttributesV = actualAttributesV . Elem ()
489
}
490
492
>
var actualV reflect . Value
493
>
if actualAttributesV . Kind () == reflect . Map {
494
actualV = actualAttributesV . MapIndex ( reflect . ValueOf ( attrName ))
496
>
actualV = actualAttributesV . FieldByName ( attrName )
497
>
} else {
498
if attrPrefix == "" {
499
attrPrefix = "."
502
}
503
505
require . Failf ( h . t , "" , "Expected property %s.%s wasn't found for EventID=%v" , attrPrefix , attrName , eventID )
506
}
507
509
if ! actualV . IsNil () {
510
require . Failf ( h . t , "" , "Value of property %s.%s for EventID=%v expected to be nil" , attrPrefix , attrName , eventID )
513
}
514
516
for i , ei := range es {
517
eim := ei .( map [ string ] any )
521
}
522
524
if actualV . IsNil () {
525
require . Failf ( h . t , "" , "Value of property %s.%s for EventID=%v expected to be struct or map but was nil" , attrPrefix , attrName , eventID )
530
}
531
533
>
// Actual bytes are expressed as strings in expected history.
534
>
if actualValueBytes , ok := actualValue .([] byte ); ok {
535
actualValue = string ( actualValueBytes )
536
}
537
538
>
require . EqualValues ( h . t , expectedValue , actualValue , "Values of %s.%s property are not equal for EventID=%v" , attrPrefix , attrName , eventID )
history_require.go
539
}
540
}
597
break
598
}
600
>
_ , _ = jb . WriteRune ( ' ' )
601
}
602
var eventAttrs map [ string ] any
603
if jb . Len () > 0 {
605
>
if err != nil {
606
require . FailNowf ( h . t , err . Error (), "Failed to unmarshal attributes %q for event on line %d" , jb . String (), lineNum + 1 )
607
}