38 lines
693 B
Go
38 lines
693 B
Go
package reachview
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
"time"
|
|
|
|
"forge.cadoles.com/Pyxis/orion/emlid"
|
|
"github.com/davecgh/go-spew/spew"
|
|
)
|
|
|
|
func TestReachViewStatusBroadcast(t *testing.T) {
|
|
if !*runReachViewIntegrationTests {
|
|
t.Skip("To run this test, use: go test -reachview-integration")
|
|
}
|
|
|
|
client := NewClient(
|
|
emlid.WithStandardLogger(),
|
|
emlid.WithEndpoint(*reachHost, 80),
|
|
)
|
|
if err := client.Connect(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer client.Close()
|
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
|
defer cancel()
|
|
|
|
broadcastChan, err := client.Broadcast(ctx)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
for b := range broadcastChan {
|
|
spew.Dump(b)
|
|
}
|
|
}
|