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:

committed by
Brad Fitzpatrick

parent
77a92f326d
commit
b33c337baa
@ -8,13 +8,17 @@ import (
|
||||
"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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user