summaryrefslogtreecommitdiff
path: root/ext/librethinkdbxx/test/upstream/sindex/status.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'ext/librethinkdbxx/test/upstream/sindex/status.yaml')
-rw-r--r--ext/librethinkdbxx/test/upstream/sindex/status.yaml76
1 files changed, 76 insertions, 0 deletions
diff --git a/ext/librethinkdbxx/test/upstream/sindex/status.yaml b/ext/librethinkdbxx/test/upstream/sindex/status.yaml
new file mode 100644
index 00000000..401e3ff9
--- /dev/null
+++ b/ext/librethinkdbxx/test/upstream/sindex/status.yaml
@@ -0,0 +1,76 @@
+desc: sindex status
+table_variable_name: tbl2
+tests:
+
+# Index status test on an empty table with two indexes.
+# This is also a regression test for #4868
+ - cd: tbl2.index_create("a")
+ ot: ({'created':1})
+ - cd: tbl2.index_create("b")
+ ot: ({'created':1})
+
+ - cd: tbl2.index_status().count()
+ ot: 2
+ - cd: tbl2.index_status("a").count()
+ ot: 1
+ - cd: tbl2.index_status("b").count()
+ ot: 1
+ - cd: tbl2.index_status("a", "b").count()
+ ot: 2
+
+ - cd: tbl2.index_drop("a")
+ ot: ({'dropped':1})
+ - cd: tbl2.index_drop("b")
+ ot: ({'dropped':1})
+
+# Index status tests with bigger tables for a single index
+
+ - py: tbl2.insert(r.range(0, 5000).map({'a':r.row}))
+ rb: tbl2.insert(r.range(0, 5000).map{|row| {'a':row}})
+ js: tbl2.insert(r.range(0, 5000).map(function(row){ return {'a':row}; }))
+ ot: partial({'inserted':5000})
+
+ - cd: tbl2.index_create("foo")
+ ot: ({'created':1})
+
+ - py: tbl2.index_create("bar", multi=True)
+ js: tbl2.index_create("bar", {multi:true})
+ rb: tbl2.index_create("bar", :multi => true)
+ ot: ({'created':1})
+
+# notice this test is timing based, if it's failing then there's a good chance
+# the problem is just that the index creation finished before we could poll its
+# status.
+ - py: tbl2.index_status().map(lambda x:x["progress"] < 1)
+ rb: tbl2.index_status().map{|x| x["progress"] < 1}
+ js: tbl2.index_status().map(function (x) { return x("progress").lt(1); })
+ ot: [true, true]
+
+ - py: tbl2.index_wait()['ready']
+ rb: tbl2.index_wait()['ready']
+ js: tbl2.index_wait()('ready')
+ ot: ([true, true])
+
+ - py: tbl2.index_wait()['geo']
+ ot: bag([false, false])
+
+ - py: tbl2.index_wait()['multi']
+ ot: bag([false, true])
+
+ - py: tbl2.index_wait()['outdated']
+ ot: ([false, false])
+
+ - cd: tbl2.index_create("quux")
+ ot: ({'created':1})
+
+ - py: tbl2.index_status("quux").do(lambda x:(x[0]["index"] == "quux") & (x[0]["progress"] < 1))
+ rb: tbl2.index_status("quux").do{|x| x[0]["index"].eq("quux") & (x[0]["progress"] < 1)}
+ js: tbl2.index_status("quux").do(function (x) { return x.nth(0)("index").eq("quux").and(x.nth(0)("progress").lt(1)); })
+ ot: true
+
+ - cd: tbl2.index_wait("quux").pluck('index', 'ready')
+ ot: ([{'index':'quux', 'ready':true}])
+
+ - cd: tbl2.index_wait("quux").nth(0).get_field('function').type_of()
+ ot: ("PTYPE<BINARY>")
+