2020-02-13 11:14:30 +00:00
|
|
|
package util
|
2019-02-22 14:59:42 +00:00
|
|
|
|
|
|
|
import (
|
2020-02-13 11:14:30 +00:00
|
|
|
"log"
|
2019-02-22 14:59:42 +00:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestGetValidNetInterfacesForWeb(t *testing.T) {
|
2020-02-13 11:14:30 +00:00
|
|
|
ifaces, err := GetValidNetInterfacesForWeb()
|
2019-02-22 14:59:42 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Cannot get net interfaces: %s", err)
|
|
|
|
}
|
|
|
|
if len(ifaces) == 0 {
|
|
|
|
t.Fatalf("No net interfaces found")
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, iface := range ifaces {
|
|
|
|
if len(iface.Addresses) == 0 {
|
|
|
|
t.Fatalf("No addresses found for %s", iface.Name)
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Printf("%v", iface)
|
|
|
|
}
|
|
|
|
}
|