mirror of
https://github.com/slackhq/nebula.git
synced 2025-12-15 15:20:44 -08:00
remove old tests
This commit is contained in:
parent
49eeee7f8c
commit
150484cc7a
2 changed files with 1 additions and 60 deletions
2
info.go
2
info.go
|
|
@ -78,7 +78,7 @@ func startInfo(l *logrus.Logger, c *config.C, configTest bool, hm *HostMap) (fun
|
|||
listenAddr := c.GetString("info.listen", "")
|
||||
var startFn func()
|
||||
if configTest {
|
||||
//TODO validate that lisstenAddr is an acceptable value as part of the config test
|
||||
//TODO validate that listenAddr is an acceptable value as part of the config test
|
||||
return startFn, nil
|
||||
}
|
||||
if err := os.RemoveAll(listenAddr); err != nil {
|
||||
|
|
|
|||
59
info_test.go
59
info_test.go
|
|
@ -1,59 +0,0 @@
|
|||
package nebula
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"net/netip"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestInfo_shouldAllowBinding(t *testing.T) {
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
addr netip.Addr
|
||||
shouldPass bool
|
||||
}{
|
||||
{
|
||||
name: "Allow binding to local IPv4",
|
||||
addr: netip.MustParseAddr("127.0.0.1"),
|
||||
shouldPass: true,
|
||||
},
|
||||
{
|
||||
name: "Allow binding to local IPv6",
|
||||
addr: netip.MustParseAddr("::1"),
|
||||
shouldPass: true,
|
||||
},
|
||||
{
|
||||
name: "Error binding to private IPv4",
|
||||
addr: netip.MustParseAddr("192.168.1.1"),
|
||||
shouldPass: false,
|
||||
},
|
||||
{
|
||||
name: "Error binding to private IPv6",
|
||||
addr: netip.MustParseAddr("fd00::1"),
|
||||
shouldPass: false,
|
||||
},
|
||||
{
|
||||
name: "Error binding to public IPv4",
|
||||
addr: netip.MustParseAddr("1.1.1.1"),
|
||||
shouldPass: false,
|
||||
},
|
||||
{ // Some random unallocated IPv6 address
|
||||
name: "Error binding to public IPv6",
|
||||
addr: netip.MustParseAddr("0cbb:c1ed:6a53:ca6b:f69f:8842:1ace:9ec0"),
|
||||
shouldPass: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
err := shouldAllowBinding(tt.addr)
|
||||
|
||||
if tt.shouldPass {
|
||||
assert.NoError(t, err)
|
||||
} else {
|
||||
assert.Error(t, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue