Skip to content

Commit

Permalink
fix: public test create used bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
Nabil-Salah committed Dec 4, 2024
1 parent 9621dac commit d1d8cc8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
6 changes: 6 additions & 0 deletions pkg/netlight/bridge/bridge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package bridge

import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -88,14 +89,19 @@ func TestAttachBridgeWithMac(t *testing.T) {
}()

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

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

t.Logf("bridge mac After: %s", addrAfter)
t.Logf("dummy mac: %s", dummy.Attrs().HardwareAddr)

assert.NotEqual(t, addrBefore, addrAfter)
assert.Equal(t, dummy.Attrs().HardwareAddr, addrAfter)
}
9 changes: 8 additions & 1 deletion pkg/netlight/public/public_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/threefoldtech/zos4/pkg"
"github.com/threefoldtech/zos4/pkg/gridtypes"
"github.com/threefoldtech/zos4/pkg/netlight/bridge"
"github.com/threefoldtech/zos4/pkg/netlight/namespace"
"github.com/threefoldtech/zos4/pkg/netlight/types"
)
Expand All @@ -27,6 +28,12 @@ func TestCreatePublicNS(t *testing.T) {
require.NoError(t, err)
}()

err := setupPublicNS(pkg.StrIdentifier(""), iface)
_, err := bridge.New("br-pub")
require.NoError(t, err)
defer func() {
err = bridge.Delete("br-pub")
require.NoError(t, err)
}()
err = setupPublicNS(pkg.StrIdentifier(""), iface)
require.NoError(t, err)
}
2 changes: 0 additions & 2 deletions pkg/storage/filesystem/btrfs_ci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"path"
"strings"
"testing"
"time"

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

time.Sleep(30 * time.Second)
t.Run("test usage", func(t *testing.T) {
usage, err := pool.Usage()
require.NoError(t, err)
Expand Down

0 comments on commit d1d8cc8

Please sign in to comment.