Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
01e42c3d
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
9 个月 前同步成功
通知
11
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zentaoatf
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
01e42c3d
编写于
5月 18, 2023
作者:
Z
zhaoke
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'main' of git.zcorp.cc:pangu/zentaoatf
上级
66fa93eb
7b8c0033
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
45 addition
and
25 deletion
+45
-25
Makefile
Makefile
+1
-1
internal/command/action/list.go
internal/command/action/list.go
+2
-1
internal/command/action/view.go
internal/command/action/view.go
+2
-1
internal/pkg/consts/enum.go
internal/pkg/consts/enum.go
+3
-3
internal/pkg/helper/exec/report-unit.go
internal/pkg/helper/exec/report-unit.go
+22
-7
internal/pkg/helper/exec/report-ztf.go
internal/pkg/helper/exec/report-ztf.go
+1
-0
internal/pkg/helper/script/parser.go
internal/pkg/helper/script/parser.go
+1
-1
internal/server/modules/v1/service/job.go
internal/server/modules/v1/service/job.go
+5
-4
pkg/consts/consts.go
pkg/consts/consts.go
+2
-0
pkg/lib/date/date.go
pkg/lib/date/date.go
+4
-7
pkg/lib/string/string.go
pkg/lib/string/string.go
+2
-0
未找到文件。
Makefile
浏览文件 @
01e42c3d
PROJECT
=
ztf
VERSION
=
`
head
-n
1 VERSION
`
VERSION
:=
$(
shell
head
-n
1 VERSION
)
ifeq
($(OS),Windows_NT)
PLATFORM
=
"Windows"
...
...
internal/command/action/list.go
浏览文件 @
01e42c3d
...
...
@@ -2,6 +2,7 @@ package action
import
(
"fmt"
"github.com/easysoft/zentaoatf/pkg/consts"
"strconv"
"strings"
"time"
...
...
@@ -45,7 +46,7 @@ func List(files []string, keywords string) {
total
:=
len
(
scriptArr
)
width
:=
strconv
.
Itoa
(
len
(
strconv
.
Itoa
(
total
)))
logUtils
.
Info
(
"
\n
"
+
time
.
Now
()
.
Format
(
"2006-01-02 15:04:05"
)
+
" "
+
logUtils
.
Info
(
"
\n
"
+
time
.
Now
()
.
Format
(
consts
.
DateTimeFormat
)
+
" "
+
i118Utils
.
Sprintf
(
"found_scripts_no_ztf_dir"
,
total
,
commConsts
.
WorkDir
))
for
idx
,
cs
:=
range
scriptArr
{
...
...
internal/command/action/view.go
浏览文件 @
01e42c3d
...
...
@@ -5,6 +5,7 @@ import (
commConsts
"github.com/easysoft/zentaoatf/internal/pkg/consts"
langHelper
"github.com/easysoft/zentaoatf/internal/pkg/helper/lang"
scriptHelper
"github.com/easysoft/zentaoatf/internal/pkg/helper/script"
"github.com/easysoft/zentaoatf/pkg/consts"
commonUtils
"github.com/easysoft/zentaoatf/pkg/lib/common"
fileUtils
"github.com/easysoft/zentaoatf/pkg/lib/file"
i118Utils
"github.com/easysoft/zentaoatf/pkg/lib/i118"
...
...
@@ -44,7 +45,7 @@ func view(cases []string, keywords string) {
total
:=
len
(
arrs
)
logUtils
.
Info
(
"
\n
"
+
time
.
Now
()
.
Format
(
"2006-01-02 15:04:05"
)
+
" "
+
logUtils
.
Info
(
"
\n
"
+
time
.
Now
()
.
Format
(
consts
.
DateTimeFormat
)
+
" "
+
i118Utils
.
Sprintf
(
"found_scripts_no_ztf_dir"
,
total
,
commConsts
.
WorkDir
))
width
:=
len
(
strconv
.
Itoa
(
len
(
arrs
)))
...
...
internal/pkg/consts/enum.go
浏览文件 @
01e42c3d
...
...
@@ -29,9 +29,9 @@ var (
ErrDirNotEmpty
=
ResponseCode
{
1100
,
"Dir Not Empty Error"
}
ErrZentaoConfig
=
ResponseCode
{
2000
,
"Zentao Config Error"
}
ErrZentaoRequest
=
ResponseCode
{
3000
,
"zentao request Error"
}
ErrRecordWithSameNameExist
=
ResponseCode
{
3010
,
"Record Exist"
}
ErrRecordWithSamePathExist
=
ResponseCode
{
3011
,
"Record Exist"
}
ErrRecordWithSameInterpreterExist
=
ResponseCode
{
2000
,
"Record Exist"
}
ErrRecordWithSameNameExist
=
ResponseCode
{
3010
,
"Record
With Same Name
Exist"
}
ErrRecordWithSamePathExist
=
ResponseCode
{
3011
,
"Record
With Same Path
Exist"
}
ErrRecordWithSameInterpreterExist
=
ResponseCode
{
2000
,
"Record
With Same Interpreter
Exist"
}
ErrRecordNotExist
=
ResponseCode
{
4000
,
"Record Not Found"
}
ErrRecordNotAllowDelete
=
ResponseCode
{
2000
,
"Record Can Not Delete"
}
ErrPostParam
=
ResponseCode
{
2000
,
"Parameter Error"
}
...
...
internal/pkg/helper/exec/report-unit.go
浏览文件 @
01e42c3d
...
...
@@ -431,14 +431,8 @@ func ParserUnitTestResult(testSuites []commDomain.UnitTestSuite) (
idx
:=
1
for
_
,
suite
:=
range
testSuites
{
//if suite.Time != 0 && suite.Time { // for junit, there is a time on suite level
// dur += suite.Time
//}
for
_
,
cs
:=
range
suite
.
Cases
{
if
cs
.
Id
<=
0
{
cs
.
Id
=
idx
}
getCaseIdFromName
(
&
cs
,
idx
)
if
cs
.
Failure
!=
nil
{
cs
.
Status
=
"fail"
...
...
@@ -913,3 +907,24 @@ func getZapReport() (ret string) {
return
}
func
getCaseIdFromName
(
cs
*
commDomain
.
UnitResult
,
defaultVal
int
)
{
if
cs
.
Cid
>
0
{
return
}
cs
.
Title
=
strings
.
TrimSpace
(
cs
.
Title
)
regx
:=
regexp
.
MustCompile
(
`^(\d+)\. (.+)`
)
arr
:=
regx
.
FindAllStringSubmatch
(
cs
.
Title
,
-
1
)
if
len
(
arr
)
>
0
{
cs
.
Cid
=
stringUtils
.
ParseInt
(
arr
[
0
][
1
])
cs
.
Title
=
arr
[
0
][
2
]
}
if
cs
.
Cid
<=
0
{
cs
.
Cid
=
defaultVal
}
return
}
internal/pkg/helper/exec/report-ztf.go
浏览文件 @
01e42c3d
...
...
@@ -29,6 +29,7 @@ func GenZTFTestReport(report commDomain.ZtfReport, pathMaxWidth int,
}
default
:
}
// print failed case
failedCount
:=
0
failedCaseLinesWithCheckpoint
:=
make
([]
string
,
0
)
...
...
internal/pkg/helper/script/parser.go
浏览文件 @
01e42c3d
...
...
@@ -433,7 +433,7 @@ func GetCaseInfo(file string) (pass bool, caseId, productId int, title string, t
return
}
//
TODO: deal with old format, will
removed
//
deal with old format, will be
removed
isOldFormat
:=
strings
.
Index
(
content
,
"[esac]"
)
>
-
1
pass
=
CheckFileContentIsScript
(
content
)
if
!
pass
{
...
...
internal/server/modules/v1/service/job.go
浏览文件 @
01e42c3d
...
...
@@ -4,6 +4,7 @@ import (
"errors"
"fmt"
configHelper
"github.com/easysoft/zentaoatf/internal/pkg/helper/config"
"github.com/easysoft/zentaoatf/pkg/consts"
i118Utils
"github.com/easysoft/zentaoatf/pkg/lib/i118"
"path/filepath"
"strconv"
...
...
@@ -203,8 +204,8 @@ func (s *JobService) SubmitJobStatus(job model.Job) (err error) {
status
:=
serverDomain
.
ZentaoJobSubmitReq
{
Task
:
job
.
Task
,
Status
:
job
.
Status
,
StartTime
:
(
*
job
.
StartDate
)
.
Format
(
"2006-01-02 15:04:05"
),
EndTime
:
(
*
job
.
EndDate
)
.
Format
(
"2006-01-02 15:04:05"
),
StartTime
:
(
*
job
.
StartDate
)
.
Format
(
consts
.
DateTimeFormat
),
EndTime
:
(
*
job
.
EndDate
)
.
Format
(
consts
.
DateTimeFormat
),
RetryTime
:
job
.
Retry
,
Error
:
""
,
Data
:
""
,
...
...
@@ -246,8 +247,8 @@ func (s *JobService) SubmitExecResult(job model.Job, execErr error) (err error)
ret
:=
serverDomain
.
ZentaoJobSubmitReq
{
Task
:
job
.
Task
,
Status
:
job
.
Status
,
StartTime
:
(
*
job
.
StartDate
)
.
Format
(
"2006-01-02 15:04:05"
),
EndTime
:
(
*
job
.
EndDate
)
.
Format
(
"2006-01-02 15:04:05"
),
StartTime
:
(
*
job
.
StartDate
)
.
Format
(
consts
.
DateTimeFormat
),
EndTime
:
(
*
job
.
EndDate
)
.
Format
(
consts
.
DateTimeFormat
),
RetryTime
:
job
.
Retry
,
Error
:
fmt
.
Sprintf
(
"%v"
,
execErr
),
Data
:
report
,
...
...
pkg/consts/consts.go
浏览文件 @
01e42c3d
...
...
@@ -34,4 +34,6 @@ var (
Authorization
=
"Authorization"
Bearer
=
"Bearer"
DateTimeFormat
=
"2006-01-02 15:04:05"
)
pkg/lib/date/date.go
浏览文件 @
01e42c3d
package
dateUtils
import
(
"github.com/easysoft/zentaoatf/pkg/consts"
"time"
)
const
(
dateTimeFormat
=
"2006-01-02 15:04:05"
)
func
DateStr
(
tm
time
.
Time
)
string
{
return
tm
.
Format
(
"2006-01-02"
)
}
...
...
@@ -24,7 +21,7 @@ func DateTimeStrFmt(tm time.Time, fm string) string {
}
func
DateTimeStr
(
tm
time
.
Time
)
string
{
return
tm
.
Format
(
"2006-01-02 15:04:05"
)
return
tm
.
Format
(
consts
.
DateTimeFormat
)
}
func
DateTimeStrLong
(
tm
time
.
Time
)
string
{
...
...
@@ -48,9 +45,9 @@ func DateStrToTimestamp(str string) (int64, error) {
}
func
UnitToDate
(
unit
int64
)
(
date
time
.
Time
,
err
error
)
{
timeStr
:=
time
.
Unix
(
unit
,
0
)
.
Format
(
d
ateTimeFormat
)
timeStr
:=
time
.
Unix
(
unit
,
0
)
.
Format
(
consts
.
D
ateTimeFormat
)
date
,
_
=
time
.
ParseInLocation
(
d
ateTimeFormat
,
timeStr
,
time
.
Local
)
date
,
_
=
time
.
ParseInLocation
(
consts
.
D
ateTimeFormat
,
timeStr
,
time
.
Local
)
return
}
pkg/lib/string/string.go
浏览文件 @
01e42c3d
...
...
@@ -85,6 +85,8 @@ func HashPassword(pwd string) string {
}
func
ParseInt
(
str
string
)
(
ret
int
)
{
str
=
strings
.
TrimSpace
(
str
)
ret
,
_
=
strconv
.
Atoi
(
str
)
return
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录