Files
EdgeNode/internal/iplibrary/action_manager_test.go
GoEdgeLab c19be78e0d v1.4.1
2024-07-27 15:42:50 +08:00

58 lines
1.0 KiB
Go

package iplibrary
import (
"testing"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs"
"github.com/iwind/TeaGo/maps"
)
func TestActionManager_UpdateActions(t *testing.T) {
var manager = NewActionManager()
manager.UpdateActions([]*firewallconfigs.FirewallActionConfig{
{
Id: 1,
Type: "ipset",
Params: maps.Map{
"whiteName": "edge-white-list",
"blackName": "edge-black-list",
},
},
})
t.Log("===config===")
for _, c := range manager.configMap {
t.Log(c.Id, c.Type)
}
t.Log("===instance===")
for id, c := range manager.instanceMap {
t.Log(id, c)
}
manager.UpdateActions([]*firewallconfigs.FirewallActionConfig{
{
Id: 1,
Type: "ipset",
Params: maps.Map{
"whiteName": "edge-white-list",
"blackName": "edge-black-list",
},
},
{
Id: 2,
Type: "iptables",
Params: maps.Map{
},
},
})
t.Log("===config===")
for _, c := range manager.configMap {
t.Log(c.Id, c.Type)
}
t.Log("===instance===")
for id, c := range manager.instanceMap {
t.Logf("%d: %#v", id, c)
}
}