summaryrefslogtreecommitdiff
path: root/ext/librethinkdbxx/test/upstream/timeout.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'ext/librethinkdbxx/test/upstream/timeout.yaml')
-rw-r--r--ext/librethinkdbxx/test/upstream/timeout.yaml39
1 files changed, 39 insertions, 0 deletions
diff --git a/ext/librethinkdbxx/test/upstream/timeout.yaml b/ext/librethinkdbxx/test/upstream/timeout.yaml
new file mode 100644
index 00000000..e162b81a
--- /dev/null
+++ b/ext/librethinkdbxx/test/upstream/timeout.yaml
@@ -0,0 +1,39 @@
+desc: Tests timeouts.
+tests:
+ # js timeout tests
+ # Should timeout after the default of 5 seconds
+ - cd: r.js('while(true) {}')
+ ot: err("ReqlQueryLogicError", "JavaScript query `while(true) {}` timed out after 5.000 seconds.", [0])
+
+ - py: r.js('while(true) {}', timeout=1.3)
+ js: r.js('while(true) {}', {timeout:1.3})
+ rb: r.js('while(true) {}', :timeout => 1.3)
+ ot: err("ReqlQueryLogicError", "JavaScript query `while(true) {}` timed out after 1.300 seconds.", [0])
+
+ - py: r.js('while(true) {}', timeout=8)
+ js: r.js('while(true) {}', {timeout:8})
+ rb: r.js('while(true) {}', :timeout => 8)
+ ot: err("ReqlQueryLogicError", "JavaScript query `while(true) {}` timed out after 8.000 seconds.", [0])
+
+ - cd: r.expr('foo').do(r.js('(function(x) { while(true) {} })'))
+ ot: err("ReqlQueryLogicError", "JavaScript query `(function(x) { while(true) {} })` timed out after 5.000 seconds.", [0])
+
+ - py: r.expr('foo').do(r.js('(function(x) { while(true) {} })', timeout=1.3))
+ js: r.expr('foo').do(r.js('(function(x) { while(true) {} })', {timeout:1.3}))
+ rb: r.expr('foo').do(r.js('(function(x) { while(true) {} })', :timeout => 1.3))
+ ot: err("ReqlQueryLogicError", "JavaScript query `(function(x) { while(true) {} })` timed out after 1.300 seconds.", [0])
+
+ - py: r.expr('foo').do(r.js('(function(x) { while(true) {} })', timeout=8))
+ js: r.expr('foo').do(r.js('(function(x) { while(true) {} })', {timeout:8}))
+ rb: r.expr('foo').do(r.js('(function(x) { while(true) {} })', :timeout => 8))
+ ot: err("ReqlQueryLogicError", "JavaScript query `(function(x) { while(true) {} })` timed out after 8.000 seconds.", [0])
+
+ # http timeout tests
+ - py: r.http('httpbin.org/delay/10', timeout=0.8)
+ js: r.http('httpbin.org/delay/10', {timeout:0.8})
+ rb: r.http('httpbin.org/delay/10', {:timeout => 0.8})
+ ot: err("ReqlNonExistenceError", "Error in HTTP GET of `httpbin.org/delay/10`:" + " timed out after 0.800 seconds.", [])
+ - py: r.http('httpbin.org/delay/10', method='PUT', timeout=0.0)
+ js: r.http('httpbin.org/delay/10', {method:'PUT', timeout:0.0})
+ rb: r.http('httpbin.org/delay/10', {:method => 'PUT', :timeout => 0.0})
+ ot: err("ReqlNonExistenceError", "Error in HTTP PUT of `httpbin.org/delay/10`:" + " timed out after 0.000 seconds.", [])