MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / TestManagerConcurrentAccess

Function TestManagerConcurrentAccess

internal/loop/manager_test.go:243–264  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

241}
242
243func TestManagerConcurrentAccess(t *testing.T) {
244 tmpDir := t.TempDir()
245 prdPath := createTestPRDWithName(t, tmpDir, "test-prd")
246
247 m := NewManager(10, testProvider)
248 m.Register("test-prd", prdPath)
249
250 // Test concurrent access to manager methods
251 var wg sync.WaitGroup
252 for i := 0; i < 100; i++ {
253 wg.Add(1)
254 go func() {
255 defer wg.Done()
256 _ = m.GetInstance("test-prd")
257 _ = m.GetAllInstances()
258 _ = m.GetRunningPRDs()
259 _ = m.GetRunningCount()
260 _, _, _ = m.GetState("test-prd")
261 }()
262 }
263 wg.Wait()
264}
265
266func TestLoopStateString(t *testing.T) {
267 tests := []struct {

Callers

nothing calls this directly

Calls 8

RegisterMethod · 0.95
GetInstanceMethod · 0.95
GetAllInstancesMethod · 0.95
GetRunningPRDsMethod · 0.95
GetRunningCountMethod · 0.95
GetStateMethod · 0.95
createTestPRDWithNameFunction · 0.85
NewManagerFunction · 0.85

Tested by

no test coverage detected