tstest/natlab/vmtest: start migrating old natlab tests to vmtest (#19727)

Instead of having two entry points for running natlab tests, start
converting the connectivity tests to use the vmtest framework.

Grid and pair tests have yet to be moved over.

Updates #13038

Signed-off-by: Claus Lensbøl <claus@tailscale.com>
This commit is contained in:
Claus Lensbøl
2026-05-13 16:44:53 -04:00
committed by GitHub
parent 3a6261b79b
commit bb47ea2c6b
6 changed files with 298 additions and 328 deletions
+30
View File
@@ -0,0 +1,30 @@
// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause
package vmtest
import (
"fmt"
"time"
)
// AddNodeFunc is used to describe a func passed to [RunConnectivityTest].
type AddNodeFunc func(*Env) *Node
// RunConnectivityTest adds the specified nodes to the network and then
// verifies that a Disco ping from n1 to n2 completes within 30 seconds.
func (env *Env) RunConnectivityTest(name string, pingRoute PingRoute, n1, n2 AddNodeFunc) {
n1(env)
n2(env)
discoPingStep := env.AddStep(
fmt.Sprintf("[%s] Ping a → b Disco (want %s)", name, pingRoute))
env.Start()
discoPingStep.Begin()
if err := env.PingExpect(env.nodes[0], env.nodes[1], pingRoute, 30*time.Second); err != nil {
discoPingStep.End(err)
env.t.Error(err)
}
discoPingStep.End(nil)
}