github.com/rigado/snapd@v2.42.5-go-mod+incompatible/osutil/udev/netlink/conn_test.go (about) 1 package netlink 2 3 import ( 4 "testing" 5 ) 6 7 func TestConnect(t *testing.T) { 8 conn := new(UEventConn) 9 if err := conn.Connect(UdevEvent); err != nil { 10 t.Fatal("unable to subscribe to netlink uevent, err:", err) 11 } 12 defer conn.Close() 13 14 conn2 := new(UEventConn) 15 if err := conn2.Connect(UdevEvent); err == nil { 16 // see issue: https://github.com/pilebones/go-udev/issues/3 by @stolowski 17 t.Fatal("can't subscribing a second time to netlink socket with PID", conn2.Addr.Pid) 18 } 19 defer conn2.Close() 20 }