Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FLIPPED-AURORA
gin-vue-admin
提交
ff531b2d
G
gin-vue-admin
项目概览
FLIPPED-AURORA
/
gin-vue-admin
大约 1 年 前同步成功
通知
333
Star
18155
Fork
5506
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gin-vue-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ff531b2d
编写于
9月 15, 2021
作者:
S
songzhibin97
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:增加测试用例
上级
ac6e6413
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
70 addition
and
3 deletion
+70
-3
server/go.mod
server/go.mod
+1
-0
server/go.sum
server/go.sum
+1
-0
server/utils/md5.go
server/utils/md5.go
+2
-2
server/utils/plugin/plugin_uinx.go
server/utils/plugin/plugin_uinx.go
+1
-1
server/utils/timer/timed_task_test.go
server/utils/timer/timed_task_test.go
+65
-0
未找到文件。
server/go.mod
浏览文件 @
ff531b2d
...
...
@@ -25,6 +25,7 @@ require (
github.com/shirou/gopsutil v3.21.1+incompatible
github.com/songzhibin97/gkit v1.1.1
github.com/spf13/viper v1.7.0
github.com/stretchr/testify v1.7.0 // indirect
github.com/swaggo/gin-swagger v1.3.0
github.com/swaggo/swag v1.7.0
github.com/tencentyun/cos-go-sdk-v5 v0.7.19
...
...
server/go.sum
浏览文件 @
ff531b2d
...
...
@@ -463,6 +463,7 @@ github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM=
github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
...
...
server/utils/md5.go
浏览文件 @
ff531b2d
...
...
@@ -11,8 +11,8 @@ import (
//@param: str []byte
//@return: string
func
MD5V
(
str
[]
byte
)
string
{
func
MD5V
(
str
[]
byte
,
b
...
byte
)
string
{
h
:=
md5
.
New
()
h
.
Write
(
str
)
return
hex
.
EncodeToString
(
h
.
Sum
(
nil
))
return
hex
.
EncodeToString
(
h
.
Sum
(
b
))
}
server/utils/plugin/plugin_uinx.go
浏览文件 @
ff531b2d
...
...
@@ -82,7 +82,7 @@ func loadPlugin(path string, f fs.FileInfo) error {
fmt
.
Println
(
"loadPlugin err "
,
fmt
.
Sprintf
(
"path:%s 没有实现 %s 接口"
,
filepath
.
Base
(
fPath
),
OnlyFuncName
))
return
errors
.
New
(
"没有实现指定接口"
)
}
else
{
// todo
}
fmt
.
Println
(
"loadPlugin add "
,
filepath
.
Base
(
fPath
))
ManagementPlugin
.
SetPlugin
(
filepath
.
Base
(
fPath
),
p
)
...
...
server/utils/timer/timed_task_test.go
0 → 100644
浏览文件 @
ff531b2d
package
timer
import
(
"fmt"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
var
job
=
mockJob
{}
type
mockJob
struct
{}
func
(
job
mockJob
)
Run
()
{
mockFunc
()
}
func
mockFunc
()
{
time
.
Sleep
(
time
.
Second
)
fmt
.
Println
(
"1s..."
)
}
func
TestNewTimerTask
(
t
*
testing
.
T
)
{
tm
:=
NewTimerTask
()
_tm
:=
tm
.
(
*
timer
)
{
_
,
err
:=
tm
.
AddTaskByFunc
(
"func"
,
"@every 1s"
,
mockFunc
)
assert
.
Nil
(
t
,
err
)
_
,
ok
:=
_tm
.
taskList
[
"func"
]
if
!
ok
{
t
.
Error
(
"no find func"
)
}
}
{
_
,
err
:=
tm
.
AddTaskByJob
(
"job"
,
"@every 1s"
,
job
)
assert
.
Nil
(
t
,
err
)
_
,
ok
:=
_tm
.
taskList
[
"job"
]
if
!
ok
{
t
.
Error
(
"no find job"
)
}
}
{
_
,
ok
:=
tm
.
FindCron
(
"func"
)
if
!
ok
{
t
.
Error
(
"no find func"
)
}
_
,
ok
=
tm
.
FindCron
(
"job"
)
if
!
ok
{
t
.
Error
(
"no find job"
)
}
_
,
ok
=
tm
.
FindCron
(
"none"
)
if
ok
{
t
.
Error
(
"find none"
)
}
}
{
tm
.
Clear
(
"func"
)
_
,
ok
:=
tm
.
FindCron
(
"func"
)
if
ok
{
t
.
Error
(
"find func"
)
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录