github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/cli/interactive_tests/test_demo_workload.tcl (about)

     1  #! /usr/bin/env expect -f
     2  
     3  source [file join [file dirname $argv0] common.tcl]
     4  
     5  start_test "Check cockroach demo --with-load runs the movr workload"
     6  
     7  # Start demo with movr and the movr workload.
     8  spawn $argv demo movr --with-load
     9  
    10  eexpect "movr>"
    11  
    12  # Try a few times, but expect that we eventually see the workload
    13  # queries show up as the highest count queries in the system.
    14  
    15  set workloadRunning 0
    16  
    17  for {set i 0} {$i < 10} {incr i} {
    18    set timeout 1
    19    send "select key from crdb_internal.node_statement_statistics order by count desc limit 1;\r"
    20    expect {
    21      "SELECT city, id FROM vehicles WHERE city = \$1" {
    22        set workloadRunning 1
    23        break
    24      }
    25      timeout {}
    26    }
    27  }
    28  
    29  if {!$workloadRunning} {
    30    report "Workload is not running"
    31    exit 1
    32  }
    33  
    34  interrupt
    35  eexpect eof
    36  end_test
    37  
    38  # Ensure that cockroach demo with the movr workload can control the number of ranges that tables are split into.
    39  start_test "Check that controlling ranges of the movr dataset works"
    40  # Reset the timeout.
    41  set timeout 30
    42  spawn $argv demo movr --num-ranges=6
    43  
    44  eexpect "movr>"
    45  
    46  send "SELECT count(*) FROM \[SHOW RANGES FROM TABLE USERS\];\r"
    47  eexpect "6"
    48  eexpect "(1 row)"
    49  
    50  interrupt
    51  eexpect eof
    52  end_test