gopkg.in/rethinkdb/rethinkdb-go.v6@v6.2.2/internal/integration/reql_tests/reql_meta_table_test.go (about) 1 // Code generated by gen_tests.py and process_polyglot.py. 2 // Do not edit this file directly. 3 // The template for this file is located at: 4 // ../template.go.tpl 5 package reql_tests 6 7 import ( 8 "testing" 9 "time" 10 11 "github.com/stretchr/testify/suite" 12 r "gopkg.in/rethinkdb/rethinkdb-go.v6" 13 "gopkg.in/rethinkdb/rethinkdb-go.v6/internal/compare" 14 ) 15 16 // Tests meta queries for creating and deleting tables 17 func TestMetaTableSuite(t *testing.T) { 18 suite.Run(t, new(MetaTableSuite)) 19 } 20 21 type MetaTableSuite struct { 22 suite.Suite 23 24 session *r.Session 25 } 26 27 func (suite *MetaTableSuite) SetupTest() { 28 suite.T().Log("Setting up MetaTableSuite") 29 // Use imports to prevent errors 30 _ = time.Time{} 31 _ = compare.AnythingIsFine 32 33 session, err := r.Connect(r.ConnectOpts{ 34 Address: url, 35 }) 36 suite.Require().NoError(err, "Error returned when connecting to server") 37 suite.session = session 38 39 r.DBDrop("test").Exec(suite.session) 40 err = r.DBCreate("test").Exec(suite.session) 41 suite.Require().NoError(err) 42 err = r.DB("test").Wait().Exec(suite.session) 43 suite.Require().NoError(err) 44 45 } 46 47 func (suite *MetaTableSuite) TearDownSuite() { 48 suite.T().Log("Tearing down MetaTableSuite") 49 50 if suite.session != nil { 51 r.DB("rethinkdb").Table("_debug_scratch").Delete().Exec(suite.session) 52 r.DBDrop("test").Exec(suite.session) 53 54 suite.session.Close() 55 } 56 } 57 58 func (suite *MetaTableSuite) TestCases() { 59 suite.T().Log("Running MetaTableSuite: Tests meta queries for creating and deleting tables") 60 61 // meta/table.yaml line #4 62 // db = r.db('test') 63 suite.T().Log("Possibly executing: var db r.Term = r.DB('test')") 64 65 db := r.DB("test") 66 _ = db // Prevent any noused variable errors 67 68 { 69 // meta/table.yaml line #6 70 /* [] */ 71 var expected_ []interface{} = []interface{}{} 72 /* db.table_list() */ 73 74 suite.T().Log("About to run line #6: db.TableList()") 75 76 runAndAssert(suite.Suite, expected_, db.TableList(), suite.session, r.RunOpts{ 77 GeometryFormat: "raw", 78 GroupFormat: "map", 79 }) 80 suite.T().Log("Finished running line #6") 81 } 82 83 { 84 // meta/table.yaml line #9 85 /* ({'type':'DB','name':'rethinkdb','id':uuid()}) */ 86 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"type": "DB", "name": "rethinkdb", "id": compare.IsUUID()} 87 /* r.db('rethinkdb').info() */ 88 89 suite.T().Log("About to run line #9: r.DB('rethinkdb').Info()") 90 91 runAndAssert(suite.Suite, expected_, r.DB("rethinkdb").Info(), suite.session, r.RunOpts{ 92 GeometryFormat: "raw", 93 GroupFormat: "map", 94 }) 95 suite.T().Log("Finished running line #9") 96 } 97 98 { 99 // meta/table.yaml line #12 100 /* partial({'db':{'type':'DB','name':'rethinkdb','id':uuid()}, 101 'type':'TABLE','id':uuid(),'name':'stats', 102 'indexes':[],'primary_key':'id'}) */ 103 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"db": map[interface{}]interface{}{"type": "DB", "name": "rethinkdb", "id": compare.IsUUID()}, "type": "TABLE", "id": compare.IsUUID(), "name": "stats", "indexes": []interface{}{}, "primary_key": "id"}) 104 /* r.db('rethinkdb').table('stats').info() */ 105 106 suite.T().Log("About to run line #12: r.DB('rethinkdb').Table('stats').Info()") 107 108 runAndAssert(suite.Suite, expected_, r.DB("rethinkdb").Table("stats").Info(), suite.session, r.RunOpts{ 109 GeometryFormat: "raw", 110 GroupFormat: "map", 111 }) 112 suite.T().Log("Finished running line #12") 113 } 114 115 { 116 // meta/table.yaml line #18 117 /* partial({'tables_created':1}) */ 118 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) 119 /* db.table_create('a') */ 120 121 suite.T().Log("About to run line #18: db.TableCreate('a')") 122 123 runAndAssert(suite.Suite, expected_, db.TableCreate("a"), suite.session, r.RunOpts{ 124 GeometryFormat: "raw", 125 GroupFormat: "map", 126 }) 127 suite.T().Log("Finished running line #18") 128 } 129 130 { 131 // meta/table.yaml line #21 132 /* ['a'] */ 133 var expected_ []interface{} = []interface{}{"a"} 134 /* db.table_list() */ 135 136 suite.T().Log("About to run line #21: db.TableList()") 137 138 runAndAssert(suite.Suite, expected_, db.TableList(), suite.session, r.RunOpts{ 139 GeometryFormat: "raw", 140 GroupFormat: "map", 141 }) 142 suite.T().Log("Finished running line #21") 143 } 144 145 { 146 // meta/table.yaml line #24 147 /* partial({'tables_created':1}) */ 148 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) 149 /* db.table_create('b') */ 150 151 suite.T().Log("About to run line #24: db.TableCreate('b')") 152 153 runAndAssert(suite.Suite, expected_, db.TableCreate("b"), suite.session, r.RunOpts{ 154 GeometryFormat: "raw", 155 GroupFormat: "map", 156 }) 157 suite.T().Log("Finished running line #24") 158 } 159 160 { 161 // meta/table.yaml line #27 162 /* bag(['a', 'b']) */ 163 var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{"a", "b"}) 164 /* db.table_list() */ 165 166 suite.T().Log("About to run line #27: db.TableList()") 167 168 runAndAssert(suite.Suite, expected_, db.TableList(), suite.session, r.RunOpts{ 169 GeometryFormat: "raw", 170 GroupFormat: "map", 171 }) 172 suite.T().Log("Finished running line #27") 173 } 174 175 { 176 // meta/table.yaml line #31 177 /* partial({'tables_dropped':1}) */ 178 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) 179 /* db.table_drop('a') */ 180 181 suite.T().Log("About to run line #31: db.TableDrop('a')") 182 183 runAndAssert(suite.Suite, expected_, db.TableDrop("a"), suite.session, r.RunOpts{ 184 GeometryFormat: "raw", 185 GroupFormat: "map", 186 }) 187 suite.T().Log("Finished running line #31") 188 } 189 190 { 191 // meta/table.yaml line #34 192 /* ['b'] */ 193 var expected_ []interface{} = []interface{}{"b"} 194 /* db.table_list() */ 195 196 suite.T().Log("About to run line #34: db.TableList()") 197 198 runAndAssert(suite.Suite, expected_, db.TableList(), suite.session, r.RunOpts{ 199 GeometryFormat: "raw", 200 GroupFormat: "map", 201 }) 202 suite.T().Log("Finished running line #34") 203 } 204 205 { 206 // meta/table.yaml line #37 207 /* partial({'tables_dropped':1}) */ 208 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) 209 /* db.table_drop('b') */ 210 211 suite.T().Log("About to run line #37: db.TableDrop('b')") 212 213 runAndAssert(suite.Suite, expected_, db.TableDrop("b"), suite.session, r.RunOpts{ 214 GeometryFormat: "raw", 215 GroupFormat: "map", 216 }) 217 suite.T().Log("Finished running line #37") 218 } 219 220 { 221 // meta/table.yaml line #40 222 /* [] */ 223 var expected_ []interface{} = []interface{}{} 224 /* db.table_list() */ 225 226 suite.T().Log("About to run line #40: db.TableList()") 227 228 runAndAssert(suite.Suite, expected_, db.TableList(), suite.session, r.RunOpts{ 229 GeometryFormat: "raw", 230 GroupFormat: "map", 231 }) 232 suite.T().Log("Finished running line #40") 233 } 234 235 { 236 // meta/table.yaml line #44 237 /* partial({'tables_created':1,'config_changes':[partial({'new_val':partial({'durability':'soft'})})]}) */ 238 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"})})}}) 239 /* db.table_create('ab', durability='soft') */ 240 241 suite.T().Log("About to run line #44: db.TableCreate('ab').OptArgs(r.TableCreateOpts{Durability: 'soft', })") 242 243 runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{Durability: "soft"}), suite.session, r.RunOpts{ 244 GeometryFormat: "raw", 245 GroupFormat: "map", 246 }) 247 suite.T().Log("Finished running line #44") 248 } 249 250 { 251 // meta/table.yaml line #49 252 /* partial({'tables_dropped':1}) */ 253 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) 254 /* db.table_drop('ab') */ 255 256 suite.T().Log("About to run line #49: db.TableDrop('ab')") 257 258 runAndAssert(suite.Suite, expected_, db.TableDrop("ab"), suite.session, r.RunOpts{ 259 GeometryFormat: "raw", 260 GroupFormat: "map", 261 }) 262 suite.T().Log("Finished running line #49") 263 } 264 265 { 266 // meta/table.yaml line #52 267 /* partial({'tables_created':1,'config_changes':[partial({'new_val':partial({'durability':'hard'})})]}) */ 268 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"})})}}) 269 /* db.table_create('ab', durability='hard') */ 270 271 suite.T().Log("About to run line #52: db.TableCreate('ab').OptArgs(r.TableCreateOpts{Durability: 'hard', })") 272 273 runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{Durability: "hard"}), suite.session, r.RunOpts{ 274 GeometryFormat: "raw", 275 GroupFormat: "map", 276 }) 277 suite.T().Log("Finished running line #52") 278 } 279 280 { 281 // meta/table.yaml line #57 282 /* partial({'tables_dropped':1}) */ 283 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) 284 /* db.table_drop('ab') */ 285 286 suite.T().Log("About to run line #57: db.TableDrop('ab')") 287 288 runAndAssert(suite.Suite, expected_, db.TableDrop("ab"), suite.session, r.RunOpts{ 289 GeometryFormat: "raw", 290 GroupFormat: "map", 291 }) 292 suite.T().Log("Finished running line #57") 293 } 294 295 { 296 // meta/table.yaml line #60 297 /* err('ReqlQueryLogicError', 'Durability option `fake` unrecognized (options are "hard" and "soft").') */ 298 var expected_ Err = err("ReqlQueryLogicError", "Durability option `fake` unrecognized (options are \"hard\" and \"soft\").") 299 /* db.table_create('ab', durability='fake') */ 300 301 suite.T().Log("About to run line #60: db.TableCreate('ab').OptArgs(r.TableCreateOpts{Durability: 'fake', })") 302 303 runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{Durability: "fake"}), suite.session, r.RunOpts{ 304 GeometryFormat: "raw", 305 GroupFormat: "map", 306 }) 307 suite.T().Log("Finished running line #60") 308 } 309 310 { 311 // meta/table.yaml line #65 312 /* partial({'tables_created':1}) */ 313 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) 314 /* db.table_create('ab', primary_key='bar', shards=2, replicas=1) */ 315 316 suite.T().Log("About to run line #65: db.TableCreate('ab').OptArgs(r.TableCreateOpts{PrimaryKey: 'bar', Shards: 2, Replicas: 1, })") 317 318 runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{PrimaryKey: "bar", Shards: 2, Replicas: 1}), suite.session, r.RunOpts{ 319 GeometryFormat: "raw", 320 GroupFormat: "map", 321 }) 322 suite.T().Log("Finished running line #65") 323 } 324 325 { 326 // meta/table.yaml line #70 327 /* partial({'tables_dropped':1}) */ 328 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) 329 /* db.table_drop('ab') */ 330 331 suite.T().Log("About to run line #70: db.TableDrop('ab')") 332 333 runAndAssert(suite.Suite, expected_, db.TableDrop("ab"), suite.session, r.RunOpts{ 334 GeometryFormat: "raw", 335 GroupFormat: "map", 336 }) 337 suite.T().Log("Finished running line #70") 338 } 339 340 { 341 // meta/table.yaml line #73 342 /* partial({'tables_created':1}) */ 343 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) 344 /* db.table_create('ab', primary_key='bar', primary_replica_tag='default') */ 345 346 suite.T().Log("About to run line #73: db.TableCreate('ab').OptArgs(r.TableCreateOpts{PrimaryKey: 'bar', PrimaryReplicaTag: 'default', })") 347 348 runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{PrimaryKey: "bar", PrimaryReplicaTag: "default"}), suite.session, r.RunOpts{ 349 GeometryFormat: "raw", 350 GroupFormat: "map", 351 }) 352 suite.T().Log("Finished running line #73") 353 } 354 355 { 356 // meta/table.yaml line #78 357 /* partial({'tables_dropped':1}) */ 358 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) 359 /* db.table_drop('ab') */ 360 361 suite.T().Log("About to run line #78: db.TableDrop('ab')") 362 363 runAndAssert(suite.Suite, expected_, db.TableDrop("ab"), suite.session, r.RunOpts{ 364 GeometryFormat: "raw", 365 GroupFormat: "map", 366 }) 367 suite.T().Log("Finished running line #78") 368 } 369 370 { 371 // meta/table.yaml line #81 372 /* partial({'tables_created':1}) */ 373 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) 374 /* db.table_create('ab', nonvoting_replica_tags=['default']) */ 375 376 suite.T().Log("About to run line #81: db.TableCreate('ab').OptArgs(r.TableCreateOpts{NonVotingReplicaTags: []interface{}{'default'}, })") 377 378 runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{NonVotingReplicaTags: []interface{}{"default"}}), suite.session, r.RunOpts{ 379 GeometryFormat: "raw", 380 GroupFormat: "map", 381 }) 382 suite.T().Log("Finished running line #81") 383 } 384 385 { 386 // meta/table.yaml line #86 387 /* partial({'tables_dropped':1}) */ 388 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) 389 /* db.table_drop('ab') */ 390 391 suite.T().Log("About to run line #86: db.TableDrop('ab')") 392 393 runAndAssert(suite.Suite, expected_, db.TableDrop("ab"), suite.session, r.RunOpts{ 394 GeometryFormat: "raw", 395 GroupFormat: "map", 396 }) 397 suite.T().Log("Finished running line #86") 398 } 399 400 { 401 // meta/table.yaml line #90 402 /* partial({'tables_created':1}) */ 403 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) 404 /* db.table_create('a') */ 405 406 suite.T().Log("About to run line #90: db.TableCreate('a')") 407 408 runAndAssert(suite.Suite, expected_, db.TableCreate("a"), suite.session, r.RunOpts{ 409 GeometryFormat: "raw", 410 GroupFormat: "map", 411 }) 412 suite.T().Log("Finished running line #90") 413 } 414 415 { 416 // meta/table.yaml line #93 417 /* partial({'reconfigured':1}) */ 418 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 1}) 419 /* db.table('a').reconfigure(shards=1, replicas=1) */ 420 421 suite.T().Log("About to run line #93: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 1, })") 422 423 runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 1}), suite.session, r.RunOpts{ 424 GeometryFormat: "raw", 425 GroupFormat: "map", 426 }) 427 suite.T().Log("Finished running line #93") 428 } 429 430 { 431 // meta/table.yaml line #98 432 /* partial({'reconfigured':1}) */ 433 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 1}) 434 /* db.table('a').reconfigure(shards=1, replicas={"default":1}, nonvoting_replica_tags=['default'], primary_replica_tag='default') */ 435 436 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', })") 437 438 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{ 439 GeometryFormat: "raw", 440 GroupFormat: "map", 441 }) 442 suite.T().Log("Finished running line #98") 443 } 444 445 { 446 // meta/table.yaml line #103 447 /* partial({'reconfigured':0}) */ 448 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 0}) 449 /* db.table('a').reconfigure(shards=1, replicas=1, dry_run=True) */ 450 451 suite.T().Log("About to run line #103: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 1, DryRun: true, })") 452 453 runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 1, DryRun: true}), suite.session, r.RunOpts{ 454 GeometryFormat: "raw", 455 GroupFormat: "map", 456 }) 457 suite.T().Log("Finished running line #103") 458 } 459 460 { 461 // meta/table.yaml line #108 462 /* err('ReqlOpFailedError', 'This table doesn\'t need to be repaired.', []) */ 463 var expected_ Err = err("ReqlOpFailedError", "This table doesn't need to be repaired.") 464 /* db.table('a').reconfigure(emergency_repair="unsafe_rollback") */ 465 466 suite.T().Log("About to run line #108: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'unsafe_rollback', })") 467 468 runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "unsafe_rollback"}), suite.session, r.RunOpts{ 469 GeometryFormat: "raw", 470 GroupFormat: "map", 471 }) 472 suite.T().Log("Finished running line #108") 473 } 474 475 { 476 // meta/table.yaml line #113 477 /* err('ReqlOpFailedError', 'This table doesn\'t need to be repaired.', []) */ 478 var expected_ Err = err("ReqlOpFailedError", "This table doesn't need to be repaired.") 479 /* db.table('a').reconfigure(emergency_repair="unsafe_rollback", dry_run=True) */ 480 481 suite.T().Log("About to run line #113: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'unsafe_rollback', DryRun: true, })") 482 483 runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "unsafe_rollback", DryRun: true}), suite.session, r.RunOpts{ 484 GeometryFormat: "raw", 485 GroupFormat: "map", 486 }) 487 suite.T().Log("Finished running line #113") 488 } 489 490 { 491 // meta/table.yaml line #118 492 /* err('ReqlOpFailedError', 'This table doesn\'t need to be repaired.', []) */ 493 var expected_ Err = err("ReqlOpFailedError", "This table doesn't need to be repaired.") 494 /* db.table('a').reconfigure(emergency_repair="unsafe_rollback_or_erase") */ 495 496 suite.T().Log("About to run line #118: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'unsafe_rollback_or_erase', })") 497 498 runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "unsafe_rollback_or_erase"}), suite.session, r.RunOpts{ 499 GeometryFormat: "raw", 500 GroupFormat: "map", 501 }) 502 suite.T().Log("Finished running line #118") 503 } 504 505 { 506 // meta/table.yaml line #123 507 /* partial({'reconfigured':0}) */ 508 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 0}) 509 /* db.table('a').reconfigure(emergency_repair=None, shards=1, replicas=1, dry_run=True) */ 510 511 suite.T().Log("About to run line #123: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: nil, Shards: 1, Replicas: 1, DryRun: true, })") 512 513 runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: nil, Shards: 1, Replicas: 1, DryRun: true}), suite.session, r.RunOpts{ 514 GeometryFormat: "raw", 515 GroupFormat: "map", 516 }) 517 suite.T().Log("Finished running line #123") 518 } 519 520 { 521 // meta/table.yaml line #128 522 /* partial({'tables_dropped':1}) */ 523 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) 524 /* db.table_drop('a') */ 525 526 suite.T().Log("About to run line #128: db.TableDrop('a')") 527 528 runAndAssert(suite.Suite, expected_, db.TableDrop("a"), suite.session, r.RunOpts{ 529 GeometryFormat: "raw", 530 GroupFormat: "map", 531 }) 532 suite.T().Log("Finished running line #128") 533 } 534 535 { 536 // meta/table.yaml line #132 537 /* partial({'tables_created':1}) */ 538 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) 539 /* db.table_create('foo') */ 540 541 suite.T().Log("About to run line #132: db.TableCreate('foo')") 542 543 runAndAssert(suite.Suite, expected_, db.TableCreate("foo"), suite.session, r.RunOpts{ 544 GeometryFormat: "raw", 545 GroupFormat: "map", 546 }) 547 suite.T().Log("Finished running line #132") 548 } 549 550 { 551 // meta/table.yaml line #135 552 /* err('ReqlOpFailedError', 'Table `test.foo` already exists.', [0]) */ 553 var expected_ Err = err("ReqlOpFailedError", "Table `test.foo` already exists.") 554 /* db.table_create('foo') */ 555 556 suite.T().Log("About to run line #135: db.TableCreate('foo')") 557 558 runAndAssert(suite.Suite, expected_, db.TableCreate("foo"), suite.session, r.RunOpts{ 559 GeometryFormat: "raw", 560 GroupFormat: "map", 561 }) 562 suite.T().Log("Finished running line #135") 563 } 564 565 { 566 // meta/table.yaml line #138 567 /* partial({'tables_dropped':1}) */ 568 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) 569 /* db.table_drop('foo') */ 570 571 suite.T().Log("About to run line #138: db.TableDrop('foo')") 572 573 runAndAssert(suite.Suite, expected_, db.TableDrop("foo"), suite.session, r.RunOpts{ 574 GeometryFormat: "raw", 575 GroupFormat: "map", 576 }) 577 suite.T().Log("Finished running line #138") 578 } 579 580 { 581 // meta/table.yaml line #141 582 /* err('ReqlOpFailedError', 'Table `test.foo` does not exist.', [0]) */ 583 var expected_ Err = err("ReqlOpFailedError", "Table `test.foo` does not exist.") 584 /* db.table_drop('foo') */ 585 586 suite.T().Log("About to run line #141: db.TableDrop('foo')") 587 588 runAndAssert(suite.Suite, expected_, db.TableDrop("foo"), suite.session, r.RunOpts{ 589 GeometryFormat: "raw", 590 GroupFormat: "map", 591 }) 592 suite.T().Log("Finished running line #141") 593 } 594 595 { 596 // meta/table.yaml line #158 597 /* partial({'tables_created':1}) */ 598 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) 599 /* db.table_create('a') */ 600 601 suite.T().Log("About to run line #158: db.TableCreate('a')") 602 603 runAndAssert(suite.Suite, expected_, db.TableCreate("a"), suite.session, r.RunOpts{ 604 GeometryFormat: "raw", 605 GroupFormat: "map", 606 }) 607 suite.T().Log("Finished running line #158") 608 } 609 610 { 611 // meta/table.yaml line #161 612 /* err('ReqlQueryLogicError', 'Every table must have at least one shard.', []) */ 613 var expected_ Err = err("ReqlQueryLogicError", "Every table must have at least one shard.") 614 /* db.table('a').reconfigure(shards=0, replicas=1) */ 615 616 suite.T().Log("About to run line #161: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 0, Replicas: 1, })") 617 618 runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 0, Replicas: 1}), suite.session, r.RunOpts{ 619 GeometryFormat: "raw", 620 GroupFormat: "map", 621 }) 622 suite.T().Log("Finished running line #161") 623 } 624 625 { 626 // meta/table.yaml line #166 627 /* err('ReqlOpFailedError', 'Can\'t use server tag `foo` for primary replicas because you specified no replicas in server tag `foo`.', []) */ 628 var expected_ Err = err("ReqlOpFailedError", "Can't use server tag `foo` for primary replicas because you specified no replicas in server tag `foo`.") 629 /* db.table('a').reconfigure(shards=1, replicas={"default":1}, primary_replica_tag="foo") */ 630 631 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', })") 632 633 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{ 634 GeometryFormat: "raw", 635 GroupFormat: "map", 636 }) 637 suite.T().Log("Finished running line #166") 638 } 639 640 { 641 // meta/table.yaml line #171 642 /* 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`.', []) */ 643 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`.") 644 /* db.table('a').reconfigure(shards=1, replicas={"default":1}, primary_replica_tag="default", nonvoting_replica_tags=["foo"]) */ 645 646 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'}, })") 647 648 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{ 649 GeometryFormat: "raw", 650 GroupFormat: "map", 651 }) 652 suite.T().Log("Finished running line #171") 653 } 654 655 { 656 // meta/table.yaml line #176 657 /* 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.', []) */ 658 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.") 659 /* db.table('a').reconfigure(shards=1, replicas={"foo":0}, primary_replica_tag="foo") */ 660 661 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', })") 662 663 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{ 664 GeometryFormat: "raw", 665 GroupFormat: "map", 666 }) 667 suite.T().Log("Finished running line #176") 668 } 669 670 { 671 // meta/table.yaml line #181 672 /* err('ReqlQueryLogicError', '`primary_replica_tag` must be specified when `replicas` is an OBJECT.', []) */ 673 var expected_ Err = err("ReqlQueryLogicError", "`primary_replica_tag` must be specified when `replicas` is an OBJECT.") 674 /* db.table('a').reconfigure(shards=1, replicas={"default":0}) */ 675 676 suite.T().Log("About to run line #181: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': 0, }, })") 677 678 runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": 0}}), suite.session, r.RunOpts{ 679 GeometryFormat: "raw", 680 GroupFormat: "map", 681 }) 682 suite.T().Log("Finished running line #181") 683 } 684 685 { 686 // meta/table.yaml line #186 687 /* err('ReqlQueryLogicError', 'Can\'t have a negative number of replicas', []) */ 688 var expected_ Err = err("ReqlQueryLogicError", "Can't have a negative number of replicas") 689 /* db.table('a').reconfigure(shards=1, replicas={"default":-3}, primary_replica_tag='default') */ 690 691 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', })") 692 693 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{ 694 GeometryFormat: "raw", 695 GroupFormat: "map", 696 }) 697 suite.T().Log("Finished running line #186") 698 } 699 700 { 701 // meta/table.yaml line #191 702 /* err('ReqlQueryLogicError', '`replicas` must be an OBJECT if `primary_replica_tag` is specified.', []) */ 703 var expected_ Err = err("ReqlQueryLogicError", "`replicas` must be an OBJECT if `primary_replica_tag` is specified.") 704 /* db.table('a').reconfigure(shards=1, replicas=3, primary_replica_tag='foo') */ 705 706 suite.T().Log("About to run line #191: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, PrimaryReplicaTag: 'foo', })") 707 708 runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, PrimaryReplicaTag: "foo"}), suite.session, r.RunOpts{ 709 GeometryFormat: "raw", 710 GroupFormat: "map", 711 }) 712 suite.T().Log("Finished running line #191") 713 } 714 715 { 716 // meta/table.yaml line #196 717 /* err('ReqlQueryLogicError', '`replicas` must be an OBJECT if `nonvoting_replica_tags` is specified.', []) */ 718 var expected_ Err = err("ReqlQueryLogicError", "`replicas` must be an OBJECT if `nonvoting_replica_tags` is specified.") 719 /* db.table('a').reconfigure(shards=1, replicas=3, nonvoting_replica_tags=['foo']) */ 720 721 suite.T().Log("About to run line #196: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, NonVotingReplicaTags: []interface{}{'foo'}, })") 722 723 runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, NonVotingReplicaTags: []interface{}{"foo"}}), suite.session, r.RunOpts{ 724 GeometryFormat: "raw", 725 GroupFormat: "map", 726 }) 727 suite.T().Log("Finished running line #196") 728 } 729 730 { 731 // meta/table.yaml line #201 732 /* err('ReqlQueryLogicError', 'Can\'t emergency repair an entire database at once; instead you should run `reconfigure()` on each table individually.') */ 733 var expected_ Err = err("ReqlQueryLogicError", "Can't emergency repair an entire database at once; instead you should run `reconfigure()` on each table individually.") 734 /* db.reconfigure(emergency_repair="unsafe_rollback") */ 735 736 suite.T().Log("About to run line #201: db.Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'unsafe_rollback', })") 737 738 runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "unsafe_rollback"}), suite.session, r.RunOpts{ 739 GeometryFormat: "raw", 740 GroupFormat: "map", 741 }) 742 suite.T().Log("Finished running line #201") 743 } 744 745 { 746 // meta/table.yaml line #206 747 /* err('ReqlQueryLogicError', '`emergency_repair` should be "unsafe_rollback" or "unsafe_rollback_or_erase"', []) */ 748 var expected_ Err = err("ReqlQueryLogicError", "`emergency_repair` should be \"unsafe_rollback\" or \"unsafe_rollback_or_erase\"") 749 /* db.table('a').reconfigure(emergency_repair="foo") */ 750 751 suite.T().Log("About to run line #206: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'foo', })") 752 753 runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "foo"}), suite.session, r.RunOpts{ 754 GeometryFormat: "raw", 755 GroupFormat: "map", 756 }) 757 suite.T().Log("Finished running line #206") 758 } 759 760 { 761 // meta/table.yaml line #211 762 /* err('ReqlQueryLogicError', 'In emergency repair mode, you can\'t specify shards, replicas, etc.') */ 763 var expected_ Err = err("ReqlQueryLogicError", "In emergency repair mode, you can't specify shards, replicas, etc.") 764 /* db.table('a').reconfigure(emergency_repair="unsafe_rollback", shards=1, replicas=1) */ 765 766 suite.T().Log("About to run line #211: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'unsafe_rollback', Shards: 1, Replicas: 1, })") 767 768 runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "unsafe_rollback", Shards: 1, Replicas: 1}), suite.session, r.RunOpts{ 769 GeometryFormat: "raw", 770 GroupFormat: "map", 771 }) 772 suite.T().Log("Finished running line #211") 773 } 774 775 { 776 // meta/table.yaml line #217 777 /* partial({'reconfigured':1}) */ 778 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 1}) 779 /* db.table('a').reconfigure(shards=2, replicas=1) */ 780 781 suite.T().Log("About to run line #217: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1, })") 782 783 runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1}), suite.session, r.RunOpts{ 784 GeometryFormat: "raw", 785 GroupFormat: "map", 786 }) 787 suite.T().Log("Finished running line #217") 788 } 789 790 { 791 // meta/table.yaml line #222 792 /* {"ready":1} */ 793 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"ready": 1} 794 /* db.table('a').wait(wait_for="all_replicas_ready") */ 795 796 suite.T().Log("About to run line #222: db.Table('a').Wait().OptArgs(r.WaitOpts{WaitFor: 'all_replicas_ready', })") 797 798 runAndAssert(suite.Suite, expected_, db.Table("a").Wait().OptArgs(r.WaitOpts{WaitFor: "all_replicas_ready"}), suite.session, r.RunOpts{ 799 GeometryFormat: "raw", 800 GroupFormat: "map", 801 }) 802 suite.T().Log("Finished running line #222") 803 } 804 805 { 806 // meta/table.yaml line #228 807 /* partial({"inserted":4}) */ 808 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"inserted": 4}) 809 /* db.table('a').insert([{"id":1}, {"id":2}, {"id":3}, {"id":4}]) */ 810 811 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, }})") 812 813 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{ 814 GeometryFormat: "raw", 815 GroupFormat: "map", 816 }) 817 suite.T().Log("Finished running line #228") 818 } 819 820 { 821 // meta/table.yaml line #233 822 /* partial({'reconfigured':1}) */ 823 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 1}) 824 /* db.table('a').reconfigure(shards=2, replicas=1) */ 825 826 suite.T().Log("About to run line #233: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1, })") 827 828 runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1}), suite.session, r.RunOpts{ 829 GeometryFormat: "raw", 830 GroupFormat: "map", 831 }) 832 suite.T().Log("Finished running line #233") 833 } 834 835 { 836 // meta/table.yaml line #238 837 /* 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.', []) */ 838 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.") 839 /* db.table('a').reconfigure(shards=1, replicas=2) */ 840 841 suite.T().Log("About to run line #238: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 2, })") 842 843 runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 2}), suite.session, r.RunOpts{ 844 GeometryFormat: "raw", 845 GroupFormat: "map", 846 }) 847 suite.T().Log("Finished running line #238") 848 } 849 850 { 851 // meta/table.yaml line #244 852 /* {"ready":1} */ 853 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"ready": 1} 854 /* db.table('a').wait(wait_for="all_replicas_ready") */ 855 856 suite.T().Log("About to run line #244: db.Table('a').Wait().OptArgs(r.WaitOpts{WaitFor: 'all_replicas_ready', })") 857 858 runAndAssert(suite.Suite, expected_, db.Table("a").Wait().OptArgs(r.WaitOpts{WaitFor: "all_replicas_ready"}), suite.session, r.RunOpts{ 859 GeometryFormat: "raw", 860 GroupFormat: "map", 861 }) 862 suite.T().Log("Finished running line #244") 863 } 864 865 { 866 // meta/table.yaml line #248 867 /* partial({'rebalanced':1}) */ 868 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"rebalanced": 1}) 869 /* db.table('a').rebalance() */ 870 871 suite.T().Log("About to run line #248: db.Table('a').Rebalance()") 872 873 runAndAssert(suite.Suite, expected_, db.Table("a").Rebalance(), suite.session, r.RunOpts{ 874 GeometryFormat: "raw", 875 GroupFormat: "map", 876 }) 877 suite.T().Log("Finished running line #248") 878 } 879 880 { 881 // meta/table.yaml line #251 882 /* {"ready":1} */ 883 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"ready": 1} 884 /* db.wait(wait_for="all_replicas_ready") */ 885 886 suite.T().Log("About to run line #251: db.Wait().OptArgs(r.WaitOpts{WaitFor: 'all_replicas_ready', })") 887 888 runAndAssert(suite.Suite, expected_, db.Wait().OptArgs(r.WaitOpts{WaitFor: "all_replicas_ready"}), suite.session, r.RunOpts{ 889 GeometryFormat: "raw", 890 GroupFormat: "map", 891 }) 892 suite.T().Log("Finished running line #251") 893 } 894 895 { 896 // meta/table.yaml line #255 897 /* partial({'rebalanced':1}) */ 898 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"rebalanced": 1}) 899 /* db.rebalance() */ 900 901 suite.T().Log("About to run line #255: db.Rebalance()") 902 903 runAndAssert(suite.Suite, expected_, db.Rebalance(), suite.session, r.RunOpts{ 904 GeometryFormat: "raw", 905 GroupFormat: "map", 906 }) 907 suite.T().Log("Finished running line #255") 908 } 909 910 { 911 // meta/table.yaml line #271 912 /* partial({'tables_dropped':1}) */ 913 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) 914 /* db.table_drop('a') */ 915 916 suite.T().Log("About to run line #271: db.TableDrop('a')") 917 918 runAndAssert(suite.Suite, expected_, db.TableDrop("a"), suite.session, r.RunOpts{ 919 GeometryFormat: "raw", 920 GroupFormat: "map", 921 }) 922 suite.T().Log("Finished running line #271") 923 } 924 925 { 926 // meta/table.yaml line #275 927 /* AnythingIsFine */ 928 var expected_ string = compare.AnythingIsFine 929 /* db.table_create('a') */ 930 931 suite.T().Log("About to run line #275: db.TableCreate('a')") 932 933 runAndAssert(suite.Suite, expected_, db.TableCreate("a"), suite.session, r.RunOpts{ 934 GeometryFormat: "raw", 935 GroupFormat: "map", 936 }) 937 suite.T().Log("Finished running line #275") 938 } 939 940 { 941 // meta/table.yaml line #276 942 /* AnythingIsFine */ 943 var expected_ string = compare.AnythingIsFine 944 /* db.table_create('b') */ 945 946 suite.T().Log("About to run line #276: db.TableCreate('b')") 947 948 runAndAssert(suite.Suite, expected_, db.TableCreate("b"), suite.session, r.RunOpts{ 949 GeometryFormat: "raw", 950 GroupFormat: "map", 951 }) 952 suite.T().Log("Finished running line #276") 953 } 954 955 { 956 // meta/table.yaml line #277 957 /* AnythingIsFine */ 958 var expected_ string = compare.AnythingIsFine 959 /* db.table_create('c') */ 960 961 suite.T().Log("About to run line #277: db.TableCreate('c')") 962 963 runAndAssert(suite.Suite, expected_, db.TableCreate("c"), suite.session, r.RunOpts{ 964 GeometryFormat: "raw", 965 GroupFormat: "map", 966 }) 967 suite.T().Log("Finished running line #277") 968 } 969 970 { 971 // meta/table.yaml line #279 972 /* err('ReqlQueryLogicError', 'Every table must have at least one shard.', []) */ 973 var expected_ Err = err("ReqlQueryLogicError", "Every table must have at least one shard.") 974 /* db.reconfigure(shards=0, replicas=1) */ 975 976 suite.T().Log("About to run line #279: db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 0, Replicas: 1, })") 977 978 runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 0, Replicas: 1}), suite.session, r.RunOpts{ 979 GeometryFormat: "raw", 980 GroupFormat: "map", 981 }) 982 suite.T().Log("Finished running line #279") 983 } 984 985 { 986 // meta/table.yaml line #284 987 /* err('ReqlQueryLogicError', '`primary_replica_tag` must be specified when `replicas` is an OBJECT.', []) */ 988 var expected_ Err = err("ReqlQueryLogicError", "`primary_replica_tag` must be specified when `replicas` is an OBJECT.") 989 /* db.reconfigure(shards=1, replicas={"default":0}) */ 990 991 suite.T().Log("About to run line #284: db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': 0, }, })") 992 993 runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": 0}}), suite.session, r.RunOpts{ 994 GeometryFormat: "raw", 995 GroupFormat: "map", 996 }) 997 suite.T().Log("Finished running line #284") 998 } 999 1000 { 1001 // meta/table.yaml line #289 1002 /* err('ReqlQueryLogicError', 'Can\'t have a negative number of replicas', []) */ 1003 var expected_ Err = err("ReqlQueryLogicError", "Can't have a negative number of replicas") 1004 /* db.reconfigure(shards=1, replicas={"default":-3}, primary_replica_tag='default') */ 1005 1006 suite.T().Log("About to run line #289: db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': -3, }, PrimaryReplicaTag: 'default', })") 1007 1008 runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": -3}, PrimaryReplicaTag: "default"}), suite.session, r.RunOpts{ 1009 GeometryFormat: "raw", 1010 GroupFormat: "map", 1011 }) 1012 suite.T().Log("Finished running line #289") 1013 } 1014 1015 { 1016 // meta/table.yaml line #294 1017 /* err('ReqlQueryLogicError', '`replicas` must be an OBJECT if `primary_replica_tag` is specified.', []) */ 1018 var expected_ Err = err("ReqlQueryLogicError", "`replicas` must be an OBJECT if `primary_replica_tag` is specified.") 1019 /* db.reconfigure(shards=1, replicas=3, primary_replica_tag='foo') */ 1020 1021 suite.T().Log("About to run line #294: db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, PrimaryReplicaTag: 'foo', })") 1022 1023 runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, PrimaryReplicaTag: "foo"}), suite.session, r.RunOpts{ 1024 GeometryFormat: "raw", 1025 GroupFormat: "map", 1026 }) 1027 suite.T().Log("Finished running line #294") 1028 } 1029 1030 { 1031 // meta/table.yaml line #299 1032 /* partial({'reconfigured':3}) */ 1033 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 3}) 1034 /* db.reconfigure(shards=2, replicas=1) */ 1035 1036 suite.T().Log("About to run line #299: db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1, })") 1037 1038 runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1}), suite.session, r.RunOpts{ 1039 GeometryFormat: "raw", 1040 GroupFormat: "map", 1041 }) 1042 suite.T().Log("Finished running line #299") 1043 } 1044 1045 { 1046 // meta/table.yaml line #304 1047 /* partial({'tables_dropped':1}) */ 1048 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) 1049 /* db.table_drop('a') */ 1050 1051 suite.T().Log("About to run line #304: db.TableDrop('a')") 1052 1053 runAndAssert(suite.Suite, expected_, db.TableDrop("a"), suite.session, r.RunOpts{ 1054 GeometryFormat: "raw", 1055 GroupFormat: "map", 1056 }) 1057 suite.T().Log("Finished running line #304") 1058 } 1059 1060 { 1061 // meta/table.yaml line #306 1062 /* partial({'tables_dropped':1}) */ 1063 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) 1064 /* db.table_drop('b') */ 1065 1066 suite.T().Log("About to run line #306: db.TableDrop('b')") 1067 1068 runAndAssert(suite.Suite, expected_, db.TableDrop("b"), suite.session, r.RunOpts{ 1069 GeometryFormat: "raw", 1070 GroupFormat: "map", 1071 }) 1072 suite.T().Log("Finished running line #306") 1073 } 1074 1075 { 1076 // meta/table.yaml line #308 1077 /* partial({'tables_dropped':1}) */ 1078 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) 1079 /* db.table_drop('c') */ 1080 1081 suite.T().Log("About to run line #308: db.TableDrop('c')") 1082 1083 runAndAssert(suite.Suite, expected_, db.TableDrop("c"), suite.session, r.RunOpts{ 1084 GeometryFormat: "raw", 1085 GroupFormat: "map", 1086 }) 1087 suite.T().Log("Finished running line #308") 1088 } 1089 1090 { 1091 // meta/table.yaml line #312 1092 /* partial({'dbs_created':1}) */ 1093 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_created": 1}) 1094 /* r.db_create("test2") */ 1095 1096 suite.T().Log("About to run line #312: r.DBCreate('test2')") 1097 1098 runAndAssert(suite.Suite, expected_, r.DBCreate("test2"), suite.session, r.RunOpts{ 1099 GeometryFormat: "raw", 1100 GroupFormat: "map", 1101 }) 1102 suite.T().Log("Finished running line #312") 1103 } 1104 1105 // meta/table.yaml line #315 1106 // db2 = r.db("test2") 1107 suite.T().Log("Possibly executing: var db2 r.Term = r.DB('test2')") 1108 1109 db2 := r.DB("test2") 1110 _ = db2 // Prevent any noused variable errors 1111 1112 { 1113 // meta/table.yaml line #317 1114 /* partial({'tables_created':1}) */ 1115 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) 1116 /* db.table_create("testA") */ 1117 1118 suite.T().Log("About to run line #317: db.TableCreate('testA')") 1119 1120 runAndAssert(suite.Suite, expected_, db.TableCreate("testA"), suite.session, r.RunOpts{ 1121 GeometryFormat: "raw", 1122 GroupFormat: "map", 1123 }) 1124 suite.T().Log("Finished running line #317") 1125 } 1126 1127 { 1128 // meta/table.yaml line #319 1129 /* partial({'tables_created':1}) */ 1130 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) 1131 /* db.table_create("testB") */ 1132 1133 suite.T().Log("About to run line #319: db.TableCreate('testB')") 1134 1135 runAndAssert(suite.Suite, expected_, db.TableCreate("testB"), suite.session, r.RunOpts{ 1136 GeometryFormat: "raw", 1137 GroupFormat: "map", 1138 }) 1139 suite.T().Log("Finished running line #319") 1140 } 1141 1142 { 1143 // meta/table.yaml line #321 1144 /* partial({'tables_created':1}) */ 1145 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) 1146 /* db2.table_create("test2B") */ 1147 1148 suite.T().Log("About to run line #321: db2.TableCreate('test2B')") 1149 1150 runAndAssert(suite.Suite, expected_, db2.TableCreate("test2B"), suite.session, r.RunOpts{ 1151 GeometryFormat: "raw", 1152 GroupFormat: "map", 1153 }) 1154 suite.T().Log("Finished running line #321") 1155 } 1156 1157 { 1158 // meta/table.yaml line #324 1159 /* {'db':'test','name':'testA'} */ 1160 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"db": "test", "name": "testA"} 1161 /* r.table('testA').config().pluck('db','name') */ 1162 1163 suite.T().Log("About to run line #324: r.Table('testA').Config().Pluck('db', 'name')") 1164 1165 runAndAssert(suite.Suite, expected_, r.Table("testA").Config().Pluck("db", "name"), suite.session, r.RunOpts{ 1166 GeometryFormat: "raw", 1167 GroupFormat: "map", 1168 }) 1169 suite.T().Log("Finished running line #324") 1170 } 1171 1172 { 1173 // meta/table.yaml line #327 1174 /* err('ReqlOpFailedError', 'Table `test.doesntexist` does not exist.', []) */ 1175 var expected_ Err = err("ReqlOpFailedError", "Table `test.doesntexist` does not exist.") 1176 /* r.table('doesntexist').config() */ 1177 1178 suite.T().Log("About to run line #327: r.Table('doesntexist').Config()") 1179 1180 runAndAssert(suite.Suite, expected_, r.Table("doesntexist").Config(), suite.session, r.RunOpts{ 1181 GeometryFormat: "raw", 1182 GroupFormat: "map", 1183 }) 1184 suite.T().Log("Finished running line #327") 1185 } 1186 1187 { 1188 // meta/table.yaml line #330 1189 /* err('ReqlOpFailedError', 'Table `test.test2B` does not exist.', []) */ 1190 var expected_ Err = err("ReqlOpFailedError", "Table `test.test2B` does not exist.") 1191 /* r.table('test2B').config() */ 1192 1193 suite.T().Log("About to run line #330: r.Table('test2B').Config()") 1194 1195 runAndAssert(suite.Suite, expected_, r.Table("test2B").Config(), suite.session, r.RunOpts{ 1196 GeometryFormat: "raw", 1197 GroupFormat: "map", 1198 }) 1199 suite.T().Log("Finished running line #330") 1200 } 1201 1202 { 1203 // meta/table.yaml line #333 1204 /* True */ 1205 var expected_ bool = true 1206 /* r.db('rethinkdb').table('table_config').filter({'name':'testA'}).nth(0).eq(r.table('testA').config()) */ 1207 1208 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())") 1209 1210 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{ 1211 GeometryFormat: "raw", 1212 GroupFormat: "map", 1213 }) 1214 suite.T().Log("Finished running line #333") 1215 } 1216 1217 { 1218 // meta/table.yaml line #336 1219 /* True */ 1220 var expected_ bool = true 1221 /* r.db('rethinkdb').table('table_status').filter({'name':'testA'}).nth(0).eq(r.table('testA').status()) */ 1222 1223 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())") 1224 1225 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{ 1226 GeometryFormat: "raw", 1227 GroupFormat: "map", 1228 }) 1229 suite.T().Log("Finished running line #336") 1230 } 1231 1232 { 1233 // meta/table.yaml line #339 1234 /* uuid() */ 1235 var expected_ compare.Regex = compare.IsUUID() 1236 /* r.db('rethinkdb').table('table_config', identifier_format='uuid').nth(0)["db"] */ 1237 1238 suite.T().Log("About to run line #339: r.DB('rethinkdb').Table('table_config').OptArgs(r.TableOpts{IdentifierFormat: 'uuid', }).Nth(0).AtIndex('db')") 1239 1240 runAndAssert(suite.Suite, expected_, r.DB("rethinkdb").Table("table_config").OptArgs(r.TableOpts{IdentifierFormat: "uuid"}).Nth(0).AtIndex("db"), suite.session, r.RunOpts{ 1241 GeometryFormat: "raw", 1242 GroupFormat: "map", 1243 }) 1244 suite.T().Log("Finished running line #339") 1245 } 1246 1247 { 1248 // meta/table.yaml line #344 1249 /* 0 */ 1250 var expected_ int = 0 1251 /* r.table('testA', identifier_format='uuid').count() */ 1252 1253 suite.T().Log("About to run line #344: r.Table('testA').OptArgs(r.TableOpts{IdentifierFormat: 'uuid', }).Count()") 1254 1255 runAndAssert(suite.Suite, expected_, r.Table("testA").OptArgs(r.TableOpts{IdentifierFormat: "uuid"}).Count(), suite.session, r.RunOpts{ 1256 GeometryFormat: "raw", 1257 GroupFormat: "map", 1258 }) 1259 suite.T().Log("Finished running line #344") 1260 } 1261 1262 { 1263 // meta/table.yaml line #358 1264 /* partial({'tables_dropped':1}) */ 1265 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) 1266 /* db.table_drop('testA') */ 1267 1268 suite.T().Log("About to run line #358: db.TableDrop('testA')") 1269 1270 runAndAssert(suite.Suite, expected_, db.TableDrop("testA"), suite.session, r.RunOpts{ 1271 GeometryFormat: "raw", 1272 GroupFormat: "map", 1273 }) 1274 suite.T().Log("Finished running line #358") 1275 } 1276 1277 { 1278 // meta/table.yaml line #361 1279 /* partial({'tables_dropped':1}) */ 1280 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) 1281 /* db.table_drop('testB') */ 1282 1283 suite.T().Log("About to run line #361: db.TableDrop('testB')") 1284 1285 runAndAssert(suite.Suite, expected_, db.TableDrop("testB"), suite.session, r.RunOpts{ 1286 GeometryFormat: "raw", 1287 GroupFormat: "map", 1288 }) 1289 suite.T().Log("Finished running line #361") 1290 } 1291 1292 { 1293 // meta/table.yaml line #364 1294 /* partial({'dbs_dropped':1,'tables_dropped':1}) */ 1295 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_dropped": 1, "tables_dropped": 1}) 1296 /* r.db_drop('test2') */ 1297 1298 suite.T().Log("About to run line #364: r.DBDrop('test2')") 1299 1300 runAndAssert(suite.Suite, expected_, r.DBDrop("test2"), suite.session, r.RunOpts{ 1301 GeometryFormat: "raw", 1302 GroupFormat: "map", 1303 }) 1304 suite.T().Log("Finished running line #364") 1305 } 1306 }