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

     1  #! /usr/bin/env expect -f
     2  
     3  source [file join [file dirname $argv0] common.tcl]
     4  
     5  # We stop the server before each test to ensure the log file is
     6  # flushed and not in the middle of a rotation.
     7  
     8  start_server $argv
     9  
    10  start_test "Check that the cluster ID is reported at the start of the first log file."
    11  spawn tail -n 1000 -F logs/db/logs/cockroach.log
    12  eexpect "\\\[config\\\] clusterID:"
    13  eexpect "node startup completed"
    14  end_test
    15  
    16  stop_server $argv
    17  
    18  
    19  # Make a server with a tiny log buffer so as to force frequent log rotation.
    20  system "$argv start-single-node --insecure --pid-file=server_pid --background -s=path=logs/db --log-file-max-size=2k >>logs/expect-cmd.log 2>&1;
    21          $argv sql --insecure -e 'select 1'"
    22  # Stop the server, which also flushes and closes the log files.
    23  stop_server $argv
    24  
    25  start_test "Check that the cluster ID is reported at the start of new log files."
    26  # Verify that the string "restarted pre-existing node" can be found
    27  # somewhere. This ensures that if this string ever changes, the test
    28  # below won't report a false negative.
    29  system "grep -q 'restarted pre-existing node' logs/db/logs/*.log"
    30  # Verify that "cockroach.log" is not the file where the server reports
    31  # it just started.
    32  system "if grep -q 'restarted pre-existing node' logs/db/logs/cockroach.log; then false; fi"
    33  # Verify that the last log file does contain the cluster ID.
    34  system "grep -qF '\[config\] clusterID:' logs/db/logs/cockroach.log"
    35  end_test