libnetwork: rename unix-only testfiles

Some tests were implicitly skipped through the `getTestEnv()` utility,
which made it hard to discover they were not ran on Windows.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-08-10 12:50:13 +02:00
parent a9e8110fe3
commit c0562d4eed
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
3 changed files with 4 additions and 8 deletions

View file

@ -1,7 +1,8 @@
//go:build !windows
package libnetwork package libnetwork
import ( import (
"runtime"
"strconv" "strconv"
"testing" "testing"
@ -11,12 +12,9 @@ import (
"github.com/docker/docker/libnetwork/netlabel" "github.com/docker/docker/libnetwork/netlabel"
"github.com/docker/docker/libnetwork/options" "github.com/docker/docker/libnetwork/options"
"github.com/docker/docker/libnetwork/osl" "github.com/docker/docker/libnetwork/osl"
"gotest.tools/v3/skip"
) )
func getTestEnv(t *testing.T, opts ...[]NetworkOption) (*Controller, []*Network) { func getTestEnv(t *testing.T, opts ...[]NetworkOption) (*Controller, []*Network) {
skip.If(t, runtime.GOOS == "windows", "test only works on linux")
const netType = "bridge" const netType = "bridge"
c, err := New( c, err := New(
OptionBoltdbWithRandomDBFile(t), OptionBoltdbWithRandomDBFile(t),

View file

@ -1,18 +1,16 @@
//go:build !windows
package libnetwork package libnetwork
import ( import (
"net" "net"
"runtime"
"testing" "testing"
"github.com/docker/docker/internal/testutils/netnsutils" "github.com/docker/docker/internal/testutils/netnsutils"
"gotest.tools/v3/assert" "gotest.tools/v3/assert"
"gotest.tools/v3/skip"
) )
func TestCleanupServiceDiscovery(t *testing.T) { func TestCleanupServiceDiscovery(t *testing.T) {
skip.If(t, runtime.GOOS == "windows", "test only works on linux")
defer netnsutils.SetupTestOSContext(t)() defer netnsutils.SetupTestOSContext(t)()
c, err := New() c, err := New()
assert.NilError(t, err) assert.NilError(t, err)