mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
all: gofmt -w -s (simplify) tests
And it updates the build tag style on a couple files. Change-Id: I84478d822c8de3f84b56fa1176c99d2ea5083237 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
59f4f33f60
commit
486059589b
@ -92,14 +92,14 @@ func TestNetworkMapCompare(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Node names identical",
|
"Node names identical",
|
||||||
&netmap.NetworkMap{Peers: []*tailcfg.Node{&tailcfg.Node{Name: "A"}}},
|
&netmap.NetworkMap{Peers: []*tailcfg.Node{{Name: "A"}}},
|
||||||
&netmap.NetworkMap{Peers: []*tailcfg.Node{&tailcfg.Node{Name: "A"}}},
|
&netmap.NetworkMap{Peers: []*tailcfg.Node{{Name: "A"}}},
|
||||||
true,
|
true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Node names differ",
|
"Node names differ",
|
||||||
&netmap.NetworkMap{Peers: []*tailcfg.Node{&tailcfg.Node{Name: "A"}}},
|
&netmap.NetworkMap{Peers: []*tailcfg.Node{{Name: "A"}}},
|
||||||
&netmap.NetworkMap{Peers: []*tailcfg.Node{&tailcfg.Node{Name: "B"}}},
|
&netmap.NetworkMap{Peers: []*tailcfg.Node{{Name: "B"}}},
|
||||||
false,
|
false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -117,8 +117,8 @@ func TestNetworkMapCompare(t *testing.T) {
|
|||||||
{
|
{
|
||||||
"Node Users differ",
|
"Node Users differ",
|
||||||
// User field is not checked.
|
// User field is not checked.
|
||||||
&netmap.NetworkMap{Peers: []*tailcfg.Node{&tailcfg.Node{User: 0}}},
|
&netmap.NetworkMap{Peers: []*tailcfg.Node{{User: 0}}},
|
||||||
&netmap.NetworkMap{Peers: []*tailcfg.Node{&tailcfg.Node{User: 1}}},
|
&netmap.NetworkMap{Peers: []*tailcfg.Node{{User: 1}}},
|
||||||
true,
|
true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,8 @@ func TestParseIni(t *testing.T) {
|
|||||||
[network] # trailing comment
|
[network] # trailing comment
|
||||||
generateResolvConf = false # trailing comment`,
|
generateResolvConf = false # trailing comment`,
|
||||||
want: map[string]map[string]string{
|
want: map[string]map[string]string{
|
||||||
"automount": map[string]string{"enabled": "true", "root": "/mnt/"},
|
"automount": {"enabled": "true", "root": "/mnt/"},
|
||||||
"network": map[string]string{"generateResolvConf": "false"},
|
"network": {"generateResolvConf": "false"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -41,8 +41,8 @@
|
|||||||
|
|
||||||
var dnsCfg = Config{
|
var dnsCfg = Config{
|
||||||
Hosts: map[dnsname.FQDN][]netaddr.IP{
|
Hosts: map[dnsname.FQDN][]netaddr.IP{
|
||||||
"test1.ipn.dev.": []netaddr.IP{testipv4},
|
"test1.ipn.dev.": {testipv4},
|
||||||
"test2.ipn.dev.": []netaddr.IP{testipv6},
|
"test2.ipn.dev.": {testipv6},
|
||||||
},
|
},
|
||||||
LocalDomains: []dnsname.FQDN{"ipn.dev.", "3.2.1.in-addr.arpa.", "1.0.0.0.ip6.arpa."},
|
LocalDomains: []dnsname.FQDN{"ipn.dev.", "3.2.1.in-addr.arpa.", "1.0.0.0.ip6.arpa."},
|
||||||
}
|
}
|
||||||
|
@ -119,13 +119,13 @@ func ensureStateDirPerms(dirPath string) error {
|
|||||||
// We configure the DACL such that any files or directories created within
|
// We configure the DACL such that any files or directories created within
|
||||||
// dirPath will also inherit this DACL.
|
// dirPath will also inherit this DACL.
|
||||||
explicitAccess := []windows.EXPLICIT_ACCESS{
|
explicitAccess := []windows.EXPLICIT_ACCESS{
|
||||||
windows.EXPLICIT_ACCESS{
|
{
|
||||||
windows.GENERIC_ALL,
|
windows.GENERIC_ALL,
|
||||||
windows.SET_ACCESS,
|
windows.SET_ACCESS,
|
||||||
windows.SUB_CONTAINERS_AND_OBJECTS_INHERIT,
|
windows.SUB_CONTAINERS_AND_OBJECTS_INHERIT,
|
||||||
userTrustee,
|
userTrustee,
|
||||||
},
|
},
|
||||||
windows.EXPLICIT_ACCESS{
|
{
|
||||||
windows.GENERIC_ALL,
|
windows.GENERIC_ALL,
|
||||||
windows.SET_ACCESS,
|
windows.SET_ACCESS,
|
||||||
windows.SUB_CONTAINERS_AND_OBJECTS_INHERIT,
|
windows.SUB_CONTAINERS_AND_OBJECTS_INHERIT,
|
||||||
|
@ -15,13 +15,13 @@ type InOut struct {
|
|||||||
expect int
|
expect int
|
||||||
}
|
}
|
||||||
tests := []InOut{
|
tests := []InOut{
|
||||||
InOut{"1.2.3.4:5678", 5678},
|
{"1.2.3.4:5678", 5678},
|
||||||
InOut{"0.0.0.0.999", 999},
|
{"0.0.0.0.999", 999},
|
||||||
InOut{"1.2.3.4:*", 0},
|
{"1.2.3.4:*", 0},
|
||||||
InOut{"5.5.5.5:0", 0},
|
{"5.5.5.5:0", 0},
|
||||||
InOut{"[1::2]:5", 5},
|
{"[1::2]:5", 5},
|
||||||
InOut{"[1::2].5", 5},
|
{"[1::2].5", 5},
|
||||||
InOut{"gibberish", -1},
|
{"gibberish", -1},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, io := range tests {
|
for _, io := range tests {
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
// This file exists just so go mod tidy won't remove
|
// This file exists just so go mod tidy won't remove
|
||||||
// staticcheck's module from our go.mod.
|
// staticcheck's module from our go.mod.
|
||||||
|
|
||||||
|
//go:build tools
|
||||||
// +build tools
|
// +build tools
|
||||||
|
|
||||||
package tstest
|
package tstest
|
||||||
|
@ -173,7 +173,7 @@ func getVal() []interface{} {
|
|||||||
&tailcfg.MapResponse{
|
&tailcfg.MapResponse{
|
||||||
DERPMap: &tailcfg.DERPMap{
|
DERPMap: &tailcfg.DERPMap{
|
||||||
Regions: map[int]*tailcfg.DERPRegion{
|
Regions: map[int]*tailcfg.DERPRegion{
|
||||||
1: &tailcfg.DERPRegion{
|
1: {
|
||||||
RegionID: 1,
|
RegionID: 1,
|
||||||
RegionCode: "foo",
|
RegionCode: "foo",
|
||||||
Nodes: []*tailcfg.DERPNode{
|
Nodes: []*tailcfg.DERPNode{
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build windows
|
||||||
// +build windows
|
// +build windows
|
||||||
|
|
||||||
package wf
|
package wf
|
||||||
|
@ -401,14 +401,14 @@ func TestPickDERPFallback(t *testing.T) {
|
|||||||
c := newConn()
|
c := newConn()
|
||||||
dm := &tailcfg.DERPMap{
|
dm := &tailcfg.DERPMap{
|
||||||
Regions: map[int]*tailcfg.DERPRegion{
|
Regions: map[int]*tailcfg.DERPRegion{
|
||||||
1: &tailcfg.DERPRegion{},
|
1: {},
|
||||||
2: &tailcfg.DERPRegion{},
|
2: {},
|
||||||
3: &tailcfg.DERPRegion{},
|
3: {},
|
||||||
4: &tailcfg.DERPRegion{},
|
4: {},
|
||||||
5: &tailcfg.DERPRegion{},
|
5: {},
|
||||||
6: &tailcfg.DERPRegion{},
|
6: {},
|
||||||
7: &tailcfg.DERPRegion{},
|
7: {},
|
||||||
8: &tailcfg.DERPRegion{},
|
8: {},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
c.derpMap = dm
|
c.derpMap = dm
|
||||||
@ -1011,7 +1011,7 @@ func testTwoDevicePing(t *testing.T, d *devices) {
|
|||||||
PrivateKey: m1.privateKey,
|
PrivateKey: m1.privateKey,
|
||||||
Addresses: []netaddr.IPPrefix{netaddr.MustParseIPPrefix("1.0.0.1/32")},
|
Addresses: []netaddr.IPPrefix{netaddr.MustParseIPPrefix("1.0.0.1/32")},
|
||||||
Peers: []wgcfg.Peer{
|
Peers: []wgcfg.Peer{
|
||||||
wgcfg.Peer{
|
{
|
||||||
PublicKey: m2.privateKey.Public(),
|
PublicKey: m2.privateKey.Public(),
|
||||||
DiscoKey: m2.conn.DiscoPublicKey(),
|
DiscoKey: m2.conn.DiscoPublicKey(),
|
||||||
AllowedIPs: []netaddr.IPPrefix{netaddr.MustParseIPPrefix("1.0.0.2/32")},
|
AllowedIPs: []netaddr.IPPrefix{netaddr.MustParseIPPrefix("1.0.0.2/32")},
|
||||||
@ -1023,7 +1023,7 @@ func testTwoDevicePing(t *testing.T, d *devices) {
|
|||||||
PrivateKey: m2.privateKey,
|
PrivateKey: m2.privateKey,
|
||||||
Addresses: []netaddr.IPPrefix{netaddr.MustParseIPPrefix("1.0.0.2/32")},
|
Addresses: []netaddr.IPPrefix{netaddr.MustParseIPPrefix("1.0.0.2/32")},
|
||||||
Peers: []wgcfg.Peer{
|
Peers: []wgcfg.Peer{
|
||||||
wgcfg.Peer{
|
{
|
||||||
PublicKey: m1.privateKey.Public(),
|
PublicKey: m1.privateKey.Public(),
|
||||||
DiscoKey: m1.conn.DiscoPublicKey(),
|
DiscoKey: m1.conn.DiscoPublicKey(),
|
||||||
AllowedIPs: []netaddr.IPPrefix{netaddr.MustParseIPPrefix("1.0.0.1/32")},
|
AllowedIPs: []netaddr.IPPrefix{netaddr.MustParseIPPrefix("1.0.0.1/32")},
|
||||||
|
@ -99,7 +99,7 @@ func TestUserspaceEngineReconfig(t *testing.T) {
|
|||||||
} {
|
} {
|
||||||
nm := &netmap.NetworkMap{
|
nm := &netmap.NetworkMap{
|
||||||
Peers: []*tailcfg.Node{
|
Peers: []*tailcfg.Node{
|
||||||
&tailcfg.Node{
|
{
|
||||||
Key: nkFromHex(nodeHex),
|
Key: nkFromHex(nodeHex),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build windows
|
||||||
// +build windows
|
// +build windows
|
||||||
|
|
||||||
package winnet
|
package winnet
|
||||||
|
Loading…
Reference in New Issue
Block a user