Skip to content

Commit 3e612da

Browse files
committed
test: skip networked tests if no connection
1 parent ae57cce commit 3e612da

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

glow_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"bytes"
5+
"strings"
56
"testing"
67
)
78

@@ -16,6 +17,13 @@ func TestGlowSources(t *testing.T) {
1617

1718
for _, v := range tt {
1819
t.Run(v, func(t *testing.T) {
20+
// Start by checking for network issues.
21+
_, nerr := readmeURL(v)
22+
if nerr != nil && strings.Contains(nerr.Error(), "no such host") {
23+
t.Logf("Error during execution (args: %s):\n%v", v, nerr)
24+
t.Skip("Test uses network. Are you connected to the Internet?")
25+
}
26+
1927
buf := &bytes.Buffer{}
2028
err := executeArg(rootCmd, v, buf)
2129
if err != nil {

0 commit comments

Comments
 (0)