mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
This package was originally internal, but was moved out when BuildKit used it for its integration tests. That's no longer the case, so we can make it internal again. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
45 lines
816 B
Go
45 lines
816 B
Go
package daemon
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/moby/moby/v2/internal/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
|
|
|
|
ctx, span := otel.Tracer("").Start(context.Background(), "integration/daemon/TestMain")
|
|
baseContext = ctx
|
|
|
|
testEnv, err = environment.New(ctx)
|
|
if err != nil {
|
|
span.SetStatus(codes.Error, err.Error())
|
|
span.End()
|
|
panic(err)
|
|
}
|
|
err = environment.EnsureFrozenImagesLinux(ctx, testEnv)
|
|
if err != nil {
|
|
span.SetStatus(codes.Error, err.Error())
|
|
span.End()
|
|
panic(err)
|
|
}
|
|
|
|
testEnv.Print()
|
|
|
|
code := m.Run()
|
|
if code != 0 {
|
|
span.SetStatus(codes.Error, "m.Run() exited with non-zero code")
|
|
}
|
|
os.Exit(code)
|
|
}
|