testlogger.go ×9

Frontier kind: Code frontier

unlabeled · c_50bcbb520dc1

16 tests · 392 LOC · 15 files · introduces 0 tests · 46 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges46 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
67 ranges392 lines · 15 files · Browse complete extent
All tests (intent)
16 testsBrowse complete intent

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.

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.

Introduced files, introduced tests, and structurally relevant concept specializationfunctional_test_base.go ×3 · 10 introduced LOCfunctional_test_base.go …TestTestLogger_Failure_OnExpectedMatch · 0 introduced LOCTestTestLogger_Failure_O…Error_no_message_only_tags · 0 introduced LOCError_no_message_only_ta…Panic_with_tags, Panic_no_message_only_tags · 0 introduced LOCPanic_with_tags, Panic_n…Error_with_tags · 0 introduced LOCError_with_tagsFatal_with_tags, Fatal_no_message_only_tags · 0 introduced LOCFatal_with_tags, Fatal_n…DPanic_no_message_only_tags · 0 introduced LOCDPanic_no_message_only_t…DPanic_with_tags · 0 introduced LOCDPanic_with_tagstestlogger.go ×1 · 3 introduced LOCtestlogger.go ×1testlogger.go ×1 · 3 introduced LOCtestlogger.go ×1Error_without_tags · 0 introduced LOCError_without_tagstestlogger.go ×1 · 2 introduced LOCtestlogger.go ×1DPanic_without_tags · 0 introduced LOCDPanic_without_tagstestlogger.go ×1 · 3 introduced LOCtestlogger.go ×1testlogger.go ×2 · 8 introduced LOCtestlogger.go ×2testlogger.go ×1 · 5 introduced LOCtestlogger.go ×1testlogger.gen.go ×2 · 3 introduced LOCtestlogger.gen.go ×2testlogger.go ×1 · 3 introduced LOCtestlogger.go ×1testlogger.go ×1 · 3 introduced LOCtestlogger.go ×1testlogger.go ×1 · 7 introduced LOCtestlogger.go ×1testlogger.go ×1 · 4 introduced LOCtestlogger.go ×1testlogger.go ×14 · 61 introduced LOCtestlogger.go ×14zap_logger.go ×4 · 12 introduced LOCzap_logger.go ×4zap_logger.go ×1 · 2 introduced LOCzap_logger.go ×1zap_logger.go ×1 · 7 introduced LOCzap_logger.go ×1zap_logger.go ×1 · 7 introduced LOCzap_logger.go ×1tags.go ×9 · 37 introduced LOCtags.go ×9cluster.pb.go ×2 · 200 introduced LOCcluster.pb.go ×2TestOperatorServiceMetadata, TestWorkflowServiceMetadata · 0 introduced LOCTestOperatorServiceMetad…go.temporal.io/server/api/enums/v1/cluster.pb.go · 233 LOCv1/cluster.pb.gogo.temporal.io/server/api/enums/v1/common.pb.go · 288 LOCv1/common.pb.gogo.temporal.io/server/api/enums/v1/dlq.pb.go · 211 LOCv1/dlq.pb.gogo.temporal.io/server/api/enums/v1/fairness_state.pb.go · 147 LOCv1/fairness_state.pb.gogo.temporal.io/server/api/enums/v1/nexus.pb.go · 182 LOCv1/nexus.pb.gogo.temporal.io/server/api/enums/v1/predicate.pb.go · 194 LOCv1/predicate.pb.gogo.temporal.io/server/api/enums/v1/replication.pb.go · 338 LOCv1/replication.pb.gogo.temporal.io/server/api/enums/v1/task.pb.go · 480 LOCv1/task.pb.gogo.temporal.io/server/api/enums/v1/workflow.pb.go · 299 LOCv1/workflow.pb.gogo.temporal.io/server/api/enums/v1/workflow_task_type.pb.go · 148 LOCv1/workflow_task_type.pb…go.temporal.io/server/common/log/tag/tags.go · 1039 LOCtag/tags.gogo.temporal.io/server/common/log/tag/zap_tag.go · 242 LOCtag/zap_tag.gogo.temporal.io/server/common/log/zap_logger.go · 318 LOClog/zap_logger.gogo.temporal.io/server/common/testing/testlogger/testlogger.gen.go · 29 LOCtestlogger/testlogger.ge…go.temporal.io/server/common/testing/testlogger/testlogger.go · 707 LOCtestlogger/testlogger.gogo.temporal.io/server/tests/testcore/functional_test_base.go · 762 LOCtestcore/functional_test…go.temporal.io/server/tests/testcore/shared_cluster_t.go · 152 LOCtestcore/shared_cluster_…TestOperatorServiceMetadata · introduced test · go.temporal.io/server/common/api/TestOperatorServiceMetadataTestOperatorServiceMetad…TestWorkflowServiceMetadata · introduced test · go.temporal.io/server/common/api/TestWorkflowServiceMetadataTestWorkflowServiceMetad…TestTestLogger_Failure_OnExpectedMatch · introduced test · go.temporal.io/server/common/testing/testlogger/TestTestLogger_Failure_OnExpectedMatchTestTestLogger_Failure_O…TestTestLogger_Failure_StickyOnAnyUnexpected · introduced test · go.temporal.io/server/common/testing/testlogger/TestTestLogger_Failure_StickyOnAnyUnexpectedTestTestLogger_Failure_S…DPanic_no_message_only_tags · introduced test · go.temporal.io/server/common/testing/testlogger/TestTestLogger_Uncaught/DPanic_no_message_only_tagsDPanic_no_message_only_t…DPanic_with_tags · introduced test · go.temporal.io/server/common/testing/testlogger/TestTestLogger_Uncaught/DPanic_with_tagsDPanic_with_tagsDPanic_without_tags · introduced test · go.temporal.io/server/common/testing/testlogger/TestTestLogger_Uncaught/DPanic_without_tagsDPanic_without_tagsError_no_message_only_tags · introduced test · go.temporal.io/server/common/testing/testlogger/TestTestLogger_Uncaught/Error_no_message_only_tagsError_no_message_only_ta…Error_with_tags · introduced test · go.temporal.io/server/common/testing/testlogger/TestTestLogger_Uncaught/Error_with_tagsError_with_tagsError_without_tags · introduced test · go.temporal.io/server/common/testing/testlogger/TestTestLogger_Uncaught/Error_without_tagsError_without_tagsFatal_no_message_only_tags · introduced test · go.temporal.io/server/common/testing/testlogger/TestTestLogger_Uncaught/Fatal_no_message_only_tagsFatal_no_message_only_ta…Fatal_with_tags · introduced test · go.temporal.io/server/common/testing/testlogger/TestTestLogger_Uncaught/Fatal_with_tagsFatal_with_tagsFatal_without_tags · introduced test · go.temporal.io/server/common/testing/testlogger/TestTestLogger_Uncaught/Fatal_without_tagsFatal_without_tagsPanic_no_message_only_tags · introduced test · go.temporal.io/server/common/testing/testlogger/TestTestLogger_Uncaught/Panic_no_message_only_tagsPanic_no_message_only_ta…Panic_with_tags · introduced test · go.temporal.io/server/common/testing/testlogger/TestTestLogger_Uncaught/Panic_with_tagsPanic_with_tagsPanic_without_tags · introduced test · go.temporal.io/server/common/testing/testlogger/TestTestLogger_Uncaught/Panic_without_tagsPanic_without_tagssoft_assert_during_test_fails_it · introduced test · go.temporal.io/server/tests/testcore/TestSharedClusterPoison/soft_assert_during_test_fails_itsoft_assert_during_test_…subsequent_acquirer_on_poisoned_cluster_also_fails · introduced test · go.temporal.io/server/tests/testcore/TestSharedClusterPoison/subsequent_acquirer_on_poisoned_cluster_also_failssubsequent_acquirer_on_p…Focused concept · testlogger.go ×9 · 46 introduced LOCtestlogger.go ×9

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

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.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 46 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/testing/testlogger/testlogger.go 46 introduced LOC · 9 ranges

