diff --git a/integration/network/bridge_test.go b/integration/network/bridge/bridge_linux_test.go similarity index 91% rename from integration/network/bridge_test.go rename to integration/network/bridge/bridge_linux_test.go index d3849349f5..7b455f8d01 100644 --- a/integration/network/bridge_test.go +++ b/integration/network/bridge/bridge_linux_test.go @@ -1,4 +1,4 @@ -package network +package bridge import ( "context" @@ -19,7 +19,6 @@ import ( ) func TestCreateWithMultiNetworks(t *testing.T) { - skip.If(t, testEnv.DaemonInfo.OSType == "windows") skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.44"), "requires API v1.44") ctx := setupTest(t) @@ -49,9 +48,6 @@ func TestCreateWithMultiNetworks(t *testing.T) { } func TestCreateWithIPv6DefaultsToULAPrefix(t *testing.T) { - // On Windows, network creation fails with this error message: Error response from daemon: this request is not supported by the 'windows' ipam driver - skip.If(t, testEnv.DaemonInfo.OSType == "windows") - ctx := setupTest(t) apiClient := testEnv.APIClient() @@ -73,7 +69,6 @@ func TestCreateWithIPv6DefaultsToULAPrefix(t *testing.T) { } func TestCreateWithIPv6WithoutEnableIPv6Flag(t *testing.T) { - skip.If(t, testEnv.DaemonInfo.OSType == "windows") // d.Start fails on Windows with `protocol not available` ctx := setupTest(t) d := daemon.New(t) @@ -103,7 +98,6 @@ func TestCreateWithIPv6WithoutEnableIPv6Flag(t *testing.T) { // Check that it's possible to create IPv6 networks with a 64-bit ip-range, // in 64-bit and bigger subnets, with and without a gateway. func Test64BitIPRange(t *testing.T) { - skip.If(t, testEnv.DaemonInfo.OSType == "windows", "no bridge or IPv6 on Windows") ctx := setupTest(t) c := testEnv.APIClient() @@ -139,7 +133,6 @@ func Test64BitIPRange(t *testing.T) { // Demonstrate a limitation of the IP address allocator, it can't // allocate the last address in range that ends on a 64-bit boundary. func TestIPRangeAt64BitLimit(t *testing.T) { - skip.If(t, testEnv.DaemonInfo.OSType == "windows", "no bridge or IPv6 on Windows") ctx := setupTest(t) c := testEnv.APIClient() diff --git a/integration/network/bridge/main_test.go b/integration/network/bridge/main_test.go new file mode 100644 index 0000000000..373d9afe82 --- /dev/null +++ b/integration/network/bridge/main_test.go @@ -0,0 +1,56 @@ +package bridge // import "github.com/docker/docker/integration/network/bridge" + +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) { + shutdown := testutil.ConfigureTracing() + ctx, span := otel.Tracer("").Start(context.Background(), "integration/network/bridge.TestMain") + baseContext = ctx + + var err error + testEnv, err = environment.New(ctx) + if err != nil { + span.SetStatus(codes.Error, err.Error()) + 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() returned non-zero exit 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 +}