Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/grafana-agent
Path: blob/main/pkg/flow/componenttest/context.go
4094 views
1
package componenttest
2
3
import (
4
"context"
5
"testing"
6
)
7
8
// TestContext returns a context which cancels itself when t finishes.
9
func TestContext(t *testing.T) context.Context {
10
ctx, cancel := context.WithCancel(context.Background())
11
t.Cleanup(cancel)
12
return ctx
13
}
14
15