30 lines
496 B
Go
30 lines
496 B
Go
package emlid
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestDiscovery(t *testing.T) {
|
|
|
|
if !*runDiscoveryIntegrationTests {
|
|
t.Skip("To run this test, use: go test -discovery-integration")
|
|
}
|
|
|
|
services, err := Discover(3 * time.Second)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if g, e := len(services), 1; g != e {
|
|
t.Fatalf("len(services): got '%d', expected '%d'", g, e)
|
|
}
|
|
|
|
s := services[0]
|
|
|
|
if g, e := s.Name, "reach"; g != e {
|
|
t.Errorf("services[0].Name: got '%s', expected '%s'", g, e)
|
|
}
|
|
|
|
}
|