修改事务提交调用问题

This commit is contained in:
2025-04-02 18:02:23 +08:00
parent 68e96793fe
commit 116fa8ec18
5 changed files with 57 additions and 24 deletions

View File

@@ -8,6 +8,7 @@ import (
"platform/pkg/remote"
"platform/pkg/testutil"
"platform/web/models"
"reflect"
"strings"
"testing"
"time"
@@ -337,7 +338,7 @@ func Test_channelService_CreateChannel(t *testing.T) {
name string
args args
setup func()
want []string
want []*PortInfo
wantErr bool
wantErrContains string
checkCache func(channels []models.Channel) error
@@ -353,10 +354,12 @@ func Test_channelService_CreateChannel(t *testing.T) {
count: 3,
nodeFilter: []NodeFilterConfig{{Prov: "河南", City: "郑州", Isp: "电信"}},
},
want: []string{
"http://111.111.111.111:10000",
"http://111.111.111.111:10001",
"http://111.111.111.111:10002",
want: []*PortInfo{
{
Proto: "http",
Host: proxy.Host,
Port: 10000,
},
},
},
{
@@ -369,10 +372,7 @@ func Test_channelService_CreateChannel(t *testing.T) {
authType: ChannelAuthTypeIp,
count: 2,
},
want: []string{
"http://111.111.111.111:10000",
"http://111.111.111.111:10001",
},
want: []*PortInfo{},
},
{
name: "管理员创建SOCKS5密码通道",
@@ -384,10 +384,7 @@ func Test_channelService_CreateChannel(t *testing.T) {
authType: ChannelAuthTypePass,
count: 2,
},
want: []string{
"socks5://111.111.111.111:10000",
"socks5://111.111.111.111:10001",
},
want: []*PortInfo{},
},
{
name: "套餐不存在",
@@ -507,9 +504,9 @@ func Test_channelService_CreateChannel(t *testing.T) {
return
}
if len(got) != len(tt.want) {
t.Errorf("CreateChannel() 返回长度 = %v, want %v", len(got), len(tt.want))
return
// 检查返回值
if reflect.DeepEqual(got, tt.want) {
t.Errorf("CreateChannel() 返回值 = %v, 期望 %v", got, tt.want)
}
// 查询创建的通道