Open complete file

428 // recordFailure stores the first observed failure (first-failure-wins via CAS).
429 // Tags are copied so the recorded value is independent of the caller's slice.
430 > func (tl *TestLogger) recordFailure(level Level, msg string, tags []tag.Tag) { testlogger.go
431 > if tl.state.failure.Load() != nil {
432 // fast-path: already recorded; avoid the copy and the stack capture.
433 return
434 }
435 > tagsCopy := make([]tag.Tag, len(tags)) testlogger.go
436 > copy(tagsCopy, tags)
437 > f := &Failure{
438 > Level: level,
439 > Msg: msg,
440 > Tags: tagsCopy,
441 > Stack: captureStack(3), // skip captureStack, recordFailure, and the log.Logger method that called it
442 > }
443 > tl.state.failure.CompareAndSwap(nil, f)
444 }
445
588 // failTest fails the test while dumping the stack, allowing us to know where in the code
589 // the failure arose.
590 > func (tl *TestLogger) failTest(level Level, msg string, tags ...tag.Tag) { testlogger.go
591 > tl.state.t.Helper()
592 > tl.recordFailure(level, msg, tags)
593 > // skip captureStack, failTest, and the log.Logger function that called failTest
594 > tl.state.t.Fatalf("%s\n%s", failureMessage(level, msg, tags), captureStack(3))
595 > }
596
597 // captureStack returns a formatted stack trace, skipping the first `skip` frames
598 // (including the captureStack frame itself).
599 > func captureStack(skip int) string { testlogger.go
600 > pcs := make([]uintptr, 128) // 128 is likely larger than we'll ever need.
601 > frameCount := runtime.Callers(skip, pcs)
602 >
603 > // runtime.Callers truncates the recorded stacktrace to fit the provided slice.
604 > // Just keep doubling in size until we have enough space.
605 > for frameCount == len(pcs) {
606 pcs = make([]uintptr, len(pcs)*2)
607 frameCount = runtime.Callers(skip, pcs)
608 }
609
610 > stackFrames := runtime.CallersFrames(pcs[:frameCount]) testlogger.go
611 > var stackTrace strings.Builder
612 > for {
613 > frame, more := stackFrames.Next()
614 > fmt.Fprintf(&stackTrace, "%s:%d %s\n", frame.File, frame.Line, frame.Function)
615 > if !more {
616 > break
617 }
618 }
619 > return stackTrace.String() testlogger.go
620 }
621
659
660 // Format the log.Logger tags and such into a useful message
661 > func failureMessage(level Level, msg string, tags []tag.Tag) string { testlogger.go
662 > var b strings.Builder
663 > b.WriteString("FAIL: ")
664 > b.WriteString(errorMessage(level, msg))
665 > for _, t := range tags {
666 b.WriteString(t.Key())
667 b.WriteString("=")
669 b.WriteString(" ")
670 }
671 > return b.String() testlogger.go
672 }
673
674 > func errorMessage(level Level, msg string) string { testlogger.go
675 > var b strings.Builder
676 > b.WriteString("Unexpected ")
677 > b.WriteString(level.String())
678 > b.WriteString(" log encountered: ")
679 > b.WriteString(msg)
680 > return b.String()
681 > }
682
683 func message(level Level, msg string, tags []tag.Tag) string {