Add flag to execute integration tests

This commit is contained in:
wpetit 2018-09-19 15:29:44 +02:00
parent 505d462352
commit 23aee0fb68
3 changed files with 28 additions and 0 deletions

13
reach/test.go Normal file
View File

@ -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",
)

View File

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

View File

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