mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-21 04:18:38 +00:00
cmd/tailscale/cli: add test to catch ipn.Pref additions
This commit is contained in:
parent
6caa02428e
commit
f6e3240dee
@ -9,6 +9,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@ -553,3 +554,26 @@ func TestPrefsFromUpArgs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestPrefFlagMapping(t *testing.T) {
|
||||||
|
prefType := reflect.TypeOf(ipn.Prefs{})
|
||||||
|
for i := 0; i < prefType.NumField(); i++ {
|
||||||
|
prefName := prefType.Field(i).Name
|
||||||
|
if _, ok := flagForPref[prefName]; ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
switch prefName {
|
||||||
|
case "WantRunning", "Persist", "LoggedOut":
|
||||||
|
// All explicitly handled (ignored) by checkForAccidentalSettingReverts.
|
||||||
|
continue
|
||||||
|
case "OSVersion", "DeviceModel":
|
||||||
|
// Only used by Android, which doesn't have a CLI mode anyway, so
|
||||||
|
// fine to not map.
|
||||||
|
continue
|
||||||
|
case "NotepadURLs":
|
||||||
|
// TODO(bradfitz): https://github.com/tailscale/tailscale/issues/1830
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
t.Errorf("unexpected new ipn.Pref field %q is not handled by up.go (see addPrefFlagMapping and checkForAccidentalSettingReverts)", prefName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user