mirror of
https://github.com/moby/moby.git
synced 2026-07-24 16:26:51 +00:00
There are a handful of libnetwork tests which need to have multiple concurrent goroutines inside the same test OS context (network namespace), including some platform-agnostic tests. Provide test utilities for spawning goroutines inside an OS context and setting/restoring an existing goroutine's OS context to abstract away platform differences and so that each test does not need to reinvent the wheel. Signed-off-by: Cory Snider <csnider@mirantis.com>
16 lines
251 B
Go
16 lines
251 B
Go
package testutils
|
|
|
|
import "testing"
|
|
|
|
type OSContext struct{}
|
|
|
|
func SetupTestOSContextEx(*testing.T) *OSContext {
|
|
return nil
|
|
}
|
|
|
|
func (*OSContext) Cleanup(t *testing.T) {}
|
|
|
|
func (*OSContext) Set() (func(Logger), error) {
|
|
return func(Logger) {}, nil
|
|
}
|