diff --git a/reach/test.go b/reach/test.go new file mode 100644 index 0000000..2142a71 --- /dev/null +++ b/reach/test.go @@ -0,0 +1,13 @@ +package reach + +import "flag" + +var runIntegrationTests = flag.Bool( + "integration", false, + "Run the 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", +) diff --git a/reach/test_results_test.go b/reach/test_results_test.go index 5dbcf29..b7b242a 100644 --- a/reach/test_results_test.go +++ b/reach/test_results_test.go @@ -6,8 +6,13 @@ import ( func TestClientTestResults(t *testing.T) { + if !*runIntegrationTests { + t.Skip("To run this test, use: go test -integration") + } + client := NewClient( WithStandardLogger(), + WithEndpoint(*reachHost, 80), ) if err := client.Connect(); err != nil { t.Fatal(err) diff --git a/reach/wifi_networks_test.go b/reach/wifi_networks_test.go index 667e669..0d4e237 100644 --- a/reach/wifi_networks_test.go +++ b/reach/wifi_networks_test.go @@ -8,8 +8,13 @@ import ( func TestClientSavedWiFiNetworks(t *testing.T) { + if !*runIntegrationTests { + t.Skip("To run this test, use: go test -integration") + } + client := NewClient( WithStandardLogger(), + WithEndpoint(*reachHost, 80), ) if err := client.Connect(); err != nil { t.Fatal(err) @@ -26,8 +31,13 @@ func TestClientSavedWiFiNetworks(t *testing.T) { func TestClientCRUDWiFiNetwork(t *testing.T) { + if !*runIntegrationTests { + t.Skip("To run this test, use: go test -integration") + } + client := NewClient( WithStandardLogger(), + WithEndpoint(*reachHost, 80), ) if err := client.Connect(); err != nil { t.Fatal(err)