38 lines
752 B
Go
38 lines
752 B
Go
|
package v2
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"flag"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/pkg/errors"
|
||
|
)
|
||
|
|
||
|
var runProtocolV2IntegrationTests = flag.Bool(
|
||
|
"protocol-v2-integration", false,
|
||
|
"Run the 'protocol-v2' integration tests (in addition to the unit tests)",
|
||
|
)
|
||
|
|
||
|
var reachHost = flag.String(
|
||
|
"reach-host", "192.168.42.1",
|
||
|
"The Reach module host to use in integration tests",
|
||
|
)
|
||
|
|
||
|
func TestProtocolV2(t *testing.T) {
|
||
|
if !*runProtocolV2IntegrationTests {
|
||
|
t.Skip("To run this test, go test -v ./reach/client/protocol/v2 -protocol-v2-integration")
|
||
|
}
|
||
|
|
||
|
protocol := &Protocol{}
|
||
|
ctx := context.Background()
|
||
|
|
||
|
ops, err := protocol.Available(ctx, *reachHost)
|
||
|
if err != nil {
|
||
|
t.Fatalf("%+v", errors.WithStack(err))
|
||
|
}
|
||
|
|
||
|
if ops == nil {
|
||
|
t.Error("ops should not be nil")
|
||
|
}
|
||
|
}
|