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

     1  #! /usr/bin/env expect -f
     2  
     3  source [file join [file dirname $argv0] common.tcl]
     4  
     5  start_server $argv
     6  
     7  spawn /bin/bash
     8  send "PS1=':''/# '\r"
     9  eexpect ":/# "
    10  
    11  start_test "Check that the startrek example can be loaded in the db."
    12  send "$argv gen example-data startrek | $argv sql\r"
    13  eexpect ":/# "
    14  send "echo \$?\r"
    15  eexpect "0\r\n:/# "
    16  end_test
    17  
    18  start_test "Check that the startrek example is loaded."
    19  send "$argv sql -e 'SELECT count(*) FROM startrek.quotes'\r"
    20  eexpect "count"
    21  eexpect "200"
    22  eexpect "1 row"
    23  eexpect ":/# "
    24  end_test
    25  
    26  start_test "Check that the intro example can be loaded in the db."
    27  send "$argv gen example-data intro | $argv sql\r"
    28  eexpect ":/# "
    29  send "echo \$?\r"
    30  eexpect "0\r\n:/# "
    31  end_test
    32  
    33  start_test "Check that the startrek example is loaded."
    34  send "$argv sql -e 'SELECT count(*) FROM intro.mytable'\r"
    35  eexpect "count"
    36  eexpect "42"
    37  eexpect "1 row"
    38  eexpect ":/# "
    39  end_test
    40  
    41  # Clean up.
    42  send "exit 0\r"
    43  eexpect eof
    44  
    45  stop_server $argv