mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.
Remove these imports in preparation of migrating our code to become an
actual go module.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
57 lines
1.1 KiB
Go
57 lines
1.1 KiB
Go
package container
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/docker/docker/testutil"
|
|
"github.com/docker/docker/testutil/environment"
|
|
"go.opentelemetry.io/otel"
|
|
"go.opentelemetry.io/otel/codes"
|
|
)
|
|
|
|
var (
|
|
testEnv *environment.Execution
|
|
baseContext context.Context
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
var err error
|
|
shutdown := testutil.ConfigureTracing()
|
|
|
|
ctx, span := otel.Tracer("").Start(context.Background(), "integration/container/TestMain")
|
|
baseContext = ctx
|
|
|
|
testEnv, err = environment.New(ctx)
|
|
if err != nil {
|
|
span.SetStatus(codes.Error, "environment.New failed")
|
|
span.End()
|
|
shutdown(ctx)
|
|
panic(err)
|
|
}
|
|
err = environment.EnsureFrozenImagesLinux(ctx, testEnv)
|
|
if err != nil {
|
|
span.SetStatus(codes.Error, err.Error())
|
|
span.End()
|
|
shutdown(ctx)
|
|
panic(err)
|
|
}
|
|
|
|
testEnv.Print()
|
|
code := m.Run()
|
|
if code != 0 {
|
|
span.SetStatus(codes.Error, "m.Run() exited with non-zero code")
|
|
}
|
|
span.End()
|
|
shutdown(ctx)
|
|
os.Exit(code)
|
|
}
|
|
|
|
func setupTest(t *testing.T) context.Context {
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
environment.ProtectAll(ctx, t, testEnv)
|
|
t.Cleanup(func() { testEnv.Clean(ctx, t) })
|
|
return ctx
|
|
}
|