Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
0a871b89
Commit
0a871b89
authored
Oct 11, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix tests
parent
35cf975e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
10 deletions
+9
-10
cron_test.go
internal/cron/cron_test.go
+0
-1
parser_test.go
internal/cron/parser_test.go
+9
-9
No files found.
internal/cron/cron_test.go
View file @
0a871b89
...
@@ -667,7 +667,6 @@ func TestStopAndWait(t *testing.T) {
...
@@ -667,7 +667,6 @@ func TestStopAndWait(t *testing.T) {
case
<-
time
.
After
(
time
.
Millisecond
)
:
case
<-
time
.
After
(
time
.
Millisecond
)
:
t
.
Error
(
"context not done even when cron Stop is completed"
)
t
.
Error
(
"context not done even when cron Stop is completed"
)
}
}
})
})
}
}
...
...
internal/cron/parser_test.go
View file @
0a871b89
...
@@ -33,14 +33,14 @@ func TestRange(t *testing.T) {
...
@@ -33,14 +33,14 @@ func TestRange(t *testing.T) {
{
"*/2"
,
1
,
3
,
1
<<
1
|
1
<<
3
,
""
},
{
"*/2"
,
1
,
3
,
1
<<
1
|
1
<<
3
,
""
},
{
"5--5"
,
0
,
0
,
zero
,
"too many hyphens"
},
{
"5--5"
,
0
,
0
,
zero
,
"too many hyphens"
},
{
"jan-x"
,
0
,
0
,
zero
,
"failed to parse int from"
},
{
"jan-x"
,
0
,
0
,
zero
,
`failed to parse number: strconv.Atoi: parsing "jan": invalid syntax`
},
{
"2-x"
,
1
,
5
,
zero
,
"failed to parse int from"
},
{
"2-x"
,
1
,
5
,
zero
,
`failed to parse number: strconv.Atoi: parsing "x": invalid syntax`
},
{
"*/-12"
,
0
,
0
,
zero
,
"n
egative number
"
},
{
"*/-12"
,
0
,
0
,
zero
,
"n
umber must be positive
"
},
{
"*//2"
,
0
,
0
,
zero
,
"too many slashes"
},
{
"*//2"
,
0
,
0
,
zero
,
"too many slashes"
},
{
"1"
,
3
,
5
,
zero
,
"below minimum"
},
{
"1"
,
3
,
5
,
zero
,
"below minimum"
},
{
"6"
,
3
,
5
,
zero
,
"above maximum"
},
{
"6"
,
3
,
5
,
zero
,
"above maximum"
},
{
"5-3"
,
3
,
5
,
zero
,
"be
yond end of range
"
},
{
"5-3"
,
3
,
5
,
zero
,
"be
ginning of range after end: 5-3
"
},
{
"*/0"
,
0
,
0
,
zero
,
"s
hould be a positive number
"
},
{
"*/0"
,
0
,
0
,
zero
,
"s
tep cannot be zero: */0
"
},
}
}
for
_
,
c
:=
range
ranges
{
for
_
,
c
:=
range
ranges
{
...
@@ -120,10 +120,10 @@ func TestBits(t *testing.T) {
...
@@ -120,10 +120,10 @@ func TestBits(t *testing.T) {
func
TestParseScheduleErrors
(
t
*
testing
.
T
)
{
func
TestParseScheduleErrors
(
t
*
testing
.
T
)
{
var
tests
=
[]
struct
{
expr
,
err
string
}{
var
tests
=
[]
struct
{
expr
,
err
string
}{
{
"* 5 j * * *"
,
"failed to parse int from"
},
{
"* 5 j * * *"
,
`failed to parse number: strconv.Atoi: parsing "j": invalid syntax`
},
{
"@every Xm"
,
"failed to parse duration"
},
{
"@every Xm"
,
"failed to parse duration"
},
{
"@unrecognized"
,
"unrecognized descriptor"
},
{
"@unrecognized"
,
"unrecognized descriptor"
},
{
"* * * *"
,
"
expected 5 to 6 fields
"
},
{
"* * * *"
,
"
incorrect number of fields, expected 5-6
"
},
{
""
,
"empty spec string"
},
{
""
,
"empty spec string"
},
}
}
for
_
,
c
:=
range
tests
{
for
_
,
c
:=
range
tests
{
...
@@ -328,11 +328,11 @@ func TestStandardSpecSchedule(t *testing.T) {
...
@@ -328,11 +328,11 @@ func TestStandardSpecSchedule(t *testing.T) {
},
},
{
{
expr
:
"5 j * * *"
,
expr
:
"5 j * * *"
,
err
:
"failed to parse int from"
,
err
:
`failed to parse number: strconv.Atoi: parsing "j": invalid syntax`
,
},
},
{
{
expr
:
"* * * *"
,
expr
:
"* * * *"
,
err
:
"
expected exactly 5
fields"
,
err
:
"
incorrect number of
fields"
,
},
},
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment