Add flag to execute integration tests
This commit is contained in:
parent
505d462352
commit
23aee0fb68
|
@ -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",
|
||||
)
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Reference in New Issue