MCPcopy
hub / github.com/uber-go/zap / TestAtomicLevelMutation

Function TestAtomicLevelMutation

level_test.go:83–99  ·  level_test.go::TestAtomicLevelMutation
(t *testing.T)

Source from the content-addressed store, hash-verified

81}
82
83func TestAtomicLevelMutation(t *testing.T) {
84 lvl := NewAtomicLevel()
85 lvl.SetLevel(WarnLevel)
86 // Trigger races for non-atomic level mutations.
87 proceed := make(chan struct{})
88 wg := &sync.WaitGroup{}
89 runConcurrently(10, 100, wg, func() {
90 <-proceed
91 assert.Equal(t, WarnLevel, lvl.Level())
92 })
93 runConcurrently(10, 100, wg, func() {
94 <-proceed
95 lvl.SetLevel(WarnLevel)
96 })
97 close(proceed)
98 wg.Wait()
99}
100
101func TestAtomicLevelText(t *testing.T) {
102 tests := []struct {

Callers

nothing calls this directly

Calls 4

SetLevelMethod · 0.95
LevelMethod · 0.95
NewAtomicLevelFunction · 0.85
runConcurrentlyFunction · 0.85

Tested by

no test coverage detected