34 lines
585 B
Go
34 lines
585 B
Go
package emlid
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestDiscovery(t *testing.T) {
|
|
|
|
if !*runDiscoveryIntegrationTests {
|
|
t.Skip("To run this test, use: go test -discovery-integration")
|
|
}
|
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
|
defer cancel()
|
|
|
|
services, err := Discover(ctx)
|
|
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)
|
|
}
|
|
|
|
}
|