MCPcopy Index your code
hub / github.com/go-git/go-git / TestConcurrentAccess

Method TestConcurrentAccess

plumbing/cache/buffer_test.go:119–145  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

117}
118
119func (s *BufferSuite) TestConcurrentAccess(c *C) {
120 for _, o := range s.c {
121 var wg sync.WaitGroup
122
123 for i := 0; i < 1000; i++ {
124 wg.Add(3)
125 go func(i int) {
126 o.Put(int64(i), []byte{00})
127 wg.Done()
128 }(i)
129
130 go func(i int) {
131 if i%30 == 0 {
132 o.Clear()
133 }
134 wg.Done()
135 }(i)
136
137 go func(i int) {
138 o.Get(int64(i))
139 wg.Done()
140 }(i)
141 }
142
143 wg.Wait()
144 }
145}
146
147func (s *BufferSuite) TestDefaultLRU(c *C) {
148 defaultLRU := s.c["default_lru"].(*BufferLRU)

Callers

nothing calls this directly

Calls 4

PutMethod · 0.65
ClearMethod · 0.65
GetMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected