Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alexandra Rogova
jio
Commits
56716fdb
Commit
56716fdb
authored
Aug 22, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jio job recovery tests improved + 2 tests added
parent
8569a618
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
9 deletions
+64
-9
test/jio/tests.js
test/jio/tests.js
+64
-9
No files found.
test/jio/tests.js
View file @
56716fdb
...
...
@@ -764,10 +764,15 @@
* Test job recovery
*/
test
(
'
Job Recovery
'
,
function
()
{
expect
(
1
);
var
workspace
=
{}
,
clock
,
jio
;
expect
(
4
);
var
workspace
,
clock
,
jio
;
clock
=
sinon
.
useFakeTimers
();
//////////////////////////////
// Running job recovery
workspace
=
{};
// create instance
jio
=
new
JIO
({
"
type
"
:
"
fake
"
,
...
...
@@ -778,7 +783,7 @@
// create a job
jio
.
post
({});
// copy workspace
// copy workspace
when job is running
workspace
=
jIO
.
util
.
deepClone
(
workspace
);
clock
.
tick
(
1
);
// now: 1 ms
fakestorage
[
'
Job Recove/post
'
].
success
({
"
id
"
:
"
a
"
});
...
...
@@ -791,20 +796,70 @@
"
workspace
"
:
workspace
});
// wait for action
clock
.
tick
(
19998
);
// now: 19999 ms
if
(
fakestorage
[
'
Job Recove/post
'
])
{
return
ok
(
false
,
"
Command called, job recovered to earlier
"
);
ok
(
false
,
"
Command called, job recovered to earlier
"
);
}
clock
.
tick
(
1
);
// now: 20000 ms
if
(
!
fakestorage
[
'
Job Recove/post
'
])
{
return
ok
(
false
,
"
Command not called, job recovery failed
"
);
ok
(
false
,
"
Command not called, job recovery failed
"
);
}
else
{
ok
(
true
,
"
Command called, job recovery ok
"
);
}
ok
(
true
,
"
Command called, job recovery ok
"
);
fakestorage
[
'
Job Recove/post
'
].
success
({
"
id
"
:
"
a
"
});
clock
.
tick
(
1
);
// now: 20001 ms
deepEqual
(
workspace
,
{},
'
No more job in the queue
'
);
clock
.
tick
(
79999
);
// now: 100000 ms
//////////////////////////////
// Waiting for time job recovery
workspace
=
{};
// create instance
jio
=
new
JIO
({
"
type
"
:
"
fake
"
,
"
id
"
:
"
Job Recove
"
},
{
"
workspace
"
:
workspace
});
// create a job
jio
.
post
({});
clock
.
tick
(
1
);
// now: 1 ms
// copy workspace when job is waiting
fakestorage
[
'
Job Recove/post
'
].
retry
();
workspace
=
jIO
.
util
.
deepClone
(
workspace
);
clock
.
tick
(
2000
);
// now: 2001 ms
fakestorage
[
'
Job Recove/post
'
].
success
({
"
id
"
:
"
a
"
});
// create instance with copied workspace
jio
=
new
JIO
({
"
type
"
:
"
fake
"
,
"
id
"
:
"
Job Recove
"
},
{
"
workspace
"
:
workspace
});
clock
.
tick
(
17998
);
// now: 19999 ms
if
(
fakestorage
[
'
Job Recove/post
'
])
{
ok
(
false
,
"
Command called, job recovered to earlier
"
);
}
clock
.
tick
(
1
);
// now: 20000 ms
if
(
!
fakestorage
[
'
Job Recove/post
'
])
{
ok
(
false
,
"
Command not called, job recovery failed
"
);
}
else
{
ok
(
true
,
"
Command called, job recovery ok
"
);
}
fakestorage
[
'
Job Recove/post
'
].
success
({
"
id
"
:
"
a
"
});
clock
.
tick
(
1
);
// now: 20001 ms
deepEqual
(
workspace
,
{},
'
No more job in the queue
'
);
clock
.
tick
(
79999
);
// now: 100000 ms
//////////////////////////////
// XXX Waiting for jobs job recovery
// XXX job waiting for time recovery
// XXX job waiting for job recovery
});
}));
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