func (suite *MetaTableSuite) TestCases() { suite.T().Log("Running MetaTableSuite: Tests meta queries for creating and deleting tables") // meta/table.yaml line #4 // db = r.db('test') suite.T().Log("Possibly executing: var db r.Term = r.DB('test')") db := r.DB("test") _ = db // Prevent any noused variable errors { // meta/table.yaml line #6 /* [] */ var expected_ []interface{} = []interface{}{} /* db.table_list() */ suite.T().Log("About to run line #6: db.TableList()") runAndAssert(suite.Suite, expected_, db.TableList(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } { // meta/table.yaml line #9 /* ({'type':'DB','name':'rethinkdb','id':null}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"type": "DB", "name": "rethinkdb", "id": nil} /* r.db('rethinkdb').info() */ suite.T().Log("About to run line #9: r.DB('rethinkdb').Info()") runAndAssert(suite.Suite, expected_, r.DB("rethinkdb").Info(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #9") } { // meta/table.yaml line #12 /* partial({'db':{'type':'DB','name':'rethinkdb','id':null}, 'type':'TABLE','id':null,'name':'stats', 'indexes':[],'primary_key':'id'}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"db": map[interface{}]interface{}{"type": "DB", "name": "rethinkdb", "id": nil}, "type": "TABLE", "id": nil, "name": "stats", "indexes": []interface{}{}, "primary_key": "id"}) /* r.db('rethinkdb').table('stats').info() */ suite.T().Log("About to run line #12: r.DB('rethinkdb').Table('stats').Info()") runAndAssert(suite.Suite, expected_, r.DB("rethinkdb").Table("stats").Info(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #12") } { // meta/table.yaml line #18 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db.table_create('a') */ suite.T().Log("About to run line #18: db.TableCreate('a')") runAndAssert(suite.Suite, expected_, db.TableCreate("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #18") } { // meta/table.yaml line #21 /* ['a'] */ var expected_ []interface{} = []interface{}{"a"} /* db.table_list() */ suite.T().Log("About to run line #21: db.TableList()") runAndAssert(suite.Suite, expected_, db.TableList(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #21") } { // meta/table.yaml line #24 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db.table_create('b') */ suite.T().Log("About to run line #24: db.TableCreate('b')") runAndAssert(suite.Suite, expected_, db.TableCreate("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #24") } { // meta/table.yaml line #27 /* bag(['a', 'b']) */ var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{"a", "b"}) /* db.table_list() */ suite.T().Log("About to run line #27: db.TableList()") runAndAssert(suite.Suite, expected_, db.TableList(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #27") } { // meta/table.yaml line #31 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('a') */ suite.T().Log("About to run line #31: db.TableDrop('a')") runAndAssert(suite.Suite, expected_, db.TableDrop("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #31") } { // meta/table.yaml line #34 /* ['b'] */ var expected_ []interface{} = []interface{}{"b"} /* db.table_list() */ suite.T().Log("About to run line #34: db.TableList()") runAndAssert(suite.Suite, expected_, db.TableList(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #34") } { // meta/table.yaml line #37 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('b') */ suite.T().Log("About to run line #37: db.TableDrop('b')") runAndAssert(suite.Suite, expected_, db.TableDrop("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // meta/table.yaml line #40 /* [] */ var expected_ []interface{} = []interface{}{} /* db.table_list() */ suite.T().Log("About to run line #40: db.TableList()") runAndAssert(suite.Suite, expected_, db.TableList(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #40") } { // meta/table.yaml line #44 /* partial({'tables_created':1,'config_changes':[partial({'new_val':partial({'durability':'soft'})})]}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1, "config_changes": []interface{}{compare.PartialMatch(map[interface{}]interface{}{"new_val": compare.PartialMatch(map[interface{}]interface{}{"durability": "soft"})})}}) /* db.table_create('ab', durability='soft') */ suite.T().Log("About to run line #44: db.TableCreate('ab').OptArgs(r.TableCreateOpts{Durability: 'soft', })") runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{Durability: "soft"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #44") } { // meta/table.yaml line #49 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('ab') */ suite.T().Log("About to run line #49: db.TableDrop('ab')") runAndAssert(suite.Suite, expected_, db.TableDrop("ab"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #49") } { // meta/table.yaml line #52 /* partial({'tables_created':1,'config_changes':[partial({'new_val':partial({'durability':'hard'})})]}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1, "config_changes": []interface{}{compare.PartialMatch(map[interface{}]interface{}{"new_val": compare.PartialMatch(map[interface{}]interface{}{"durability": "hard"})})}}) /* db.table_create('ab', durability='hard') */ suite.T().Log("About to run line #52: db.TableCreate('ab').OptArgs(r.TableCreateOpts{Durability: 'hard', })") runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{Durability: "hard"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #52") } { // meta/table.yaml line #57 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('ab') */ suite.T().Log("About to run line #57: db.TableDrop('ab')") runAndAssert(suite.Suite, expected_, db.TableDrop("ab"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #57") } { // meta/table.yaml line #60 /* err('ReqlQueryLogicError', 'Durability option `fake` unrecognized (options are "hard" and "soft").') */ var expected_ Err = err("ReqlQueryLogicError", "Durability option `fake` unrecognized (options are \"hard\" and \"soft\").") /* db.table_create('ab', durability='fake') */ suite.T().Log("About to run line #60: db.TableCreate('ab').OptArgs(r.TableCreateOpts{Durability: 'fake', })") runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{Durability: "fake"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #60") } { // meta/table.yaml line #65 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db.table_create('ab', primary_key='bar', shards=2, replicas=1) */ suite.T().Log("About to run line #65: db.TableCreate('ab').OptArgs(r.TableCreateOpts{PrimaryKey: 'bar', Shards: 2, Replicas: 1, })") runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{PrimaryKey: "bar", Shards: 2, Replicas: 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #65") } { // meta/table.yaml line #70 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('ab') */ suite.T().Log("About to run line #70: db.TableDrop('ab')") runAndAssert(suite.Suite, expected_, db.TableDrop("ab"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #70") } { // meta/table.yaml line #73 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db.table_create('ab', primary_key='bar', primary_replica_tag='default') */ suite.T().Log("About to run line #73: db.TableCreate('ab').OptArgs(r.TableCreateOpts{PrimaryKey: 'bar', PrimaryReplicaTag: 'default', })") runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{PrimaryKey: "bar", PrimaryReplicaTag: "default"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #73") } { // meta/table.yaml line #78 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('ab') */ suite.T().Log("About to run line #78: db.TableDrop('ab')") runAndAssert(suite.Suite, expected_, db.TableDrop("ab"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #78") } { // meta/table.yaml line #81 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db.table_create('ab', nonvoting_replica_tags=['default']) */ suite.T().Log("About to run line #81: db.TableCreate('ab').OptArgs(r.TableCreateOpts{NonVotingReplicaTags: []interface{}{'default'}, })") runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{NonVotingReplicaTags: []interface{}{"default"}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #81") } { // meta/table.yaml line #86 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('ab') */ suite.T().Log("About to run line #86: db.TableDrop('ab')") runAndAssert(suite.Suite, expected_, db.TableDrop("ab"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #86") } { // meta/table.yaml line #90 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db.table_create('a') */ suite.T().Log("About to run line #90: db.TableCreate('a')") runAndAssert(suite.Suite, expected_, db.TableCreate("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #90") } { // meta/table.yaml line #93 /* partial({'reconfigured':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 1}) /* db.table('a').reconfigure(shards=1, replicas=1) */ suite.T().Log("About to run line #93: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 1, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #93") } { // meta/table.yaml line #98 /* partial({'reconfigured':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 1}) /* db.table('a').reconfigure(shards=1, replicas={"default":1}, nonvoting_replica_tags=['default'], primary_replica_tag='default') */ suite.T().Log("About to run line #98: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': 1, }, NonVotingReplicaTags: []interface{}{'default'}, PrimaryReplicaTag: 'default', })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": 1}, NonVotingReplicaTags: []interface{}{"default"}, PrimaryReplicaTag: "default"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #98") } { // meta/table.yaml line #103 /* partial({'reconfigured':0}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 0}) /* db.table('a').reconfigure(shards=1, replicas=1, dry_run=True) */ suite.T().Log("About to run line #103: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 1, DryRun: true, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 1, DryRun: true}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #103") } { // meta/table.yaml line #108 /* err('ReqlOpFailedError', 'This table doesn\'t need to be repaired.', []) */ var expected_ Err = err("ReqlOpFailedError", "This table doesn't need to be repaired.") /* db.table('a').reconfigure(emergency_repair="unsafe_rollback") */ suite.T().Log("About to run line #108: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'unsafe_rollback', })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "unsafe_rollback"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #108") } { // meta/table.yaml line #113 /* err('ReqlOpFailedError', 'This table doesn\'t need to be repaired.', []) */ var expected_ Err = err("ReqlOpFailedError", "This table doesn't need to be repaired.") /* db.table('a').reconfigure(emergency_repair="unsafe_rollback", dry_run=True) */ suite.T().Log("About to run line #113: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'unsafe_rollback', DryRun: true, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "unsafe_rollback", DryRun: true}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #113") } { // meta/table.yaml line #118 /* err('ReqlOpFailedError', 'This table doesn\'t need to be repaired.', []) */ var expected_ Err = err("ReqlOpFailedError", "This table doesn't need to be repaired.") /* db.table('a').reconfigure(emergency_repair="unsafe_rollback_or_erase") */ suite.T().Log("About to run line #118: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'unsafe_rollback_or_erase', })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "unsafe_rollback_or_erase"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #118") } { // meta/table.yaml line #123 /* partial({'reconfigured':0}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 0}) /* db.table('a').reconfigure(emergency_repair=None, shards=1, replicas=1, dry_run=True) */ suite.T().Log("About to run line #123: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: nil, Shards: 1, Replicas: 1, DryRun: true, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: nil, Shards: 1, Replicas: 1, DryRun: true}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #123") } { // meta/table.yaml line #128 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('a') */ suite.T().Log("About to run line #128: db.TableDrop('a')") runAndAssert(suite.Suite, expected_, db.TableDrop("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #128") } { // meta/table.yaml line #132 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db.table_create('foo') */ suite.T().Log("About to run line #132: db.TableCreate('foo')") runAndAssert(suite.Suite, expected_, db.TableCreate("foo"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #132") } { // meta/table.yaml line #135 /* err('ReqlOpFailedError', 'Table `test.foo` already exists.', [0]) */ var expected_ Err = err("ReqlOpFailedError", "Table `test.foo` already exists.") /* db.table_create('foo') */ suite.T().Log("About to run line #135: db.TableCreate('foo')") runAndAssert(suite.Suite, expected_, db.TableCreate("foo"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #135") } { // meta/table.yaml line #138 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('foo') */ suite.T().Log("About to run line #138: db.TableDrop('foo')") runAndAssert(suite.Suite, expected_, db.TableDrop("foo"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #138") } { // meta/table.yaml line #141 /* err('ReqlOpFailedError', 'Table `test.foo` does not exist.', [0]) */ var expected_ Err = err("ReqlOpFailedError", "Table `test.foo` does not exist.") /* db.table_drop('foo') */ suite.T().Log("About to run line #141: db.TableDrop('foo')") runAndAssert(suite.Suite, expected_, db.TableDrop("foo"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #141") } { // meta/table.yaml line #158 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db.table_create('a') */ suite.T().Log("About to run line #158: db.TableCreate('a')") runAndAssert(suite.Suite, expected_, db.TableCreate("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #158") } { // meta/table.yaml line #161 /* err('ReqlQueryLogicError', 'Every table must have at least one shard.', []) */ var expected_ Err = err("ReqlQueryLogicError", "Every table must have at least one shard.") /* db.table('a').reconfigure(shards=0, replicas=1) */ suite.T().Log("About to run line #161: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 0, Replicas: 1, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 0, Replicas: 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #161") } { // meta/table.yaml line #166 /* err('ReqlOpFailedError', 'Can\'t use server tag `foo` for primary replicas because you specified no replicas in server tag `foo`.', []) */ var expected_ Err = err("ReqlOpFailedError", "Can't use server tag `foo` for primary replicas because you specified no replicas in server tag `foo`.") /* db.table('a').reconfigure(shards=1, replicas={"default":1}, primary_replica_tag="foo") */ suite.T().Log("About to run line #166: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': 1, }, PrimaryReplicaTag: 'foo', })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": 1}, PrimaryReplicaTag: "foo"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #166") } { // meta/table.yaml line #171 /* err('ReqlOpFailedError', 'You specified that the replicas in server tag `foo` should be non-voting, but you didn\'t specify a number of replicas in server tag `foo`.', []) */ var expected_ Err = err("ReqlOpFailedError", "You specified that the replicas in server tag `foo` should be non-voting, but you didn't specify a number of replicas in server tag `foo`.") /* db.table('a').reconfigure(shards=1, replicas={"default":1}, primary_replica_tag="default", nonvoting_replica_tags=["foo"]) */ suite.T().Log("About to run line #171: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': 1, }, PrimaryReplicaTag: 'default', NonVotingReplicaTags: []interface{}{'foo'}, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": 1}, PrimaryReplicaTag: "default", NonVotingReplicaTags: []interface{}{"foo"}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #171") } { // meta/table.yaml line #176 /* err('ReqlOpFailedError', 'You must set `replicas` to at least one. `replicas` includes the primary replica; if there are zero replicas, there is nowhere to put the data.', []) */ var expected_ Err = err("ReqlOpFailedError", "You must set `replicas` to at least one. `replicas` includes the primary replica; if there are zero replicas, there is nowhere to put the data.") /* db.table('a').reconfigure(shards=1, replicas={"foo":0}, primary_replica_tag="foo") */ suite.T().Log("About to run line #176: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'foo': 0, }, PrimaryReplicaTag: 'foo', })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"foo": 0}, PrimaryReplicaTag: "foo"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #176") } { // meta/table.yaml line #181 /* err('ReqlQueryLogicError', '`primary_replica_tag` must be specified when `replicas` is an OBJECT.', []) */ var expected_ Err = err("ReqlQueryLogicError", "`primary_replica_tag` must be specified when `replicas` is an OBJECT.") /* db.table('a').reconfigure(shards=1, replicas={"default":0}) */ suite.T().Log("About to run line #181: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': 0, }, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": 0}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #181") } { // meta/table.yaml line #186 /* err('ReqlQueryLogicError', 'Can\'t have a negative number of replicas', []) */ var expected_ Err = err("ReqlQueryLogicError", "Can't have a negative number of replicas") /* db.table('a').reconfigure(shards=1, replicas={"default":-3}, primary_replica_tag='default') */ suite.T().Log("About to run line #186: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': -3, }, PrimaryReplicaTag: 'default', })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": -3}, PrimaryReplicaTag: "default"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #186") } { // meta/table.yaml line #191 /* err('ReqlQueryLogicError', '`replicas` must be an OBJECT if `primary_replica_tag` is specified.', []) */ var expected_ Err = err("ReqlQueryLogicError", "`replicas` must be an OBJECT if `primary_replica_tag` is specified.") /* db.table('a').reconfigure(shards=1, replicas=3, primary_replica_tag='foo') */ suite.T().Log("About to run line #191: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, PrimaryReplicaTag: 'foo', })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, PrimaryReplicaTag: "foo"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #191") } { // meta/table.yaml line #196 /* err('ReqlQueryLogicError', '`replicas` must be an OBJECT if `nonvoting_replica_tags` is specified.', []) */ var expected_ Err = err("ReqlQueryLogicError", "`replicas` must be an OBJECT if `nonvoting_replica_tags` is specified.") /* db.table('a').reconfigure(shards=1, replicas=3, nonvoting_replica_tags=['foo']) */ suite.T().Log("About to run line #196: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, NonVotingReplicaTags: []interface{}{'foo'}, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, NonVotingReplicaTags: []interface{}{"foo"}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #196") } { // meta/table.yaml line #201 /* err('ReqlQueryLogicError', 'Can\'t emergency repair an entire database at once; instead you should run `reconfigure()` on each table individually.') */ var expected_ Err = err("ReqlQueryLogicError", "Can't emergency repair an entire database at once; instead you should run `reconfigure()` on each table individually.") /* db.reconfigure(emergency_repair="unsafe_rollback") */ suite.T().Log("About to run line #201: db.Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'unsafe_rollback', })") runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "unsafe_rollback"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #201") } { // meta/table.yaml line #206 /* err('ReqlQueryLogicError', '`emergency_repair` should be "unsafe_rollback" or "unsafe_rollback_or_erase"', []) */ var expected_ Err = err("ReqlQueryLogicError", "`emergency_repair` should be \"unsafe_rollback\" or \"unsafe_rollback_or_erase\"") /* db.table('a').reconfigure(emergency_repair="foo") */ suite.T().Log("About to run line #206: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'foo', })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "foo"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #206") } { // meta/table.yaml line #211 /* err('ReqlQueryLogicError', 'In emergency repair mode, you can\'t specify shards, replicas, etc.') */ var expected_ Err = err("ReqlQueryLogicError", "In emergency repair mode, you can't specify shards, replicas, etc.") /* db.table('a').reconfigure(emergency_repair="unsafe_rollback", shards=1, replicas=1) */ suite.T().Log("About to run line #211: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'unsafe_rollback', Shards: 1, Replicas: 1, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "unsafe_rollback", Shards: 1, Replicas: 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #211") } { // meta/table.yaml line #217 /* partial({'reconfigured':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 1}) /* db.table('a').reconfigure(shards=2, replicas=1) */ suite.T().Log("About to run line #217: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #217") } { // meta/table.yaml line #222 /* {"ready":1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"ready": 1} /* db.table('a').wait(wait_for="all_replicas_ready") */ suite.T().Log("About to run line #222: db.Table('a').Wait().OptArgs(r.WaitOpts{WaitFor: 'all_replicas_ready', })") runAndAssert(suite.Suite, expected_, db.Table("a").Wait().OptArgs(r.WaitOpts{WaitFor: "all_replicas_ready"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #222") } { // meta/table.yaml line #228 /* partial({"inserted":4}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"inserted": 4}) /* db.table('a').insert([{"id":1}, {"id":2}, {"id":3}, {"id":4}]) */ suite.T().Log("About to run line #228: db.Table('a').Insert([]interface{}{map[interface{}]interface{}{'id': 1, }, map[interface{}]interface{}{'id': 2, }, map[interface{}]interface{}{'id': 3, }, map[interface{}]interface{}{'id': 4, }})") runAndAssert(suite.Suite, expected_, db.Table("a").Insert([]interface{}{map[interface{}]interface{}{"id": 1}, map[interface{}]interface{}{"id": 2}, map[interface{}]interface{}{"id": 3}, map[interface{}]interface{}{"id": 4}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #228") } { // meta/table.yaml line #233 /* partial({'reconfigured':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 1}) /* db.table('a').reconfigure(shards=2, replicas=1) */ suite.T().Log("About to run line #233: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #233") } { // meta/table.yaml line #238 /* err('ReqlOpFailedError', 'Can\'t put 2 replicas on servers with the tag `default` because there are only 1 servers with the tag `default`. It\'s impossible to have more replicas of the data than there are servers.', []) */ var expected_ Err = err("ReqlOpFailedError", "Can't put 2 replicas on servers with the tag `default` because there are only 1 servers with the tag `default`. It's impossible to have more replicas of the data than there are servers.") /* db.table('a').reconfigure(shards=1, replicas=2) */ suite.T().Log("About to run line #238: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 2, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 2}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #238") } { // meta/table.yaml line #244 /* {"ready":1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"ready": 1} /* db.table('a').wait(wait_for="all_replicas_ready") */ suite.T().Log("About to run line #244: db.Table('a').Wait().OptArgs(r.WaitOpts{WaitFor: 'all_replicas_ready', })") runAndAssert(suite.Suite, expected_, db.Table("a").Wait().OptArgs(r.WaitOpts{WaitFor: "all_replicas_ready"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #244") } { // meta/table.yaml line #248 /* partial({'rebalanced':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"rebalanced": 1}) /* db.table('a').rebalance() */ suite.T().Log("About to run line #248: db.Table('a').Rebalance()") runAndAssert(suite.Suite, expected_, db.Table("a").Rebalance(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #248") } { // meta/table.yaml line #251 /* {"ready":1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"ready": 1} /* db.wait(wait_for="all_replicas_ready") */ suite.T().Log("About to run line #251: db.Wait().OptArgs(r.WaitOpts{WaitFor: 'all_replicas_ready', })") runAndAssert(suite.Suite, expected_, db.Wait().OptArgs(r.WaitOpts{WaitFor: "all_replicas_ready"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #251") } { // meta/table.yaml line #255 /* partial({'rebalanced':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"rebalanced": 1}) /* db.rebalance() */ suite.T().Log("About to run line #255: db.Rebalance()") runAndAssert(suite.Suite, expected_, db.Rebalance(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #255") } { // meta/table.yaml line #271 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('a') */ suite.T().Log("About to run line #271: db.TableDrop('a')") runAndAssert(suite.Suite, expected_, db.TableDrop("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #271") } { // meta/table.yaml line #275 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* db.table_create('a') */ suite.T().Log("About to run line #275: db.TableCreate('a')") runAndAssert(suite.Suite, expected_, db.TableCreate("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #275") } { // meta/table.yaml line #276 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* db.table_create('b') */ suite.T().Log("About to run line #276: db.TableCreate('b')") runAndAssert(suite.Suite, expected_, db.TableCreate("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #276") } { // meta/table.yaml line #277 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* db.table_create('c') */ suite.T().Log("About to run line #277: db.TableCreate('c')") runAndAssert(suite.Suite, expected_, db.TableCreate("c"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #277") } { // meta/table.yaml line #279 /* err('ReqlQueryLogicError', 'Every table must have at least one shard.', []) */ var expected_ Err = err("ReqlQueryLogicError", "Every table must have at least one shard.") /* db.reconfigure(shards=0, replicas=1) */ suite.T().Log("About to run line #279: db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 0, Replicas: 1, })") runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 0, Replicas: 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #279") } { // meta/table.yaml line #284 /* err('ReqlQueryLogicError', '`primary_replica_tag` must be specified when `replicas` is an OBJECT.', []) */ var expected_ Err = err("ReqlQueryLogicError", "`primary_replica_tag` must be specified when `replicas` is an OBJECT.") /* db.reconfigure(shards=1, replicas={"default":0}) */ suite.T().Log("About to run line #284: db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': 0, }, })") runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": 0}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #284") } { // meta/table.yaml line #289 /* err('ReqlQueryLogicError', 'Can\'t have a negative number of replicas', []) */ var expected_ Err = err("ReqlQueryLogicError", "Can't have a negative number of replicas") /* db.reconfigure(shards=1, replicas={"default":-3}, primary_replica_tag='default') */ suite.T().Log("About to run line #289: db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': -3, }, PrimaryReplicaTag: 'default', })") runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": -3}, PrimaryReplicaTag: "default"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #289") } { // meta/table.yaml line #294 /* err('ReqlQueryLogicError', '`replicas` must be an OBJECT if `primary_replica_tag` is specified.', []) */ var expected_ Err = err("ReqlQueryLogicError", "`replicas` must be an OBJECT if `primary_replica_tag` is specified.") /* db.reconfigure(shards=1, replicas=3, primary_replica_tag='foo') */ suite.T().Log("About to run line #294: db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, PrimaryReplicaTag: 'foo', })") runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, PrimaryReplicaTag: "foo"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #294") } { // meta/table.yaml line #299 /* partial({'reconfigured':3}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 3}) /* db.reconfigure(shards=2, replicas=1) */ suite.T().Log("About to run line #299: db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1, })") runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #299") } { // meta/table.yaml line #304 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('a') */ suite.T().Log("About to run line #304: db.TableDrop('a')") runAndAssert(suite.Suite, expected_, db.TableDrop("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #304") } { // meta/table.yaml line #306 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('b') */ suite.T().Log("About to run line #306: db.TableDrop('b')") runAndAssert(suite.Suite, expected_, db.TableDrop("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #306") } { // meta/table.yaml line #308 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('c') */ suite.T().Log("About to run line #308: db.TableDrop('c')") runAndAssert(suite.Suite, expected_, db.TableDrop("c"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #308") } { // meta/table.yaml line #312 /* partial({'dbs_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_created": 1}) /* r.db_create("test2") */ suite.T().Log("About to run line #312: r.DBCreate('test2')") runAndAssert(suite.Suite, expected_, r.DBCreate("test2"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #312") } // meta/table.yaml line #315 // db2 = r.db("test2") suite.T().Log("Possibly executing: var db2 r.Term = r.DB('test2')") db2 := r.DB("test2") _ = db2 // Prevent any noused variable errors { // meta/table.yaml line #317 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db.table_create("testA") */ suite.T().Log("About to run line #317: db.TableCreate('testA')") runAndAssert(suite.Suite, expected_, db.TableCreate("testA"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #317") } { // meta/table.yaml line #319 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db.table_create("testB") */ suite.T().Log("About to run line #319: db.TableCreate('testB')") runAndAssert(suite.Suite, expected_, db.TableCreate("testB"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #319") } { // meta/table.yaml line #321 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db2.table_create("test2B") */ suite.T().Log("About to run line #321: db2.TableCreate('test2B')") runAndAssert(suite.Suite, expected_, db2.TableCreate("test2B"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #321") } { // meta/table.yaml line #324 /* {'db':'test','name':'testA'} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"db": "test", "name": "testA"} /* r.table('testA').config().pluck('db','name') */ suite.T().Log("About to run line #324: r.Table('testA').Config().Pluck('db', 'name')") runAndAssert(suite.Suite, expected_, r.Table("testA").Config().Pluck("db", "name"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #324") } { // meta/table.yaml line #327 /* err('ReqlOpFailedError', 'Table `test.doesntexist` does not exist.', []) */ var expected_ Err = err("ReqlOpFailedError", "Table `test.doesntexist` does not exist.") /* r.table('doesntexist').config() */ suite.T().Log("About to run line #327: r.Table('doesntexist').Config()") runAndAssert(suite.Suite, expected_, r.Table("doesntexist").Config(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #327") } { // meta/table.yaml line #330 /* err('ReqlOpFailedError', 'Table `test.test2B` does not exist.', []) */ var expected_ Err = err("ReqlOpFailedError", "Table `test.test2B` does not exist.") /* r.table('test2B').config() */ suite.T().Log("About to run line #330: r.Table('test2B').Config()") runAndAssert(suite.Suite, expected_, r.Table("test2B").Config(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #330") } { // meta/table.yaml line #333 /* True */ var expected_ bool = true /* r.db('rethinkdb').table('table_config').filter({'name':'testA'}).nth(0).eq(r.table('testA').config()) */ suite.T().Log("About to run line #333: r.DB('rethinkdb').Table('table_config').Filter(map[interface{}]interface{}{'name': 'testA', }).Nth(0).Eq(r.Table('testA').Config())") runAndAssert(suite.Suite, expected_, r.DB("rethinkdb").Table("table_config").Filter(map[interface{}]interface{}{"name": "testA"}).Nth(0).Eq(r.Table("testA").Config()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #333") } { // meta/table.yaml line #336 /* True */ var expected_ bool = true /* r.db('rethinkdb').table('table_status').filter({'name':'testA'}).nth(0).eq(r.table('testA').status()) */ suite.T().Log("About to run line #336: r.DB('rethinkdb').Table('table_status').Filter(map[interface{}]interface{}{'name': 'testA', }).Nth(0).Eq(r.Table('testA').Status())") runAndAssert(suite.Suite, expected_, r.DB("rethinkdb").Table("table_status").Filter(map[interface{}]interface{}{"name": "testA"}).Nth(0).Eq(r.Table("testA").Status()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #336") } { // meta/table.yaml line #339 /* uuid() */ var expected_ compare.Regex = compare.IsUUID() /* r.db('rethinkdb').table('table_config', identifier_format='uuid').nth(0)["db"] */ suite.T().Log("About to run line #339: r.DB('rethinkdb').Table('table_config').OptArgs(r.TableOpts{IdentifierFormat: 'uuid', }).Nth(0).AtIndex('db')") runAndAssert(suite.Suite, expected_, r.DB("rethinkdb").Table("table_config").OptArgs(r.TableOpts{IdentifierFormat: "uuid"}).Nth(0).AtIndex("db"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #339") } { // meta/table.yaml line #344 /* 0 */ var expected_ int = 0 /* r.table('testA', identifier_format='uuid').count() */ suite.T().Log("About to run line #344: r.Table('testA').OptArgs(r.TableOpts{IdentifierFormat: 'uuid', }).Count()") runAndAssert(suite.Suite, expected_, r.Table("testA").OptArgs(r.TableOpts{IdentifierFormat: "uuid"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #344") } { // meta/table.yaml line #358 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('testA') */ suite.T().Log("About to run line #358: db.TableDrop('testA')") runAndAssert(suite.Suite, expected_, db.TableDrop("testA"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #358") } { // meta/table.yaml line #361 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('testB') */ suite.T().Log("About to run line #361: db.TableDrop('testB')") runAndAssert(suite.Suite, expected_, db.TableDrop("testB"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #361") } { // meta/table.yaml line #364 /* partial({'dbs_dropped':1,'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_dropped": 1, "tables_dropped": 1}) /* r.db_drop('test2') */ suite.T().Log("About to run line #364: r.DBDrop('test2')") runAndAssert(suite.Suite, expected_, r.DBDrop("test2"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #364") } }
func (suite *ChangefeedsIdxcopySuite) TestCases() { suite.T().Log("Running ChangefeedsIdxcopySuite: Test duplicate indexes with squashing") tbl := r.DB("test").Table("tbl") _ = tbl // Prevent any noused variable errors { // changefeeds/idxcopy.yaml line #4 /* partial({'created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"created": 1}) /* tbl.index_create('a') */ suite.T().Log("About to run line #4: tbl.IndexCreate('a')") runAndAssert(suite.Suite, expected_, tbl.IndexCreate("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #4") } { // changefeeds/idxcopy.yaml line #6 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* tbl.index_wait('a') */ suite.T().Log("About to run line #6: tbl.IndexWait('a')") runAndAssert(suite.Suite, expected_, tbl.IndexWait("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } // changefeeds/idxcopy.yaml line #8 // feed = tbl.order_by(index='a').limit(10).changes(squash=2).limit(9) suite.T().Log("Possibly executing: var feed r.Term = tbl.OrderBy().OptArgs(r.OrderByOpts{Index: 'a', }).Limit(10).Changes().OptArgs(r.ChangesOpts{Squash: 2, }).Limit(9)") feed := maybeRun(tbl.OrderBy().OptArgs(r.OrderByOpts{Index: "a"}).Limit(10).Changes().OptArgs(r.ChangesOpts{Squash: 2}).Limit(9), suite.session, r.RunOpts{ MaxBatchRows: 1, }) _ = feed // Prevent any noused variable errors { // changefeeds/idxcopy.yaml line #15 /* partial({'inserted':12, 'errors':0}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"inserted": 12, "errors": 0}) /* tbl.insert(r.range(0, 12).map({'id':r.row, 'a':5})) */ suite.T().Log("About to run line #15: tbl.Insert(r.Range(0, 12).Map(map[interface{}]interface{}{'id': r.Row, 'a': 5, }))") runAndAssert(suite.Suite, expected_, tbl.Insert(r.Range(0, 12).Map(map[interface{}]interface{}{"id": r.Row, "a": 5})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #15") } { // changefeeds/idxcopy.yaml line #20 /* partial({'deleted':3, 'errors':0}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"deleted": 3, "errors": 0}) /* tbl.get_all(1, 8, 9, index='id').delete() */ suite.T().Log("About to run line #20: tbl.GetAll(1, 8, 9).OptArgs(r.GetAllOpts{Index: 'id', }).Delete()") runAndAssert(suite.Suite, expected_, tbl.GetAll(1, 8, 9).OptArgs(r.GetAllOpts{Index: "id"}).Delete(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #20") } { // changefeeds/idxcopy.yaml line #26 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* wait(2) */ suite.T().Log("About to run line #26: wait(2)") actual := wait(2) compare.Assert(suite.T(), expected_, actual) suite.T().Log("Finished running line #26") } { // changefeeds/idxcopy.yaml line #28 /* bag([ {"new_val":{"a":5, "id":0}, "old_val":nil}, {"new_val":{"a":5, "id":2}, "old_val":nil}, {"new_val":{"a":5, "id":3}, "old_val":nil}, {"new_val":{"a":5, "id":4}, "old_val":nil}, {"new_val":{"a":5, "id":5}, "old_val":nil}, {"new_val":{"a":5, "id":6}, "old_val":nil}, {"new_val":{"a":5, "id":7}, "old_val":nil}, {"new_val":{"a":5, "id":10}, "old_val":nil}, {"new_val":{"a":5, "id":11}, "old_val":nil}]) */ var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 5, "id": 0}, "old_val": nil}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 5, "id": 2}, "old_val": nil}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 5, "id": 3}, "old_val": nil}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 5, "id": 4}, "old_val": nil}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 5, "id": 5}, "old_val": nil}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 5, "id": 6}, "old_val": nil}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 5, "id": 7}, "old_val": nil}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 5, "id": 10}, "old_val": nil}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 5, "id": 11}, "old_val": nil}}) /* fetch(feed) */ suite.T().Log("About to run line #28: fetch(feed, 0)") fetchAndAssert(suite.Suite, expected_, feed, 0) suite.T().Log("Finished running line #28") } }
func (suite *MetaDbsSuite) TestCases() { suite.T().Log("Running MetaDbsSuite: Tests meta queries for databases") { // meta/dbs.yaml line #6 /* bag(['rethinkdb', 'test']) */ var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{"rethinkdb", "test"}) /* r.db_list() */ suite.T().Log("About to run line #6: r.DBList()") runAndAssert(suite.Suite, expected_, r.DBList(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } { // meta/dbs.yaml line #11 /* partial({'dbs_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_created": 1}) /* r.db_create('a') */ suite.T().Log("About to run line #11: r.DBCreate('a')") runAndAssert(suite.Suite, expected_, r.DBCreate("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #11") } { // meta/dbs.yaml line #13 /* partial({'dbs_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_created": 1}) /* r.db_create('b') */ suite.T().Log("About to run line #13: r.DBCreate('b')") runAndAssert(suite.Suite, expected_, r.DBCreate("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #13") } { // meta/dbs.yaml line #18 /* bag(['rethinkdb', 'a', 'b', 'test']) */ var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{"rethinkdb", "a", "b", "test"}) /* r.db_list() */ suite.T().Log("About to run line #18: r.DBList()") runAndAssert(suite.Suite, expected_, r.DBList(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #18") } { // meta/dbs.yaml line #23 /* {'name':'a','id':uuid()} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"name": "a", "id": compare.IsUUID()} /* r.db('a').config() */ suite.T().Log("About to run line #23: r.DB('a').Config()") runAndAssert(suite.Suite, expected_, r.DB("a").Config(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #23") } { // meta/dbs.yaml line #28 /* partial({'dbs_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_dropped": 1}) /* r.db_drop('b') */ suite.T().Log("About to run line #28: r.DBDrop('b')") runAndAssert(suite.Suite, expected_, r.DBDrop("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #28") } { // meta/dbs.yaml line #31 /* bag(['rethinkdb', 'a', 'test']) */ var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{"rethinkdb", "a", "test"}) /* r.db_list() */ suite.T().Log("About to run line #31: r.DBList()") runAndAssert(suite.Suite, expected_, r.DBList(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #31") } { // meta/dbs.yaml line #34 /* partial({'dbs_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_dropped": 1}) /* r.db_drop('a') */ suite.T().Log("About to run line #34: r.DBDrop('a')") runAndAssert(suite.Suite, expected_, r.DBDrop("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #34") } { // meta/dbs.yaml line #37 /* bag(['rethinkdb', 'test']) */ var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{"rethinkdb", "test"}) /* r.db_list() */ suite.T().Log("About to run line #37: r.DBList()") runAndAssert(suite.Suite, expected_, r.DBList(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // meta/dbs.yaml line #41 /* partial({'dbs_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_created": 1}) /* r.db_create('bar') */ suite.T().Log("About to run line #41: r.DBCreate('bar')") runAndAssert(suite.Suite, expected_, r.DBCreate("bar"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #41") } { // meta/dbs.yaml line #44 /* err('ReqlOpFailedError', 'Database `bar` already exists.', [0]) */ var expected_ Err = err("ReqlOpFailedError", "Database `bar` already exists.") /* r.db_create('bar') */ suite.T().Log("About to run line #44: r.DBCreate('bar')") runAndAssert(suite.Suite, expected_, r.DBCreate("bar"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #44") } { // meta/dbs.yaml line #47 /* partial({'dbs_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_dropped": 1}) /* r.db_drop('bar') */ suite.T().Log("About to run line #47: r.DBDrop('bar')") runAndAssert(suite.Suite, expected_, r.DBDrop("bar"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #47") } { // meta/dbs.yaml line #50 /* err('ReqlOpFailedError', 'Database `bar` does not exist.', [0]) */ var expected_ Err = err("ReqlOpFailedError", "Database `bar` does not exist.") /* r.db_drop('bar') */ suite.T().Log("About to run line #50: r.DBDrop('bar')") runAndAssert(suite.Suite, expected_, r.DBDrop("bar"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #50") } }
func (suite *SindexStatusSuite) TestCases() { suite.T().Log("Running SindexStatusSuite: sindex status") tbl2 := r.DB("test").Table("tbl2") _ = tbl2 // Prevent any noused variable errors { // sindex/status.yaml line #7 /* ({'created':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1} /* tbl2.index_create("a") */ suite.T().Log("About to run line #7: tbl2.IndexCreate('a')") runAndAssert(suite.Suite, expected_, tbl2.IndexCreate("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #7") } { // sindex/status.yaml line #9 /* ({'created':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1} /* tbl2.index_create("b") */ suite.T().Log("About to run line #9: tbl2.IndexCreate('b')") runAndAssert(suite.Suite, expected_, tbl2.IndexCreate("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #9") } { // sindex/status.yaml line #12 /* 2 */ var expected_ int = 2 /* tbl2.index_status().count() */ suite.T().Log("About to run line #12: tbl2.IndexStatus().Count()") runAndAssert(suite.Suite, expected_, tbl2.IndexStatus().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #12") } { // sindex/status.yaml line #14 /* 1 */ var expected_ int = 1 /* tbl2.index_status("a").count() */ suite.T().Log("About to run line #14: tbl2.IndexStatus('a').Count()") runAndAssert(suite.Suite, expected_, tbl2.IndexStatus("a").Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #14") } { // sindex/status.yaml line #16 /* 1 */ var expected_ int = 1 /* tbl2.index_status("b").count() */ suite.T().Log("About to run line #16: tbl2.IndexStatus('b').Count()") runAndAssert(suite.Suite, expected_, tbl2.IndexStatus("b").Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #16") } { // sindex/status.yaml line #18 /* 2 */ var expected_ int = 2 /* tbl2.index_status("a", "b").count() */ suite.T().Log("About to run line #18: tbl2.IndexStatus('a', 'b').Count()") runAndAssert(suite.Suite, expected_, tbl2.IndexStatus("a", "b").Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #18") } { // sindex/status.yaml line #21 /* ({'dropped':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"dropped": 1} /* tbl2.index_drop("a") */ suite.T().Log("About to run line #21: tbl2.IndexDrop('a')") runAndAssert(suite.Suite, expected_, tbl2.IndexDrop("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #21") } { // sindex/status.yaml line #23 /* ({'dropped':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"dropped": 1} /* tbl2.index_drop("b") */ suite.T().Log("About to run line #23: tbl2.IndexDrop('b')") runAndAssert(suite.Suite, expected_, tbl2.IndexDrop("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #23") } { // sindex/status.yaml line #28 /* partial({'inserted':5000}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"inserted": 5000}) /* tbl2.insert(r.range(0, 5000).map({'a':r.row})) */ suite.T().Log("About to run line #28: tbl2.Insert(r.Range(0, 5000).Map(map[interface{}]interface{}{'a': r.Row, }))") runAndAssert(suite.Suite, expected_, tbl2.Insert(r.Range(0, 5000).Map(map[interface{}]interface{}{"a": r.Row})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #28") } { // sindex/status.yaml line #33 /* ({'created':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1} /* tbl2.index_create("foo") */ suite.T().Log("About to run line #33: tbl2.IndexCreate('foo')") runAndAssert(suite.Suite, expected_, tbl2.IndexCreate("foo"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #33") } { // sindex/status.yaml line #36 /* ({'created':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1} /* tbl2.index_create("bar", multi=True) */ suite.T().Log("About to run line #36: tbl2.IndexCreate('bar').OptArgs(r.IndexCreateOpts{Multi: true, })") runAndAssert(suite.Suite, expected_, tbl2.IndexCreate("bar").OptArgs(r.IndexCreateOpts{Multi: true}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #36") } { // sindex/status.yaml line #44 /* [true, true] */ var expected_ []interface{} = []interface{}{true, true} /* tbl2.index_status().map(lambda x:x["progress"] < 1) */ suite.T().Log("About to run line #44: tbl2.IndexStatus().Map(func(x r.Term) interface{} { return x.AtIndex('progress').Lt(1)})") runAndAssert(suite.Suite, expected_, tbl2.IndexStatus().Map(func(x r.Term) interface{} { return x.AtIndex("progress").Lt(1) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #44") } { // sindex/status.yaml line #49 /* ([true, true]) */ var expected_ []interface{} = []interface{}{true, true} /* tbl2.index_wait()['ready'] */ suite.T().Log("About to run line #49: tbl2.IndexWait().AtIndex('ready')") runAndAssert(suite.Suite, expected_, tbl2.IndexWait().AtIndex("ready"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #49") } { // sindex/status.yaml line #54 /* bag([false, false]) */ var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{false, false}) /* tbl2.index_wait()['geo'] */ suite.T().Log("About to run line #54: tbl2.IndexWait().AtIndex('geo')") runAndAssert(suite.Suite, expected_, tbl2.IndexWait().AtIndex("geo"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #54") } { // sindex/status.yaml line #57 /* bag([false, true]) */ var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{false, true}) /* tbl2.index_wait()['multi'] */ suite.T().Log("About to run line #57: tbl2.IndexWait().AtIndex('multi')") runAndAssert(suite.Suite, expected_, tbl2.IndexWait().AtIndex("multi"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #57") } { // sindex/status.yaml line #60 /* ([false, false]) */ var expected_ []interface{} = []interface{}{false, false} /* tbl2.index_wait()['outdated'] */ suite.T().Log("About to run line #60: tbl2.IndexWait().AtIndex('outdated')") runAndAssert(suite.Suite, expected_, tbl2.IndexWait().AtIndex("outdated"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #60") } { // sindex/status.yaml line #63 /* ({'created':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1} /* tbl2.index_create("quux") */ suite.T().Log("About to run line #63: tbl2.IndexCreate('quux')") runAndAssert(suite.Suite, expected_, tbl2.IndexCreate("quux"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #63") } { // sindex/status.yaml line #66 /* true */ var expected_ bool = true /* tbl2.index_status("quux").do(lambda x:(x[0]["index"] == "quux") & (x[0]["progress"] < 1)) */ suite.T().Log("About to run line #66: tbl2.IndexStatus('quux').Do(func(x r.Term) interface{} { return x.AtIndex(0).AtIndex('index').Eq('quux').And(x.AtIndex(0).AtIndex('progress').Lt(1))})") runAndAssert(suite.Suite, expected_, tbl2.IndexStatus("quux").Do(func(x r.Term) interface{} { return x.AtIndex(0).AtIndex("index").Eq("quux").And(x.AtIndex(0).AtIndex("progress").Lt(1)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #66") } { // sindex/status.yaml line #71 /* ([{'index':'quux', 'ready':true}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"index": "quux", "ready": true}} /* tbl2.index_wait("quux").pluck('index', 'ready') */ suite.T().Log("About to run line #71: tbl2.IndexWait('quux').Pluck('index', 'ready')") runAndAssert(suite.Suite, expected_, tbl2.IndexWait("quux").Pluck("index", "ready"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #71") } { // sindex/status.yaml line #74 /* ("PTYPE<BINARY>") */ var expected_ string = "PTYPE<BINARY>" /* tbl2.index_wait("quux").nth(0).get_field('function').type_of() */ suite.T().Log("About to run line #74: tbl2.IndexWait('quux').Nth(0).Field('function').TypeOf()") runAndAssert(suite.Suite, expected_, tbl2.IndexWait("quux").Nth(0).Field("function").TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #74") } }
func (suite *ChangefeedsEdgeSuite) TestCases() { suite.T().Log("Running ChangefeedsEdgeSuite: Test edge cases of changefeed operations") tbl := r.DB("test").Table("tbl") _ = tbl // Prevent any noused variable errors // changefeeds/edge.yaml line #5 // common_prefix = r.expr([0,1,2,3,4,5,6,7,8]) suite.T().Log("Possibly executing: var common_prefix r.Term = r.Expr([]interface{}{0, 1, 2, 3, 4, 5, 6, 7, 8})") common_prefix := r.Expr([]interface{}{0, 1, 2, 3, 4, 5, 6, 7, 8}) _ = common_prefix // Prevent any noused variable errors { // changefeeds/edge.yaml line #8 /* ({'created':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1} /* tbl.index_create('sindex', lambda row:common_prefix.append(row['value'])) */ suite.T().Log("About to run line #8: tbl.IndexCreateFunc('sindex', func(row r.Term) interface{} { return common_prefix.Append(row.AtIndex('value'))})") runAndAssert(suite.Suite, expected_, tbl.IndexCreateFunc("sindex", func(row r.Term) interface{} { return common_prefix.Append(row.AtIndex("value")) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #8") } { // changefeeds/edge.yaml line #11 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* tbl.index_wait('sindex') */ suite.T().Log("About to run line #11: tbl.IndexWait('sindex')") runAndAssert(suite.Suite, expected_, tbl.IndexWait("sindex"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #11") } // changefeeds/edge.yaml line #14 // pre = r.range(7).coerce_to('array').add(r.range(10,70).coerce_to('array')).append(100).map(r.row.coerce_to('string')) suite.T().Log("Possibly executing: var pre r.Term = r.Range(7).CoerceTo('array').Add(r.Range(10, 70).CoerceTo('array')).Append(100).Map(r.Row.CoerceTo('string'))") pre := maybeRun(r.Range(7).CoerceTo("array").Add(r.Range(10, 70).CoerceTo("array")).Append(100).Map(r.Row.CoerceTo("string")), suite.session, r.RunOpts{}) _ = pre // Prevent any noused variable errors // changefeeds/edge.yaml line #16 // mid = r.range(2,9).coerce_to('array').add(r.range(20,90).coerce_to('array')).map(r.row.coerce_to('string')) suite.T().Log("Possibly executing: var mid r.Term = r.Range(2, 9).CoerceTo('array').Add(r.Range(20, 90).CoerceTo('array')).Map(r.Row.CoerceTo('string'))") mid := maybeRun(r.Range(2, 9).CoerceTo("array").Add(r.Range(20, 90).CoerceTo("array")).Map(r.Row.CoerceTo("string")), suite.session, r.RunOpts{}) _ = mid // Prevent any noused variable errors // changefeeds/edge.yaml line #18 // post = r.range(3,10).coerce_to('array').add(r.range(30,100).coerce_to('array')).map(r.row.coerce_to('string')) suite.T().Log("Possibly executing: var post r.Term = r.Range(3, 10).CoerceTo('array').Add(r.Range(30, 100).CoerceTo('array')).Map(r.Row.CoerceTo('string'))") post := maybeRun(r.Range(3, 10).CoerceTo("array").Add(r.Range(30, 100).CoerceTo("array")).Map(r.Row.CoerceTo("string")), suite.session, r.RunOpts{}) _ = post // Prevent any noused variable errors // changefeeds/edge.yaml line #21 // erroredres = r.range(2).coerce_to('array').add(r.range(10, 20).coerce_to('array')).append(100).map(r.row.coerce_to('string')) suite.T().Log("Possibly executing: var erroredres r.Term = r.Range(2).CoerceTo('array').Add(r.Range(10, 20).CoerceTo('array')).Append(100).Map(r.Row.CoerceTo('string'))") erroredres := maybeRun(r.Range(2).CoerceTo("array").Add(r.Range(10, 20).CoerceTo("array")).Append(100).Map(r.Row.CoerceTo("string")), suite.session, r.RunOpts{}) _ = erroredres // Prevent any noused variable errors // changefeeds/edge.yaml line #26 // pre_changes = tbl.between(r.minval, common_prefix.append('7'), index='sindex').changes(squash=False).limit(len(pre))['new_val']['value'] suite.T().Log("Possibly executing: var pre_changes r.Term = tbl.Between(r.MinVal, common_prefix.Append('7')).OptArgs(r.BetweenOpts{Index: 'sindex', }).Changes().OptArgs(r.ChangesOpts{Squash: false, }).Limit(maybeLen(pre)).AtIndex('new_val').AtIndex('value')") pre_changes := maybeRun(tbl.Between(r.MinVal, common_prefix.Append("7")).OptArgs(r.BetweenOpts{Index: "sindex"}).Changes().OptArgs(r.ChangesOpts{Squash: false}).Limit(maybeLen(pre)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = pre_changes // Prevent any noused variable errors // changefeeds/edge.yaml line #29 // mid_changes = tbl.between(common_prefix.append('2'), common_prefix.append('9'), index='sindex').changes(squash=False).limit(len(post))['new_val']['value'] suite.T().Log("Possibly executing: var mid_changes r.Term = tbl.Between(common_prefix.Append('2'), common_prefix.Append('9')).OptArgs(r.BetweenOpts{Index: 'sindex', }).Changes().OptArgs(r.ChangesOpts{Squash: false, }).Limit(maybeLen(post)).AtIndex('new_val').AtIndex('value')") mid_changes := maybeRun(tbl.Between(common_prefix.Append("2"), common_prefix.Append("9")).OptArgs(r.BetweenOpts{Index: "sindex"}).Changes().OptArgs(r.ChangesOpts{Squash: false}).Limit(maybeLen(post)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = mid_changes // Prevent any noused variable errors // changefeeds/edge.yaml line #32 // post_changes = tbl.between(common_prefix.append('3'), r.maxval, index='sindex').changes(squash=False).limit(len(mid))['new_val']['value'] suite.T().Log("Possibly executing: var post_changes r.Term = tbl.Between(common_prefix.Append('3'), r.MaxVal).OptArgs(r.BetweenOpts{Index: 'sindex', }).Changes().OptArgs(r.ChangesOpts{Squash: false, }).Limit(maybeLen(mid)).AtIndex('new_val').AtIndex('value')") post_changes := maybeRun(tbl.Between(common_prefix.Append("3"), r.MaxVal).OptArgs(r.BetweenOpts{Index: "sindex"}).Changes().OptArgs(r.ChangesOpts{Squash: false}).Limit(maybeLen(mid)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = post_changes // Prevent any noused variable errors // changefeeds/edge.yaml line #38 // premap_changes1 = tbl.map(r.branch(r.row['value'].lt('2'), r.row, r.row["dummy"])).changes(squash=False).limit(len(erroredres))['new_val']['value'] suite.T().Log("Possibly executing: var premap_changes1 r.Term = tbl.Map(r.Branch(r.Row.AtIndex('value').Lt('2'), r.Row, r.Row.AtIndex('dummy'))).Changes().OptArgs(r.ChangesOpts{Squash: false, }).Limit(maybeLen(erroredres)).AtIndex('new_val').AtIndex('value')") premap_changes1 := maybeRun(tbl.Map(r.Branch(r.Row.AtIndex("value").Lt("2"), r.Row, r.Row.AtIndex("dummy"))).Changes().OptArgs(r.ChangesOpts{Squash: false}).Limit(maybeLen(erroredres)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = premap_changes1 // Prevent any noused variable errors // changefeeds/edge.yaml line #42 // postmap_changes1 = tbl.changes(squash=False).map(r.branch(r.row['new_val']['value'].lt('2'), r.row, r.row["dummy"])).limit(len(erroredres))['new_val']['value'] suite.T().Log("Possibly executing: var postmap_changes1 r.Term = tbl.Changes().OptArgs(r.ChangesOpts{Squash: false, }).Map(r.Branch(r.Row.AtIndex('new_val').AtIndex('value').Lt('2'), r.Row, r.Row.AtIndex('dummy'))).Limit(maybeLen(erroredres)).AtIndex('new_val').AtIndex('value')") postmap_changes1 := maybeRun(tbl.Changes().OptArgs(r.ChangesOpts{Squash: false}).Map(r.Branch(r.Row.AtIndex("new_val").AtIndex("value").Lt("2"), r.Row, r.Row.AtIndex("dummy"))).Limit(maybeLen(erroredres)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = postmap_changes1 // Prevent any noused variable errors // changefeeds/edge.yaml line #46 // prefilter_changes1 = tbl.filter(r.branch(r.row['value'].lt('2'), True, r.row["dummy"])).changes(squash=False).limit(len(erroredres))['new_val']['value'] suite.T().Log("Possibly executing: var prefilter_changes1 r.Term = tbl.Filter(r.Branch(r.Row.AtIndex('value').Lt('2'), true, r.Row.AtIndex('dummy'))).Changes().OptArgs(r.ChangesOpts{Squash: false, }).Limit(maybeLen(erroredres)).AtIndex('new_val').AtIndex('value')") prefilter_changes1 := maybeRun(tbl.Filter(r.Branch(r.Row.AtIndex("value").Lt("2"), true, r.Row.AtIndex("dummy"))).Changes().OptArgs(r.ChangesOpts{Squash: false}).Limit(maybeLen(erroredres)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = prefilter_changes1 // Prevent any noused variable errors // changefeeds/edge.yaml line #50 // postfilter_changes1 = tbl.changes(squash=False).filter(r.branch(r.row['new_val']['value'].lt('2'), True, r.row["dummy"])).limit(len(erroredres))['new_val']['value'] suite.T().Log("Possibly executing: var postfilter_changes1 r.Term = tbl.Changes().OptArgs(r.ChangesOpts{Squash: false, }).Filter(r.Branch(r.Row.AtIndex('new_val').AtIndex('value').Lt('2'), true, r.Row.AtIndex('dummy'))).Limit(maybeLen(erroredres)).AtIndex('new_val').AtIndex('value')") postfilter_changes1 := maybeRun(tbl.Changes().OptArgs(r.ChangesOpts{Squash: false}).Filter(r.Branch(r.Row.AtIndex("new_val").AtIndex("value").Lt("2"), true, r.Row.AtIndex("dummy"))).Limit(maybeLen(erroredres)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = postfilter_changes1 // Prevent any noused variable errors // changefeeds/edge.yaml line #56 // premap_changes2 = tbl.map(r.branch(r.row['value'].lt('2'), r.row, r.expr([])[1])).changes(squash=False).limit(len(erroredres))['new_val']['value'] suite.T().Log("Possibly executing: var premap_changes2 r.Term = tbl.Map(r.Branch(r.Row.AtIndex('value').Lt('2'), r.Row, r.Expr([]interface{}{}).AtIndex(1))).Changes().OptArgs(r.ChangesOpts{Squash: false, }).Limit(maybeLen(erroredres)).AtIndex('new_val').AtIndex('value')") premap_changes2 := maybeRun(tbl.Map(r.Branch(r.Row.AtIndex("value").Lt("2"), r.Row, r.Expr([]interface{}{}).AtIndex(1))).Changes().OptArgs(r.ChangesOpts{Squash: false}).Limit(maybeLen(erroredres)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = premap_changes2 // Prevent any noused variable errors // changefeeds/edge.yaml line #60 // postmap_changes2 = tbl.changes(squash=False).map(r.branch(r.row['new_val']['value'].lt('2'), r.row, r.expr([])[1])).limit(len(erroredres))['new_val']['value'] suite.T().Log("Possibly executing: var postmap_changes2 r.Term = tbl.Changes().OptArgs(r.ChangesOpts{Squash: false, }).Map(r.Branch(r.Row.AtIndex('new_val').AtIndex('value').Lt('2'), r.Row, r.Expr([]interface{}{}).AtIndex(1))).Limit(maybeLen(erroredres)).AtIndex('new_val').AtIndex('value')") postmap_changes2 := maybeRun(tbl.Changes().OptArgs(r.ChangesOpts{Squash: false}).Map(r.Branch(r.Row.AtIndex("new_val").AtIndex("value").Lt("2"), r.Row, r.Expr([]interface{}{}).AtIndex(1))).Limit(maybeLen(erroredres)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = postmap_changes2 // Prevent any noused variable errors // changefeeds/edge.yaml line #64 // prefilter_changes2 = tbl.filter(r.branch(r.row['value'].lt('2'), True, r.expr([])[1])).changes(squash=False).limit(len(erroredres))['new_val']['value'] suite.T().Log("Possibly executing: var prefilter_changes2 r.Term = tbl.Filter(r.Branch(r.Row.AtIndex('value').Lt('2'), true, r.Expr([]interface{}{}).AtIndex(1))).Changes().OptArgs(r.ChangesOpts{Squash: false, }).Limit(maybeLen(erroredres)).AtIndex('new_val').AtIndex('value')") prefilter_changes2 := maybeRun(tbl.Filter(r.Branch(r.Row.AtIndex("value").Lt("2"), true, r.Expr([]interface{}{}).AtIndex(1))).Changes().OptArgs(r.ChangesOpts{Squash: false}).Limit(maybeLen(erroredres)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = prefilter_changes2 // Prevent any noused variable errors // changefeeds/edge.yaml line #68 // postfilter_changes2 = tbl.changes(squash=False).filter(r.branch(r.row['new_val']['value'].lt('2'), True, r.expr([])[1])).limit(len(erroredres))['new_val']['value'] suite.T().Log("Possibly executing: var postfilter_changes2 r.Term = tbl.Changes().OptArgs(r.ChangesOpts{Squash: false, }).Filter(r.Branch(r.Row.AtIndex('new_val').AtIndex('value').Lt('2'), true, r.Expr([]interface{}{}).AtIndex(1))).Limit(maybeLen(erroredres)).AtIndex('new_val').AtIndex('value')") postfilter_changes2 := maybeRun(tbl.Changes().OptArgs(r.ChangesOpts{Squash: false}).Filter(r.Branch(r.Row.AtIndex("new_val").AtIndex("value").Lt("2"), true, r.Expr([]interface{}{}).AtIndex(1))).Limit(maybeLen(erroredres)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = postfilter_changes2 // Prevent any noused variable errors // changefeeds/edge.yaml line #73 // nondetermmap = r.branch(r.random().gt(0.5), r.row, r.error("dummy")) suite.T().Log("Possibly executing: var nondetermmap r.Term = r.Branch(r.Random().Gt(0.5), r.Row, r.Error('dummy'))") nondetermmap := r.Branch(r.Random().Gt(0.5), r.Row, r.Error("dummy")) _ = nondetermmap // Prevent any noused variable errors // changefeeds/edge.yaml line #77 // nondetermfilter = lambda row:r.random().gt(0.5) suite.T().Log("Possibly executing: var nondetermfilter func() = func(row interface{}) interface{} { return r.Random().Gt(0.5)}") nondetermfilter := func(row interface{}) interface{} { return r.Random().Gt(0.5) } _ = nondetermfilter // Prevent any noused variable errors { // changefeeds/edge.yaml line #83 /* err('ReqlQueryLogicError', 'Cannot call `changes` after a non-deterministic function.') */ var expected_ Err = err("ReqlQueryLogicError", "Cannot call `changes` after a non-deterministic function.") /* tbl.map(nondetermmap).changes(squash=False) */ suite.T().Log("About to run line #83: tbl.Map(nondetermmap).Changes().OptArgs(r.ChangesOpts{Squash: false, })") runAndAssert(suite.Suite, expected_, tbl.Map(nondetermmap).Changes().OptArgs(r.ChangesOpts{Squash: false}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #83") } // changefeeds/edge.yaml line #88 // postmap_changes3 = tbl.changes(squash=False).map(nondetermmap).limit(100) suite.T().Log("Possibly executing: var postmap_changes3 r.Term = tbl.Changes().OptArgs(r.ChangesOpts{Squash: false, }).Map(nondetermmap).Limit(100)") postmap_changes3 := maybeRun(tbl.Changes().OptArgs(r.ChangesOpts{Squash: false}).Map(nondetermmap).Limit(100), suite.session, r.RunOpts{}) _ = postmap_changes3 // Prevent any noused variable errors { // changefeeds/edge.yaml line #92 /* err('ReqlQueryLogicError', 'Cannot call `changes` after a non-deterministic function.') */ var expected_ Err = err("ReqlQueryLogicError", "Cannot call `changes` after a non-deterministic function.") /* tbl.filter(nondetermfilter).changes(squash=False) */ suite.T().Log("About to run line #92: tbl.Filter(nondetermfilter).Changes().OptArgs(r.ChangesOpts{Squash: false, })") runAndAssert(suite.Suite, expected_, tbl.Filter(nondetermfilter).Changes().OptArgs(r.ChangesOpts{Squash: false}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #92") } // changefeeds/edge.yaml line #97 // postfilter_changes3 = tbl.changes(squash=False).filter(nondetermfilter).limit(4) suite.T().Log("Possibly executing: var postfilter_changes3 r.Term = tbl.Changes().OptArgs(r.ChangesOpts{Squash: false, }).Filter(nondetermfilter).Limit(4)") postfilter_changes3 := maybeRun(tbl.Changes().OptArgs(r.ChangesOpts{Squash: false}).Filter(nondetermfilter).Limit(4), suite.session, r.RunOpts{}) _ = postfilter_changes3 // Prevent any noused variable errors { // changefeeds/edge.yaml line #100 /* ({'skipped':0,'deleted':0,'unchanged':0,'errors':0,'replaced':0,'inserted':101}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"skipped": 0, "deleted": 0, "unchanged": 0, "errors": 0, "replaced": 0, "inserted": 101} /* tbl.insert(r.range(101).map({'id':r.uuid().coerce_to('binary').slice(0,r.random(4,24)).coerce_to('string'),'value':r.row.coerce_to('string')})) */ suite.T().Log("About to run line #100: tbl.Insert(r.Range(101).Map(map[interface{}]interface{}{'id': r.UUID().CoerceTo('binary').Slice(0, r.Random(4, 24)).CoerceTo('string'), 'value': r.Row.CoerceTo('string'), }))") runAndAssert(suite.Suite, expected_, tbl.Insert(r.Range(101).Map(map[interface{}]interface{}{"id": r.UUID().CoerceTo("binary").Slice(0, r.Random(4, 24)).CoerceTo("string"), "value": r.Row.CoerceTo("string")})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #100") } { // changefeeds/edge.yaml line #105 /* bag(pre) */ var expected_ compare.Expected = compare.UnorderedMatch(pre) /* pre_changes */ suite.T().Log("About to run line #105: pre_changes") runAndAssert(suite.Suite, expected_, pre_changes, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #105") } { // changefeeds/edge.yaml line #108 /* bag(mid) */ var expected_ compare.Expected = compare.UnorderedMatch(mid) /* mid_changes */ suite.T().Log("About to run line #108: mid_changes") runAndAssert(suite.Suite, expected_, mid_changes, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #108") } { // changefeeds/edge.yaml line #111 /* bag(post) */ var expected_ compare.Expected = compare.UnorderedMatch(post) /* post_changes */ suite.T().Log("About to run line #111: post_changes") runAndAssert(suite.Suite, expected_, post_changes, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #111") } { // changefeeds/edge.yaml line #114 /* bag(erroredres) */ var expected_ compare.Expected = compare.UnorderedMatch(erroredres) /* premap_changes1 */ suite.T().Log("About to run line #114: premap_changes1") runAndAssert(suite.Suite, expected_, premap_changes1, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #114") } { // changefeeds/edge.yaml line #117 /* bag(erroredres) */ var expected_ compare.Expected = compare.UnorderedMatch(erroredres) /* premap_changes2 */ suite.T().Log("About to run line #117: premap_changes2") runAndAssert(suite.Suite, expected_, premap_changes2, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #117") } { // changefeeds/edge.yaml line #120 /* err('ReqlNonExistenceError', "No attribute `dummy` in object:") */ var expected_ Err = err("ReqlNonExistenceError", "No attribute `dummy` in object:") /* postmap_changes1 */ suite.T().Log("About to run line #120: postmap_changes1") runAndAssert(suite.Suite, expected_, postmap_changes1, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #120") } { // changefeeds/edge.yaml line #123 /* err('ReqlNonExistenceError', "Index out of bounds:" + " 1") */ var expected_ Err = err("ReqlNonExistenceError", "Index out of bounds:"+" 1") /* postmap_changes2 */ suite.T().Log("About to run line #123: postmap_changes2") runAndAssert(suite.Suite, expected_, postmap_changes2, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #123") } { // changefeeds/edge.yaml line #126 /* err('ReqlUserError', "dummy") */ var expected_ Err = err("ReqlUserError", "dummy") /* postmap_changes3 */ suite.T().Log("About to run line #126: postmap_changes3") runAndAssert(suite.Suite, expected_, postmap_changes3, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #126") } { // changefeeds/edge.yaml line #129 /* bag(erroredres) */ var expected_ compare.Expected = compare.UnorderedMatch(erroredres) /* prefilter_changes1 */ suite.T().Log("About to run line #129: prefilter_changes1") runAndAssert(suite.Suite, expected_, prefilter_changes1, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #129") } { // changefeeds/edge.yaml line #132 /* bag(erroredres) */ var expected_ compare.Expected = compare.UnorderedMatch(erroredres) /* prefilter_changes2 */ suite.T().Log("About to run line #132: prefilter_changes2") runAndAssert(suite.Suite, expected_, prefilter_changes2, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #132") } { // changefeeds/edge.yaml line #135 /* bag(erroredres) */ var expected_ compare.Expected = compare.UnorderedMatch(erroredres) /* postfilter_changes1 */ suite.T().Log("About to run line #135: postfilter_changes1") runAndAssert(suite.Suite, expected_, postfilter_changes1, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #135") } { // changefeeds/edge.yaml line #138 /* bag(erroredres) */ var expected_ compare.Expected = compare.UnorderedMatch(erroredres) /* postfilter_changes2 */ suite.T().Log("About to run line #138: postfilter_changes2") runAndAssert(suite.Suite, expected_, postfilter_changes2, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #138") } }
func (suite *ChangefeedsTableSuite) TestCases() { suite.T().Log("Running ChangefeedsTableSuite: Test changefeeds on a table") tbl := r.DB("test").Table("tbl") _ = tbl // Prevent any noused variable errors // changefeeds/table.yaml line #9 // all = tbl.changes() suite.T().Log("Possibly executing: var all r.Term = tbl.Changes()") all := maybeRun(tbl.Changes(), suite.session, r.RunOpts{}) _ = all // Prevent any noused variable errors { // changefeeds/table.yaml line #15 /* partial({'errors':0, 'inserted':2}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 2}) /* tbl.insert([{'id':1}, {'id':2}]) */ suite.T().Log("About to run line #15: tbl.Insert([]interface{}{map[interface{}]interface{}{'id': 1, }, map[interface{}]interface{}{'id': 2, }})") runAndAssert(suite.Suite, expected_, tbl.Insert([]interface{}{map[interface{}]interface{}{"id": 1}, map[interface{}]interface{}{"id": 2}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #15") } { // changefeeds/table.yaml line #17 /* bag([{'old_val':null, 'new_val':{'id':1}}, {'old_val':null, 'new_val':{'id':2}}]) */ var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{map[interface{}]interface{}{"old_val": nil, "new_val": map[interface{}]interface{}{"id": 1}}, map[interface{}]interface{}{"old_val": nil, "new_val": map[interface{}]interface{}{"id": 2}}}) /* fetch(all, 2) */ suite.T().Log("About to run line #17: fetch(all, 2)") fetchAndAssert(suite.Suite, expected_, all, 2) suite.T().Log("Finished running line #17") } { // changefeeds/table.yaml line #22 /* partial({'errors':0, 'replaced':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "replaced": 1}) /* tbl.get(1).update({'version':1}) */ suite.T().Log("About to run line #22: tbl.Get(1).Update(map[interface{}]interface{}{'version': 1, })") runAndAssert(suite.Suite, expected_, tbl.Get(1).Update(map[interface{}]interface{}{"version": 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #22") } { // changefeeds/table.yaml line #24 /* [{'old_val':{'id':1}, 'new_val':{'id':1, 'version':1}}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 1}, "new_val": map[interface{}]interface{}{"id": 1, "version": 1}}} /* fetch(all, 1) */ suite.T().Log("About to run line #24: fetch(all, 1)") fetchAndAssert(suite.Suite, expected_, all, 1) suite.T().Log("Finished running line #24") } { // changefeeds/table.yaml line #29 /* partial({'errors':0, 'deleted':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "deleted": 1}) /* tbl.get(1).delete() */ suite.T().Log("About to run line #29: tbl.Get(1).Delete()") runAndAssert(suite.Suite, expected_, tbl.Get(1).Delete(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #29") } { // changefeeds/table.yaml line #31 /* [{'old_val':{'id':1, 'version':1}, 'new_val':null}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 1, "version": 1}, "new_val": nil}} /* fetch(all, 1) */ suite.T().Log("About to run line #31: fetch(all, 1)") fetchAndAssert(suite.Suite, expected_, all, 1) suite.T().Log("Finished running line #31") } // changefeeds/table.yaml line #36 // pluck = tbl.changes().pluck({'new_val':['version']}) suite.T().Log("Possibly executing: var pluck r.Term = tbl.Changes().Pluck(map[interface{}]interface{}{'new_val': []interface{}{'version'}, })") pluck := maybeRun(tbl.Changes().Pluck(map[interface{}]interface{}{"new_val": []interface{}{"version"}}), suite.session, r.RunOpts{}) _ = pluck // Prevent any noused variable errors { // changefeeds/table.yaml line #37 /* partial({'errors':0, 'inserted':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 1}) /* tbl.insert([{'id':5, 'version':5}]) */ suite.T().Log("About to run line #37: tbl.Insert([]interface{}{map[interface{}]interface{}{'id': 5, 'version': 5, }})") runAndAssert(suite.Suite, expected_, tbl.Insert([]interface{}{map[interface{}]interface{}{"id": 5, "version": 5}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // changefeeds/table.yaml line #39 /* [{'new_val':{'version':5}}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"version": 5}}} /* fetch(pluck, 1) */ suite.T().Log("About to run line #39: fetch(pluck, 1)") fetchAndAssert(suite.Suite, expected_, pluck, 1) suite.T().Log("Finished running line #39") } { // changefeeds/table.yaml line #44 /* err('ReqlQueryLogicError', "Cannot call a terminal (`reduce`, `count`, etc.) on an infinite stream (such as a changefeed).") */ var expected_ Err = err("ReqlQueryLogicError", "Cannot call a terminal (`reduce`, `count`, etc.) on an infinite stream (such as a changefeed).") /* tbl.changes().order_by('id') */ suite.T().Log("About to run line #44: tbl.Changes().OrderBy('id')") runAndAssert(suite.Suite, expected_, tbl.Changes().OrderBy("id"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #44") } // changefeeds/table.yaml line #59 // overflow = tbl.changes(changefeed_queue_size=100) suite.T().Log("Possibly executing: var overflow r.Term = tbl.Changes().OptArgs(r.ChangesOpts{ChangefeedQueueSize: 100, })") overflow := maybeRun(tbl.Changes().OptArgs(r.ChangesOpts{ChangefeedQueueSize: 100}), suite.session, r.RunOpts{}) _ = overflow // Prevent any noused variable errors { // changefeeds/table.yaml line #62 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* tbl.insert(r.range(200).map(lambda x: {})) */ suite.T().Log("About to run line #62: tbl.Insert(r.Range(200).Map(func(x r.Term) interface{} { return map[interface{}]interface{}{}}))") runAndAssert(suite.Suite, expected_, tbl.Insert(r.Range(200).Map(func(x r.Term) interface{} { return map[interface{}]interface{}{} })), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #62") } { // changefeeds/table.yaml line #64 /* partial([{'error': regex('Changefeed cache over array size limit, skipped \d+ elements.')}]) */ var expected_ compare.Expected = compare.PartialMatch([]interface{}{map[interface{}]interface{}{"error": compare.MatchesRegexp("Changefeed cache over array size limit, skipped \\d+ elements.")}}) /* fetch(overflow, 90) */ suite.T().Log("About to run line #64: fetch(overflow, 90)") fetchAndAssert(suite.Suite, expected_, overflow, 90) suite.T().Log("Finished running line #64") } // changefeeds/table.yaml line #69 // vtbl = r.db('rethinkdb').table('_debug_scratch') suite.T().Log("Possibly executing: var vtbl r.Term = r.DB('rethinkdb').Table('_debug_scratch')") vtbl := r.DB("rethinkdb").Table("_debug_scratch") _ = vtbl // Prevent any noused variable errors // changefeeds/table.yaml line #70 // allVirtual = vtbl.changes() suite.T().Log("Possibly executing: var allVirtual r.Term = vtbl.Changes()") allVirtual := maybeRun(vtbl.Changes(), suite.session, r.RunOpts{}) _ = allVirtual // Prevent any noused variable errors { // changefeeds/table.yaml line #74 /* partial({'errors':0, 'inserted':2}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 2}) /* vtbl.insert([{'id':1}, {'id':2}]) */ suite.T().Log("About to run line #74: vtbl.Insert([]interface{}{map[interface{}]interface{}{'id': 1, }, map[interface{}]interface{}{'id': 2, }})") runAndAssert(suite.Suite, expected_, vtbl.Insert([]interface{}{map[interface{}]interface{}{"id": 1}, map[interface{}]interface{}{"id": 2}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #74") } { // changefeeds/table.yaml line #76 /* bag([{'old_val':null, 'new_val':{'id':1}}, {'old_val':null, 'new_val':{'id':2}}]) */ var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{map[interface{}]interface{}{"old_val": nil, "new_val": map[interface{}]interface{}{"id": 1}}, map[interface{}]interface{}{"old_val": nil, "new_val": map[interface{}]interface{}{"id": 2}}}) /* fetch(allVirtual, 2) */ suite.T().Log("About to run line #76: fetch(allVirtual, 2)") fetchAndAssert(suite.Suite, expected_, allVirtual, 2) suite.T().Log("Finished running line #76") } { // changefeeds/table.yaml line #81 /* partial({'errors':0, 'replaced':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "replaced": 1}) /* vtbl.get(1).update({'version':1}) */ suite.T().Log("About to run line #81: vtbl.Get(1).Update(map[interface{}]interface{}{'version': 1, })") runAndAssert(suite.Suite, expected_, vtbl.Get(1).Update(map[interface{}]interface{}{"version": 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #81") } { // changefeeds/table.yaml line #83 /* [{'old_val':{'id':1}, 'new_val':{'id':1, 'version':1}}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 1}, "new_val": map[interface{}]interface{}{"id": 1, "version": 1}}} /* fetch(allVirtual, 1) */ suite.T().Log("About to run line #83: fetch(allVirtual, 1)") fetchAndAssert(suite.Suite, expected_, allVirtual, 1) suite.T().Log("Finished running line #83") } { // changefeeds/table.yaml line #88 /* partial({'errors':0, 'deleted':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "deleted": 1}) /* vtbl.get(1).delete() */ suite.T().Log("About to run line #88: vtbl.Get(1).Delete()") runAndAssert(suite.Suite, expected_, vtbl.Get(1).Delete(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #88") } { // changefeeds/table.yaml line #90 /* [{'old_val':{'id':1, 'version':1}, 'new_val':null}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 1, "version": 1}, "new_val": nil}} /* fetch(allVirtual, 1) */ suite.T().Log("About to run line #90: fetch(allVirtual, 1)") fetchAndAssert(suite.Suite, expected_, allVirtual, 1) suite.T().Log("Finished running line #90") } // changefeeds/table.yaml line #95 // vpluck = vtbl.changes().pluck({'new_val':['version']}) suite.T().Log("Possibly executing: var vpluck r.Term = vtbl.Changes().Pluck(map[interface{}]interface{}{'new_val': []interface{}{'version'}, })") vpluck := maybeRun(vtbl.Changes().Pluck(map[interface{}]interface{}{"new_val": []interface{}{"version"}}), suite.session, r.RunOpts{}) _ = vpluck // Prevent any noused variable errors { // changefeeds/table.yaml line #96 /* partial({'errors':0, 'inserted':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 1}) /* vtbl.insert([{'id':5, 'version':5}]) */ suite.T().Log("About to run line #96: vtbl.Insert([]interface{}{map[interface{}]interface{}{'id': 5, 'version': 5, }})") runAndAssert(suite.Suite, expected_, vtbl.Insert([]interface{}{map[interface{}]interface{}{"id": 5, "version": 5}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #96") } { // changefeeds/table.yaml line #98 /* [{'new_val':{'version':5}}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"version": 5}}} /* fetch(vpluck, 1) */ suite.T().Log("About to run line #98: fetch(vpluck, 1)") fetchAndAssert(suite.Suite, expected_, vpluck, 1) suite.T().Log("Finished running line #98") } }