Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
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
Douglas
jio
Commits
bfcd43f9
Commit
bfcd43f9
authored
Apr 22, 2014
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix test timeout issues
parent
099545bf
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 @
bfcd43f9
/*jslint indent: 2, maxlen: 80, nomen: true */
/*jslint indent: 2, maxlen: 80, nomen: true */
/*global define, RSVP, jIO, fake_storage, module, test, stop, start, deepEqual,
/*global define, RSVP, jIO, fake_storage, module, test, stop, start, deepEqual,
setTimeout, clearTimeout, XMLHttpRequest, window */
setTimeout, clearTimeout, XMLHttpRequest, window
, ok
*/
(
function
(
dependencies
,
factory
)
{
(
function
(
dependencies
,
factory
)
{
"
use strict
"
;
"
use strict
"
;
...
@@ -163,7 +163,7 @@
...
@@ -163,7 +163,7 @@
},
"
Get document, nothing to synchronize.
"
);
},
"
Get document, nothing to synchronize.
"
);
// check storage state
// check storage state
return
sleep
(
5
00
).
return
sleep
(
10
00
).
// possible synchronization in background (should not occur)
// possible synchronization in background (should not occur)
then
(
function
()
{
then
(
function
()
{
return
all
(
jio_list
.
map
(
function
(
jio
)
{
return
all
(
jio_list
.
map
(
function
(
jio
)
{
...
@@ -201,11 +201,16 @@
...
@@ -201,11 +201,16 @@
}
}
function
getDocumentWithSynchronizationTest
(
answer
)
{
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
,
{
deepEqual
(
answer
,
{
"
data
"
:
{
"
data
"
:
{
"
_id
"
:
"
{
\"
identifier
\"
:[
\"
b
\"
]}
"
,
"
_id
"
:
"
{
\"
identifier
\"
:[
\"
b
\"
]}
"
,
"
identifier
"
:
"
b
"
,
"
identifier
"
:
"
b
"
"
modified
"
:
shared
.
modified_date_list
[
0
].
toJSON
()
},
},
"
id
"
:
"
{
\"
identifier
\"
:[
\"
b
\"
]}
"
,
"
id
"
:
"
{
\"
identifier
\"
:[
\"
b
\"
]}
"
,
"
method
"
:
"
get
"
,
"
method
"
:
"
get
"
,
...
@@ -215,7 +220,7 @@
...
@@ -215,7 +220,7 @@
},
"
Get document, pending synchronization.
"
);
},
"
Get document, pending synchronization.
"
);
// check storage state
// check storage state
return
sleep
(
5
00
).
return
sleep
(
10
00
).
// synchronizing in background
// synchronizing in background
then
(
function
()
{
then
(
function
()
{
return
all
(
jio_list
.
map
(
function
(
jio
)
{
return
all
(
jio_list
.
map
(
function
(
jio
)
{
...
@@ -251,11 +256,16 @@
...
@@ -251,11 +256,16 @@
}
}
function
getDocumentWith404SynchronizationTest
(
answer
)
{
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
,
{
deepEqual
(
answer
,
{
"
data
"
:
{
"
data
"
:
{
"
_id
"
:
"
{
\"
identifier
\"
:[
\"
c
\"
]}
"
,
"
_id
"
:
"
{
\"
identifier
\"
:[
\"
c
\"
]}
"
,
"
identifier
"
:
"
c
"
,
"
identifier
"
:
"
c
"
"
modified
"
:
shared
.
modified_date_list
[
1
].
toJSON
()
},
},
"
id
"
:
"
{
\"
identifier
\"
:[
\"
c
\"
]}
"
,
"
id
"
:
"
{
\"
identifier
\"
:[
\"
c
\"
]}
"
,
"
method
"
:
"
get
"
,
"
method
"
:
"
get
"
,
...
@@ -265,7 +275,7 @@
...
@@ -265,7 +275,7 @@
},
"
Get document, synchronizing with not found document.
"
);
},
"
Get document, synchronizing with not found document.
"
);
// check storage state
// check storage state
return
sleep
(
5
00
).
return
sleep
(
10
00
).
// synchronizing in background
// synchronizing in background
then
(
function
()
{
then
(
function
()
{
return
all
(
jio_list
.
map
(
function
(
jio
)
{
return
all
(
jio_list
.
map
(
function
(
jio
)
{
...
@@ -309,11 +319,16 @@
...
@@ -309,11 +319,16 @@
}
}
function
getDocumentWithUnavailableStorageTest
(
answer
)
{
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
,
{
deepEqual
(
answer
,
{
"
data
"
:
{
"
data
"
:
{
"
_id
"
:
"
{
\"
identifier
\"
:[
\"
d
\"
]}
"
,
"
_id
"
:
"
{
\"
identifier
\"
:[
\"
d
\"
]}
"
,
"
identifier
"
:
"
d
"
,
"
identifier
"
:
"
d
"
"
modified
"
:
shared
.
modified_date_list
[
1
].
toJSON
()
},
},
"
id
"
:
"
{
\"
identifier
\"
:[
\"
d
\"
]}
"
,
"
id
"
:
"
{
\"
identifier
\"
:[
\"
d
\"
]}
"
,
"
method
"
:
"
get
"
,
"
method
"
:
"
get
"
,
...
@@ -324,7 +339,7 @@
...
@@ -324,7 +339,7 @@
unsetFakeStorage
();
unsetFakeStorage
();
// check storage state
// check storage state
return
sleep
(
5
00
).
return
sleep
(
10
00
).
// synchronizing in background
// synchronizing in background
then
(
function
()
{
then
(
function
()
{
return
all
(
jio_list
.
map
(
function
(
jio
)
{
return
all
(
jio_list
.
map
(
function
(
jio
)
{
...
@@ -479,6 +494,8 @@
...
@@ -479,6 +494,8 @@
"
status
"
:
201
,
"
status
"
:
201
,
"
statusText
"
:
"
Created
"
"
statusText
"
:
"
Created
"
},
"
Post document
"
);
},
"
Post document
"
);
return
sleep
(
100
);
}
}
function
checkStorageContent
()
{
function
checkStorageContent
()
{
...
@@ -518,6 +535,8 @@
...
@@ -518,6 +535,8 @@
"
status
"
:
204
,
"
status
"
:
204
,
"
statusText
"
:
"
No Content
"
"
statusText
"
:
"
No Content
"
},
"
Update document
"
);
},
"
Update document
"
);
return
sleep
(
100
);
}
}
function
checkStorageContent3
()
{
function
checkStorageContent3
()
{
...
@@ -719,6 +738,8 @@
...
@@ -719,6 +738,8 @@
"
status
"
:
204
,
"
status
"
:
204
,
"
statusText
"
:
"
No Content
"
"
statusText
"
:
"
No Content
"
},
"
Remove document
"
);
},
"
Remove document
"
);
return
sleep
(
100
);
}
}
function
checkStorageContent
()
{
function
checkStorageContent
()
{
...
@@ -1234,12 +1255,12 @@
...
@@ -1234,12 +1255,12 @@
fake_storage
.
commands
[
fake_storage
.
commands
[
"
replicate scenario test for repair method - 1/allDocs
"
"
replicate scenario test for repair method - 1/allDocs
"
].
error
({
"
status
"
:
0
});
].
error
({
"
status
"
:
0
});
},
10
0
);
},
25
0
);
setTimeout
(
function
()
{
setTimeout
(
function
()
{
fake_storage
.
commands
[
fake_storage
.
commands
[
"
replicate scenario test for repair method - 1/allDocs
"
"
replicate scenario test for repair method - 1/allDocs
"
].
error
({
"
status
"
:
0
});
].
error
({
"
status
"
:
0
});
},
2
00
);
},
5
00
);
return
replicate_jio
.
repair
({
"
_id
"
:
"
{
\"
identifier
\"
:[
\"
d
\"
]}
"
});
return
replicate_jio
.
repair
({
"
_id
"
:
"
{
\"
identifier
\"
:[
\"
d
\"
]}
"
});
}
}
...
...
test/jio/tests.js
View file @
bfcd43f9
...
@@ -146,6 +146,11 @@
...
@@ -146,6 +146,11 @@
});
});
stop
();
stop
();
setTimeout
(
function
()
{
ok
(
!
called
,
"
callback
"
+
(
called
?
""
:
"
not
"
)
+
"
called
"
);
},
1999
);
jio
.
post
({}).
always
(
function
(
answer
)
{
jio
.
post
({}).
always
(
function
(
answer
)
{
var
message
=
(
answer
&&
answer
.
message
)
||
"
Timeout
"
;
var
message
=
(
answer
&&
answer
.
message
)
||
"
Timeout
"
;
called
=
true
;
called
=
true
;
...
@@ -168,10 +173,6 @@
...
@@ -168,10 +173,6 @@
commands
[
'
3 No Respons/post
'
].
free
();
commands
[
'
3 No Respons/post
'
].
free
();
},
100
);
},
100
);
setTimeout
(
function
()
{
ok
(
!
called
,
"
callback
"
+
(
called
?
""
:
"
not
"
)
+
"
called
"
);
},
1999
);
i
=
setTimeout
(
function
()
{
i
=
setTimeout
(
function
()
{
i
=
undefined
;
i
=
undefined
;
start
();
start
();
...
@@ -189,6 +190,11 @@
...
@@ -189,6 +190,11 @@
});
});
stop
();
stop
();
setTimeout
(
function
()
{
ok
(
!
called
,
"
callback
"
+
(
called
?
""
:
"
not
"
)
+
"
called
"
);
},
2999
);
jio
.
post
({},
{
"
timeout
"
:
3000
}).
always
(
function
(
answer
)
{
jio
.
post
({},
{
"
timeout
"
:
3000
}).
always
(
function
(
answer
)
{
var
message
=
(
answer
&&
answer
.
message
)
||
"
Timeout
"
;
var
message
=
(
answer
&&
answer
.
message
)
||
"
Timeout
"
;
called
=
true
;
called
=
true
;
...
@@ -211,10 +217,6 @@
...
@@ -211,10 +217,6 @@
commands
[
'
4 No Respons/post
'
].
free
();
commands
[
'
4 No Respons/post
'
].
free
();
},
1000
);
},
1000
);
setTimeout
(
function
()
{
ok
(
!
called
,
"
callback
"
+
(
called
?
""
:
"
not
"
)
+
"
called
"
);
},
2999
);
i
=
setTimeout
(
function
()
{
i
=
setTimeout
(
function
()
{
i
=
undefined
;
i
=
undefined
;
start
();
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