mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-06 09:22:42 +08:00
NET-447: Removed proxy related fields and code (#2459)
* remove related fields and code * remover metrics collection from server code * fw update struct * add ext client flag to metrics data * simply nat types * rm proxy update from cli
This commit is contained in:
@@ -30,16 +30,14 @@ func TestMain(m *testing.M) {
|
||||
|
||||
func TestCheckPorts(t *testing.T) {
|
||||
h := models.Host{
|
||||
ID: uuid.New(),
|
||||
EndpointIP: net.ParseIP("192.168.1.1"),
|
||||
ListenPort: 51821,
|
||||
ProxyListenPort: maxPort,
|
||||
ID: uuid.New(),
|
||||
EndpointIP: net.ParseIP("192.168.1.1"),
|
||||
ListenPort: 51821,
|
||||
}
|
||||
testHost := models.Host{
|
||||
ID: uuid.New(),
|
||||
EndpointIP: net.ParseIP("192.168.1.1"),
|
||||
ListenPort: 51830,
|
||||
ProxyListenPort: 51730,
|
||||
ID: uuid.New(),
|
||||
EndpointIP: net.ParseIP("192.168.1.1"),
|
||||
ListenPort: 51830,
|
||||
}
|
||||
//not sure why this initialization is required but without it
|
||||
// RemoveHost returns database is closed
|
||||
@@ -49,45 +47,17 @@ func TestCheckPorts(t *testing.T) {
|
||||
t.Run("no change", func(t *testing.T) {
|
||||
is := is.New(t)
|
||||
CheckHostPorts(&testHost)
|
||||
t.Log(testHost.ListenPort, testHost.ProxyListenPort)
|
||||
t.Log(h.ListenPort, h.ProxyListenPort)
|
||||
t.Log(testHost.ListenPort)
|
||||
t.Log(h.ListenPort)
|
||||
is.Equal(testHost.ListenPort, 51830)
|
||||
is.Equal(testHost.ProxyListenPort, 51730)
|
||||
})
|
||||
t.Run("same listen port", func(t *testing.T) {
|
||||
is := is.New(t)
|
||||
testHost.ListenPort = 51821
|
||||
CheckHostPorts(&testHost)
|
||||
t.Log(testHost.ListenPort, testHost.ProxyListenPort)
|
||||
t.Log(h.ListenPort, h.ProxyListenPort)
|
||||
t.Log(testHost.ListenPort)
|
||||
t.Log(h.ListenPort)
|
||||
is.Equal(testHost.ListenPort, 51822)
|
||||
is.Equal(testHost.ProxyListenPort, 51730)
|
||||
})
|
||||
t.Run("same proxy port", func(t *testing.T) {
|
||||
is := is.New(t)
|
||||
testHost.ProxyListenPort = 65535
|
||||
CheckHostPorts(&testHost)
|
||||
t.Log(testHost.ListenPort, testHost.ProxyListenPort)
|
||||
t.Log(h.ListenPort, h.ProxyListenPort)
|
||||
is.Equal(testHost.ListenPort, 51822)
|
||||
is.Equal(testHost.ProxyListenPort, minPort)
|
||||
})
|
||||
t.Run("listenport equals proxy port", func(t *testing.T) {
|
||||
is := is.New(t)
|
||||
testHost.ListenPort = maxPort
|
||||
CheckHostPorts(&testHost)
|
||||
t.Log(testHost.ListenPort, testHost.ProxyListenPort)
|
||||
t.Log(h.ListenPort, h.ProxyListenPort)
|
||||
is.Equal(testHost.ListenPort, minPort)
|
||||
is.Equal(testHost.ProxyListenPort, minPort+1)
|
||||
})
|
||||
t.Run("proxyport equals listenport", func(t *testing.T) {
|
||||
is := is.New(t)
|
||||
testHost.ProxyListenPort = 51821
|
||||
CheckHostPorts(&testHost)
|
||||
t.Log(testHost.ListenPort, testHost.ProxyListenPort)
|
||||
t.Log(h.ListenPort, h.ProxyListenPort)
|
||||
is.Equal(testHost.ListenPort, minPort)
|
||||
is.Equal(testHost.ProxyListenPort, 51822)
|
||||
})
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user