Skip to content

Commit

Permalink
Update tests in package routes
Browse files Browse the repository at this point in the history
Signed-off-by: hwipl <[email protected]>
  • Loading branch information
hwipl committed Dec 15, 2023
1 parent e45f8cd commit 94a2bae
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions internal/routes/watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,28 @@ import (
"testing"

"github.com/vishvananda/netlink"
"golang.org/x/sys/unix"
)

// TestWatchStartEvents tests start of Watch, events.
func TestWatchStartEvents(_ *testing.T) {
// create and start watch
probes := make(chan struct{})
rw := NewWatch(probes)
go rw.start()
<-probes

// new route event
rw.events <- netlink.RouteUpdate{Type: unix.RTM_NEWROUTE}
<-probes

// delete route event
rw.events <- netlink.RouteUpdate{Type: unix.RTM_DELROUTE}
<-probes

close(rw.done)
}

// TestWatchStartStop tests Start and Stop of Watch.
func TestWatchStartStop(t *testing.T) {
probes := make(chan struct{})
Expand Down

0 comments on commit 94a2bae

Please sign in to comment.