mirror of
				https://github.com/tailscale/tailscale.git
				synced 2025-11-04 02:01:14 +01:00 
			
		
		
		
	Not buying wifi on a short flight is a good way to find tests that require network. Whoops. Updates #cleanup Change-Id: Ibe678e9c755d27269ad7206413ffe9971f07d298 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
		
			
				
	
	
		
			22 lines
		
	
	
		
			551 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			551 B
		
	
	
	
		
			Go
		
	
	
	
	
	
// Copyright (c) Tailscale Inc & AUTHORS
 | 
						|
// SPDX-License-Identifier: BSD-3-Clause
 | 
						|
 | 
						|
// Package nettest contains additional test helpers related to network state
 | 
						|
// that can't go into tstest for circular dependency reasons.
 | 
						|
package nettest
 | 
						|
 | 
						|
import (
 | 
						|
	"testing"
 | 
						|
 | 
						|
	"tailscale.com/net/netmon"
 | 
						|
)
 | 
						|
 | 
						|
// SkipIfNoNetwork skips the test if it looks like there's no network
 | 
						|
// access.
 | 
						|
func SkipIfNoNetwork(t testing.TB) {
 | 
						|
	nm := netmon.NewStatic()
 | 
						|
	if !nm.InterfaceState().AnyInterfaceUp() {
 | 
						|
		t.Skip("skipping; test requires network but no interface is up")
 | 
						|
	}
 | 
						|
}
 |