返回 DeepSeek-Reasonix
context_isolation_test.go
根目录 / internal / jobs / context_isolation_test.go
1 package jobs
2
3 import (
4 "context"
5 "testing"
6 )
7
8 func TestWithoutManagerShadowsAncestorManager(t *testing.T) {
9 parent := WithManager(context.Background(), &Manager{})
10 child := WithoutManager(parent)
11 if _, ok := FromContext(child); ok {
12 t.Fatal("child context inherited the parent Jobs manager")
13 }
14 if _, ok := FromContext(parent); !ok {
15 t.Fatal("parent Jobs manager was lost")
16 }
17 }
18
18 lines GO