mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 19:15:34 +00:00
tailcfg: actually bump capver to 37, add test
I documented capver 37 in 4ee64681a
but forgot to bump the actual
constant. I've done this previously too, so add a test to prevent
it from happening again.
Change-Id: I6f7659db1243d30672121a384beb386d9f9f5b98
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
77a92f326d
commit
b33c337baa
@ -72,7 +72,7 @@
|
||||
// 34: 2022-08-02: client understands CapabilityFileSharingTarget
|
||||
// 36: 2022-08-02: added PeersChangedPatch.{Key,DiscoKey,Online,LastSeen,KeyExpiry,Capabilities}
|
||||
// 37: 2022-08-09: added Debug.{SetForceBackgroundSTUN,SetRandomizeClientPort}; Debug are sticky
|
||||
const CurrentCapabilityVersion CapabilityVersion = 36
|
||||
const CurrentCapabilityVersion CapabilityVersion = 37
|
||||
|
||||
type StableID string
|
||||
|
||||
|
@ -8,13 +8,17 @@
|
||||
"encoding"
|
||||
"encoding/json"
|
||||
"net/netip"
|
||||
"os"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"tailscale.com/tstest"
|
||||
"tailscale.com/types/key"
|
||||
"tailscale.com/util/must"
|
||||
"tailscale.com/version"
|
||||
)
|
||||
|
||||
@ -651,3 +655,20 @@ func TestRegisterRequestNilClone(t *testing.T) {
|
||||
t.Errorf("got = %v; want nil", got)
|
||||
}
|
||||
}
|
||||
|
||||
// Tests that CurrentCapabilityVersion is bumped when the comment block above it gets bumped.
|
||||
// We've screwed this up several times.
|
||||
func TestCurrentCapabilityVersion(t *testing.T) {
|
||||
f := must.Get(os.ReadFile("tailcfg.go"))
|
||||
matches := regexp.MustCompile(`(?m)^//\s+(\d+): \d\d\d\d-\d\d-\d\d: `).FindAllStringSubmatch(string(f), -1)
|
||||
max := 0
|
||||
for _, m := range matches {
|
||||
n := must.Get(strconv.Atoi(m[1]))
|
||||
if n > max {
|
||||
max = n
|
||||
}
|
||||
}
|
||||
if CapabilityVersion(max) != CurrentCapabilityVersion {
|
||||
t.Errorf("CurrentCapabilityVersion = %d; want %d", CurrentCapabilityVersion, max)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user