mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-03 08:22:00 +01:00
tsnet: add tstest.Shard on the slow tests
So they're not all run N times on the sharded oss builders and are only run one time each. Updates tailscale/corp#28679 Change-Id: Ie21e84b06731fdc8ec3212eceb136c8fc26b0115 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
8ed6bb3198
commit
6e24f50946
@ -12,6 +12,7 @@ import (
|
|||||||
|
|
||||||
"tailscale.com/ipn"
|
"tailscale.com/ipn"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
|
"tailscale.com/tstest"
|
||||||
"tailscale.com/types/ipproto"
|
"tailscale.com/types/ipproto"
|
||||||
"tailscale.com/types/key"
|
"tailscale.com/types/key"
|
||||||
"tailscale.com/types/netmap"
|
"tailscale.com/types/netmap"
|
||||||
@ -47,6 +48,7 @@ func waitFor(t testing.TB, ctx context.Context, s *Server, f func(*netmap.Networ
|
|||||||
// netmaps and turning them into packet filters together. Only the control-plane
|
// netmaps and turning them into packet filters together. Only the control-plane
|
||||||
// side is mocked out.
|
// side is mocked out.
|
||||||
func TestPacketFilterFromNetmap(t *testing.T) {
|
func TestPacketFilterFromNetmap(t *testing.T) {
|
||||||
|
tstest.Shard(t)
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
var key key.NodePublic
|
var key key.NodePublic
|
||||||
|
|||||||
@ -235,6 +235,7 @@ func startServer(t *testing.T, ctx context.Context, controlURL, hostname string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDialBlocks(t *testing.T) {
|
func TestDialBlocks(t *testing.T) {
|
||||||
|
tstest.Shard(t)
|
||||||
tstest.ResourceCheck(t)
|
tstest.ResourceCheck(t)
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@ -282,6 +283,7 @@ func TestDialBlocks(t *testing.T) {
|
|||||||
// - s2 can dial through the subnet router functionality (getting a synthetic RST
|
// - s2 can dial through the subnet router functionality (getting a synthetic RST
|
||||||
// that we verify we generated & saw)
|
// that we verify we generated & saw)
|
||||||
func TestConn(t *testing.T) {
|
func TestConn(t *testing.T) {
|
||||||
|
tstest.Shard(t)
|
||||||
tstest.ResourceCheck(t)
|
tstest.ResourceCheck(t)
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@ -414,6 +416,7 @@ func TestConn(t *testing.T) {
|
|||||||
|
|
||||||
func TestLoopbackLocalAPI(t *testing.T) {
|
func TestLoopbackLocalAPI(t *testing.T) {
|
||||||
flakytest.Mark(t, "https://github.com/tailscale/tailscale/issues/8557")
|
flakytest.Mark(t, "https://github.com/tailscale/tailscale/issues/8557")
|
||||||
|
tstest.Shard(t)
|
||||||
tstest.ResourceCheck(t)
|
tstest.ResourceCheck(t)
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@ -489,6 +492,7 @@ func TestLoopbackLocalAPI(t *testing.T) {
|
|||||||
|
|
||||||
func TestLoopbackSOCKS5(t *testing.T) {
|
func TestLoopbackSOCKS5(t *testing.T) {
|
||||||
flakytest.Mark(t, "https://github.com/tailscale/tailscale/issues/8198")
|
flakytest.Mark(t, "https://github.com/tailscale/tailscale/issues/8198")
|
||||||
|
tstest.Shard(t)
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
@ -539,6 +543,7 @@ func TestLoopbackSOCKS5(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestTailscaleIPs(t *testing.T) {
|
func TestTailscaleIPs(t *testing.T) {
|
||||||
|
tstest.Shard(t)
|
||||||
controlURL, _ := startControl(t)
|
controlURL, _ := startControl(t)
|
||||||
|
|
||||||
tmp := t.TempDir()
|
tmp := t.TempDir()
|
||||||
@ -581,6 +586,7 @@ func TestTailscaleIPs(t *testing.T) {
|
|||||||
// TestListenerCleanup is a regression test to verify that s.Close doesn't
|
// TestListenerCleanup is a regression test to verify that s.Close doesn't
|
||||||
// deadlock if a listener is still open.
|
// deadlock if a listener is still open.
|
||||||
func TestListenerCleanup(t *testing.T) {
|
func TestListenerCleanup(t *testing.T) {
|
||||||
|
tstest.Shard(t)
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
@ -623,6 +629,7 @@ func (wc *closeTrackConn) Close() error {
|
|||||||
// tests https://github.com/tailscale/tailscale/issues/6973 -- that we can start a tsnet server,
|
// tests https://github.com/tailscale/tailscale/issues/6973 -- that we can start a tsnet server,
|
||||||
// stop it, and restart it, even on Windows.
|
// stop it, and restart it, even on Windows.
|
||||||
func TestStartStopStartGetsSameIP(t *testing.T) {
|
func TestStartStopStartGetsSameIP(t *testing.T) {
|
||||||
|
tstest.Shard(t)
|
||||||
controlURL, _ := startControl(t)
|
controlURL, _ := startControl(t)
|
||||||
|
|
||||||
tmp := t.TempDir()
|
tmp := t.TempDir()
|
||||||
@ -672,6 +679,7 @@ func TestStartStopStartGetsSameIP(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFunnel(t *testing.T) {
|
func TestFunnel(t *testing.T) {
|
||||||
|
tstest.Shard(t)
|
||||||
ctx, dialCancel := context.WithTimeout(context.Background(), 30*time.Second)
|
ctx, dialCancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
defer dialCancel()
|
defer dialCancel()
|
||||||
|
|
||||||
@ -733,6 +741,7 @@ func TestFunnel(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestListenerClose(t *testing.T) {
|
func TestListenerClose(t *testing.T) {
|
||||||
|
tstest.Shard(t)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
controlURL, _ := startControl(t)
|
controlURL, _ := startControl(t)
|
||||||
|
|
||||||
@ -812,6 +821,7 @@ func (c *bufferedConn) Read(b []byte) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFallbackTCPHandler(t *testing.T) {
|
func TestFallbackTCPHandler(t *testing.T) {
|
||||||
|
tstest.Shard(t)
|
||||||
tstest.ResourceCheck(t)
|
tstest.ResourceCheck(t)
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@ -854,6 +864,7 @@ func TestFallbackTCPHandler(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCapturePcap(t *testing.T) {
|
func TestCapturePcap(t *testing.T) {
|
||||||
|
tstest.Shard(t)
|
||||||
const timeLimit = 120
|
const timeLimit = 120
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), timeLimit*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), timeLimit*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@ -907,6 +918,7 @@ func TestCapturePcap(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUDPConn(t *testing.T) {
|
func TestUDPConn(t *testing.T) {
|
||||||
|
tstest.Shard(t)
|
||||||
tstest.ResourceCheck(t)
|
tstest.ResourceCheck(t)
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@ -1098,6 +1110,7 @@ func sendData(logf func(format string, args ...any), ctx context.Context, bytesC
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUserMetricsByteCounters(t *testing.T) {
|
func TestUserMetricsByteCounters(t *testing.T) {
|
||||||
|
tstest.Shard(t)
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
@ -1212,6 +1225,7 @@ func TestUserMetricsByteCounters(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUserMetricsRouteGauges(t *testing.T) {
|
func TestUserMetricsRouteGauges(t *testing.T) {
|
||||||
|
tstest.Shard(t)
|
||||||
// Windows does not seem to support or report back routes when running in
|
// Windows does not seem to support or report back routes when running in
|
||||||
// userspace via tsnet. So, we skip this check on Windows.
|
// userspace via tsnet. So, we skip this check on Windows.
|
||||||
// TODO(kradalby): Figure out if this is correct.
|
// TODO(kradalby): Figure out if this is correct.
|
||||||
@ -1368,6 +1382,7 @@ func mustDirect(t *testing.T, logf logger.Logf, lc1, lc2 *local.Client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDeps(t *testing.T) {
|
func TestDeps(t *testing.T) {
|
||||||
|
tstest.Shard(t)
|
||||||
deptest.DepChecker{
|
deptest.DepChecker{
|
||||||
GOOS: "linux",
|
GOOS: "linux",
|
||||||
GOARCH: "amd64",
|
GOARCH: "amd64",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user