This repository has been archived on 2024-08-02. You can view files and clone it, but cannot push or open issues or pull requests.
orion/emlid/discovery_test.go

34 lines
585 B
Go
Raw Permalink Normal View History

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)
}
}