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

     1  #! /usr/bin/env expect -f
     2  
     3  source [file join [file dirname $argv0] common.tcl]
     4  
     5  spawn /bin/bash
     6  
     7  send "PS1='\\h:''/# '\r"
     8  eexpect ":/# "
     9  
    10  start_test "Check that the server emits a goroutine dump upon receiving signal"
    11  send "$argv start --insecure --pid-file=server_pid --log-dir=logs --logtostderr\r"
    12  eexpect "CockroachDB node starting"
    13  
    14  system "kill -QUIT `cat server_pid`"
    15  eexpect "received signal 'quit'"
    16  eexpect "\nI*stack traces:"
    17  eexpect "RunAsyncTask"
    18  eexpect "server drained and shutdown completed"
    19  # Check that the server eventually terminates.
    20  eexpect ":/# "
    21  end_test
    22  
    23  start_test "Check that the client also can generate goroutine dumps."
    24  send "$argv demo --empty\r"
    25  eexpect root@
    26  # Dump goroutines in server.
    27  system "killall -QUIT `basename \$(realpath $argv)`"
    28  eexpect "SIGQUIT: quit"
    29  eexpect "RunAsyncTask"
    30  # Check that the client terminates.
    31  eexpect ":/# "
    32  end_test
    33  
    34  send "exit\r"
    35  eexpect eof