mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-18 02:48:40 +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 @@ type CapabilityVersion int
|
|||||||
// 34: 2022-08-02: client understands CapabilityFileSharingTarget
|
// 34: 2022-08-02: client understands CapabilityFileSharingTarget
|
||||||
// 36: 2022-08-02: added PeersChangedPatch.{Key,DiscoKey,Online,LastSeen,KeyExpiry,Capabilities}
|
// 36: 2022-08-02: added PeersChangedPatch.{Key,DiscoKey,Online,LastSeen,KeyExpiry,Capabilities}
|
||||||
// 37: 2022-08-09: added Debug.{SetForceBackgroundSTUN,SetRandomizeClientPort}; Debug are sticky
|
// 37: 2022-08-09: added Debug.{SetForceBackgroundSTUN,SetRandomizeClientPort}; Debug are sticky
|
||||||
const CurrentCapabilityVersion CapabilityVersion = 36
|
const CurrentCapabilityVersion CapabilityVersion = 37
|
||||||
|
|
||||||
type StableID string
|
type StableID string
|
||||||
|
|
||||||
|
@ -8,13 +8,17 @@ import (
|
|||||||
"encoding"
|
"encoding"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"regexp"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"tailscale.com/tstest"
|
"tailscale.com/tstest"
|
||||||
"tailscale.com/types/key"
|
"tailscale.com/types/key"
|
||||||
|
"tailscale.com/util/must"
|
||||||
"tailscale.com/version"
|
"tailscale.com/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -651,3 +655,20 @@ func TestRegisterRequestNilClone(t *testing.T) {
|
|||||||
t.Errorf("got = %v; want nil", got)
|
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…
x
Reference in New Issue
Block a user