Files
EdgeNode/internal/configs/node_config_test.go

67 lines
1.3 KiB
Go
Raw Normal View History

2020-07-21 11:18:47 +08:00
package configs
import (
2020-09-13 20:37:40 +08:00
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
2020-07-21 11:18:47 +08:00
_ "github.com/iwind/TeaGo/bootstrap"
"github.com/iwind/TeaGo/logs"
"testing"
)
func TestSharedNodeConfig(t *testing.T) {
{
config, err := SharedNodeConfig()
if err != nil {
t.Fatal(err)
}
t.Log(config)
}
// read from memory cache
{
config, err := SharedNodeConfig()
if err != nil {
t.Fatal(err)
}
t.Log(config)
}
}
func TestNodeConfig_Groups(t *testing.T) {
config := &NodeConfig{}
2020-09-09 18:53:53 +08:00
config.Servers = []*serverconfigs.ServerConfig{
2020-07-21 11:18:47 +08:00
{
IsOn: true,
2020-09-09 18:53:53 +08:00
HTTP: &serverconfigs.HTTPProtocolConfig{
BaseProtocol: serverconfigs.BaseProtocol{
IsOn: true,
Listen: []*serverconfigs.NetworkAddressConfig{
{
Protocol: serverconfigs.ProtocolHTTP,
Host: "127.0.0.1",
PortRange: "1234",
},
{
Protocol: serverconfigs.ProtocolHTTP,
PortRange: "8080",
},
},
},
2020-07-21 11:18:47 +08:00
},
},
{
2020-09-09 18:53:53 +08:00
HTTP: &serverconfigs.HTTPProtocolConfig{
BaseProtocol: serverconfigs.BaseProtocol{
IsOn: true,
Listen: []*serverconfigs.NetworkAddressConfig{
{
Protocol: serverconfigs.ProtocolHTTP,
PortRange: "8080",
},
},
},
2020-07-21 11:18:47 +08:00
},
},
}
logs.PrintAsJSON(config.AvailableGroups(), t)
}