Debian Codegraph @

hooks/test/test_test.go

raw symbols SCIP
1 package testscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/
2
3 import (
4 "math/randscip-go gomod github.com/golang/go/src go1.13 `math/rand`/"
5 "syncscip-go gomod github.com/golang/go/src go1.13 sync/"
6 "testingscip-go gomod github.com/golang/go/src go1.13 testing/"
7 "timescip-go gomod github.com/golang/go/src go1.13 time/"
8
9 "github.com/sirupsen/logrusscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/"
10 "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/"
11 )
12
13 func TestAllHooksscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/TestAllHooks().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
14 assert := assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Newscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/New().(t)
15
16 logger, hook := NewNullLoggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/NewNullLogger().()
17 assert.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Assertions#Nil().(hook.LastEntryscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/Hook#LastEntry().())
18 assert.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Assertions#Equal().(0, len(hook.Entriesscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/Hook#Entries.))
19
20 logger.Errorscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Error().("Hello error")
21 assert.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Assertions#Equal().(logrusscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/.ErrorLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ErrorLevel., hook.LastEntryscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/Hook#LastEntry().().Levelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Level.)
22 assert.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Assertions#Equal().("Hello error", hook.LastEntryscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/Hook#LastEntry().().Messagescip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Message.)
23 assert.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Assertions#Equal().(1, len(hook.Entriesscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/Hook#Entries.))
24
25 logger.Warnscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Warn().("Hello warning")
26 assert.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Assertions#Equal().(logrusscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/.WarnLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/WarnLevel., hook.LastEntryscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/Hook#LastEntry().().Levelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Level.)
27 assert.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Assertions#Equal().("Hello warning", hook.LastEntryscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/Hook#LastEntry().().Messagescip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Message.)
28 assert.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Assertions#Equal().(2, len(hook.Entriesscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/Hook#Entries.))
29
30 hook.Resetscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/Hook#Reset().()
31 assert.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Assertions#Nil().(hook.LastEntryscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/Hook#LastEntry().())
32 assert.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Assertions#Equal().(0, len(hook.Entriesscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/Hook#Entries.))
33
34 hook = NewGlobalscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/NewGlobal().()
35
36 logrusscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/.Errorscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Error().("Hello error")
37 assert.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Assertions#Equal().(logrusscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/.ErrorLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ErrorLevel., hook.LastEntryscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/Hook#LastEntry().().Levelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Level.)
38 assert.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Assertions#Equal().("Hello error", hook.LastEntryscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/Hook#LastEntry().().Messagescip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Message.)
39 assert.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Assertions#Equal().(1, len(hook.Entriesscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/Hook#Entries.))
40 }
41
42 func TestLoggingWithHooksRacescip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/TestLoggingWithHooksRace().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
43
44 randscip-go gomod github.com/golang/go/src go1.13 `math/rand`/.Seedscip-go gomod github.com/golang/go/src go1.13 `math/rand`/Seed().(timescip-go gomod github.com/golang/go/src go1.13 time/.Nowscip-go gomod github.com/golang/go/src go1.13 time/Now().().Unixscip-go gomod github.com/golang/go/src go1.13 time/Time#Unix().())
45 unlocker := randscip-go gomod github.com/golang/go/src go1.13 `math/rand`/.Intscip-go gomod github.com/golang/go/src go1.13 `math/rand`/Int().() % 100
46
47 assert := assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Newscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/New().(t)
48 logger, hook := NewNullLoggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/NewNullLogger().()
49
50 var wgOne, wgAll syncscip-go gomod github.com/golang/go/src go1.13 sync/.WaitGroupscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#
51 wgOne.Addscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Add().(1)
52 wgAll.Addscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Add().(100)
53
54 for i := 0; i < 100; i++ {
55 go func(i int) {
56 logger.Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Info().("info")
57 wgAll.Donescip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Done().()
58 if i == unlocker {
59 wgOne.Donescip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Done().()
60 }
61 }(i)
62 }
63
64 wgOne.Waitscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Wait().()
65
66 assert.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Assertions#Equal().(logrusscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/.InfoLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/InfoLevel., hook.LastEntryscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/Hook#LastEntry().().Levelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Level.)
67 assert.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Assertions#Equal().("info", hook.LastEntryscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/Hook#LastEntry().().Messagescip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Message.)
68
69 wgAll.Waitscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Wait().()
70
71 entries := hook.AllEntriesscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/Hook#AllEntries().()
72 assert.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Assertions#Equal().(100, len(entries))
73 }
74
75 func TestFatalWithAlternateExitscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/TestFatalWithAlternateExit().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
76 assert := assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Newscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/New().(t)
77
78 logger, hook := NewNullLoggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/NewNullLogger().()
79 logger.ExitFuncscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#ExitFunc. = func(code int) {}
80
81 logger.Fatalscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Fatal().("something went very wrong")
82 assert.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Assertions#Equal().(logrusscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/.FatalLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/FatalLevel., hook.LastEntryscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/Hook#LastEntry().().Levelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Level.)
83 assert.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Assertions#Equal().("something went very wrong", hook.LastEntryscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/Hook#LastEntry().().Messagescip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Message.)
84 assert.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Assertions#Equal().(1, len(hook.Entriesscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/Hook#Entries.))
85 }
86
87 func TestNewLocalscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/TestNewLocal().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
88 assert := assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Newscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/New().(t)
89 logger := logrusscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/.Newscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/New().()
90
91 var wg syncscip-go gomod github.com/golang/go/src go1.13 sync/.WaitGroupscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#
92 defer wg.Waitscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Wait().()
93
94 wg.Addscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Add().(10)
95 for i := 0; i < 10; i++ {
96 go func(i int) {
97 logger.Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Info().("info")
98 wg.Donescip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Done().()
99 }(i)
100 }
101
102 hook := NewLocalscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/hooks/test`/NewLocal().(logger)
103 assert.NotNilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Assertions#NotNil().(hook)
104 }