Skip to content

Commit d1d8cc8

Browse files
committed
fix: public test create used bridge
1 parent 9621dac commit d1d8cc8

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

pkg/netlight/bridge/bridge_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package bridge
22

33
import (
44
"testing"
5+
"time"
56

67
"github.com/stretchr/testify/assert"
78
"github.com/stretchr/testify/require"
@@ -88,14 +89,19 @@ func TestAttachBridgeWithMac(t *testing.T) {
8889
}()
8990

9091
addrBefore := br.Attrs().HardwareAddr
92+
t.Logf("initial bridge mac: %s", addrBefore)
9193
err = AttachNicWithMac(dummy, br)
9294
require.NoError(t, err)
95+
time.Sleep(100 * time.Millisecond)
9396

9497
l, err := netlink.LinkByName("bro0")
9598
require.NoError(t, err)
9699
br = l.(*netlink.Bridge)
97100
addrAfter := br.Attrs().HardwareAddr
98101

102+
t.Logf("bridge mac After: %s", addrAfter)
103+
t.Logf("dummy mac: %s", dummy.Attrs().HardwareAddr)
104+
99105
assert.NotEqual(t, addrBefore, addrAfter)
100106
assert.Equal(t, dummy.Attrs().HardwareAddr, addrAfter)
101107
}

pkg/netlight/public/public_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/stretchr/testify/require"
88
"github.com/threefoldtech/zos4/pkg"
99
"github.com/threefoldtech/zos4/pkg/gridtypes"
10+
"github.com/threefoldtech/zos4/pkg/netlight/bridge"
1011
"github.com/threefoldtech/zos4/pkg/netlight/namespace"
1112
"github.com/threefoldtech/zos4/pkg/netlight/types"
1213
)
@@ -27,6 +28,12 @@ func TestCreatePublicNS(t *testing.T) {
2728
require.NoError(t, err)
2829
}()
2930

30-
err := setupPublicNS(pkg.StrIdentifier(""), iface)
31+
_, err := bridge.New("br-pub")
32+
require.NoError(t, err)
33+
defer func() {
34+
err = bridge.Delete("br-pub")
35+
require.NoError(t, err)
36+
}()
37+
err = setupPublicNS(pkg.StrIdentifier(""), iface)
3138
require.NoError(t, err)
3239
}

pkg/storage/filesystem/btrfs_ci_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"path"
2424
"strings"
2525
"testing"
26-
"time"
2726

2827
"github.com/stretchr/testify/assert"
2928
"github.com/stretchr/testify/require"
@@ -167,7 +166,6 @@ func basePoolTest(t *testing.T, pool Pool) {
167166
assert.Len(t, volumes, 1)
168167
})
169168

170-
time.Sleep(30 * time.Second)
171169
t.Run("test usage", func(t *testing.T) {
172170
usage, err := pool.Usage()
173171
require.NoError(t, err)

0 commit comments

Comments
 (0)