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
amrani
jio
Commits
7603944f
Commit
7603944f
authored
Apr 22, 2014
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix test timeout issues
parent
0a307d7f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
21 deletions
+44
-21
test/jio.storage/replicatestorage.tests.js
test/jio.storage/replicatestorage.tests.js
+34
-13
test/jio/tests.js
test/jio/tests.js
+10
-8
No files found.
test/jio.storage/replicatestorage.tests.js
View file @
7603944f
/*jslint indent: 2, maxlen: 80, nomen: true */
/*global define, RSVP, jIO, fake_storage, module, test, stop, start, deepEqual,
setTimeout, clearTimeout, XMLHttpRequest, window */
setTimeout, clearTimeout, XMLHttpRequest, window
, ok
*/
(
function
(
dependencies
,
factory
)
{
"
use strict
"
;
...
...
@@ -163,7 +163,7 @@
},
"
Get document, nothing to synchronize.
"
);
// check storage state
return
sleep
(
5
00
).
return
sleep
(
10
00
).
// possible synchronization in background (should not occur)
then
(
function
()
{
return
all
(
jio_list
.
map
(
function
(
jio
)
{
...
...
@@ -201,11 +201,16 @@
}
function
getDocumentWithSynchronizationTest
(
answer
)
{
if
(
answer
&&
answer
.
data
)
{
ok
(
shared
.
modified_date_list
.
map
(
function
(
v
)
{
return
(
v
&&
v
.
toJSON
())
||
undefined
;
}).
indexOf
(
answer
.
data
.
modified
)
!==
-
1
,
"
Should be a known date
"
);
delete
answer
.
data
.
modified
;
}
deepEqual
(
answer
,
{
"
data
"
:
{
"
_id
"
:
"
{
\"
identifier
\"
:[
\"
b
\"
]}
"
,
"
identifier
"
:
"
b
"
,
"
modified
"
:
shared
.
modified_date_list
[
0
].
toJSON
()
"
identifier
"
:
"
b
"
},
"
id
"
:
"
{
\"
identifier
\"
:[
\"
b
\"
]}
"
,
"
method
"
:
"
get
"
,
...
...
@@ -215,7 +220,7 @@
},
"
Get document, pending synchronization.
"
);
// check storage state
return
sleep
(
5
00
).
return
sleep
(
10
00
).
// synchronizing in background
then
(
function
()
{
return
all
(
jio_list
.
map
(
function
(
jio
)
{
...
...
@@ -251,11 +256,16 @@
}
function
getDocumentWith404SynchronizationTest
(
answer
)
{
if
(
answer
&&
answer
.
data
)
{
ok
(
shared
.
modified_date_list
.
map
(
function
(
v
)
{
return
(
v
&&
v
.
toJSON
())
||
undefined
;
}).
indexOf
(
answer
.
data
.
modified
)
!==
-
1
,
"
Should be a known date
"
);
delete
answer
.
data
.
modified
;
}
deepEqual
(
answer
,
{
"
data
"
:
{
"
_id
"
:
"
{
\"
identifier
\"
:[
\"
c
\"
]}
"
,
"
identifier
"
:
"
c
"
,
"
modified
"
:
shared
.
modified_date_list
[
1
].
toJSON
()
"
identifier
"
:
"
c
"
},
"
id
"
:
"
{
\"
identifier
\"
:[
\"
c
\"
]}
"
,
"
method
"
:
"
get
"
,
...
...
@@ -265,7 +275,7 @@
},
"
Get document, synchronizing with not found document.
"
);
// check storage state
return
sleep
(
5
00
).
return
sleep
(
10
00
).
// synchronizing in background
then
(
function
()
{
return
all
(
jio_list
.
map
(
function
(
jio
)
{
...
...
@@ -309,11 +319,16 @@
}
function
getDocumentWithUnavailableStorageTest
(
answer
)
{
if
(
answer
&&
answer
.
data
)
{
ok
(
shared
.
modified_date_list
.
map
(
function
(
v
)
{
return
(
v
&&
v
.
toJSON
())
||
undefined
;
}).
indexOf
(
answer
.
data
.
modified
)
!==
-
1
,
"
Should be a known date
"
);
delete
answer
.
data
.
modified
;
}
deepEqual
(
answer
,
{
"
data
"
:
{
"
_id
"
:
"
{
\"
identifier
\"
:[
\"
d
\"
]}
"
,
"
identifier
"
:
"
d
"
,
"
modified
"
:
shared
.
modified_date_list
[
1
].
toJSON
()
"
identifier
"
:
"
d
"
},
"
id
"
:
"
{
\"
identifier
\"
:[
\"
d
\"
]}
"
,
"
method
"
:
"
get
"
,
...
...
@@ -324,7 +339,7 @@
unsetFakeStorage
();
// check storage state
return
sleep
(
5
00
).
return
sleep
(
10
00
).
// synchronizing in background
then
(
function
()
{
return
all
(
jio_list
.
map
(
function
(
jio
)
{
...
...
@@ -479,6 +494,8 @@
"
status
"
:
201
,
"
statusText
"
:
"
Created
"
},
"
Post document
"
);
return
sleep
(
100
);
}
function
checkStorageContent
()
{
...
...
@@ -518,6 +535,8 @@
"
status
"
:
204
,
"
statusText
"
:
"
No Content
"
},
"
Update document
"
);
return
sleep
(
100
);
}
function
checkStorageContent3
()
{
...
...
@@ -719,6 +738,8 @@
"
status
"
:
204
,
"
statusText
"
:
"
No Content
"
},
"
Remove document
"
);
return
sleep
(
100
);
}
function
checkStorageContent
()
{
...
...
@@ -1234,12 +1255,12 @@
fake_storage
.
commands
[
"
replicate scenario test for repair method - 1/allDocs
"
].
error
({
"
status
"
:
0
});
},
10
0
);
},
25
0
);
setTimeout
(
function
()
{
fake_storage
.
commands
[
"
replicate scenario test for repair method - 1/allDocs
"
].
error
({
"
status
"
:
0
});
},
2
00
);
},
5
00
);
return
replicate_jio
.
repair
({
"
_id
"
:
"
{
\"
identifier
\"
:[
\"
d
\"
]}
"
});
}
...
...
test/jio/tests.js
View file @
7603944f
...
...
@@ -146,6 +146,11 @@
});
stop
();
setTimeout
(
function
()
{
ok
(
!
called
,
"
callback
"
+
(
called
?
""
:
"
not
"
)
+
"
called
"
);
},
1999
);
jio
.
post
({}).
always
(
function
(
answer
)
{
var
message
=
(
answer
&&
answer
.
message
)
||
"
Timeout
"
;
called
=
true
;
...
...
@@ -168,10 +173,6 @@
commands
[
'
3 No Respons/post
'
].
free
();
},
100
);
setTimeout
(
function
()
{
ok
(
!
called
,
"
callback
"
+
(
called
?
""
:
"
not
"
)
+
"
called
"
);
},
1999
);
i
=
setTimeout
(
function
()
{
i
=
undefined
;
start
();
...
...
@@ -189,6 +190,11 @@
});
stop
();
setTimeout
(
function
()
{
ok
(
!
called
,
"
callback
"
+
(
called
?
""
:
"
not
"
)
+
"
called
"
);
},
2999
);
jio
.
post
({},
{
"
timeout
"
:
3000
}).
always
(
function
(
answer
)
{
var
message
=
(
answer
&&
answer
.
message
)
||
"
Timeout
"
;
called
=
true
;
...
...
@@ -211,10 +217,6 @@
commands
[
'
4 No Respons/post
'
].
free
();
},
1000
);
setTimeout
(
function
()
{
ok
(
!
called
,
"
callback
"
+
(
called
?
""
:
"
not
"
)
+
"
called
"
);
},
2999
);
i
=
setTimeout
(
function
()
{
i
=
undefined
;
start
();
...
...
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