|
1 | 1 | #! /usr/bin/env expect -f
|
2 | 2 |
|
3 |
| -# TODO(141942): Re-enable this test once we have investigated its flakiness. |
4 |
| - |
5 | 3 | source [file join [file dirname $argv0] common.tcl]
|
6 | 4 |
|
7 |
| -spawn $argv demo --no-line-editor --empty --nodes 3 --multitenant --log-dir=logs |
| 5 | +set ::env(COCKROACH_DEMO_PASSWORD) "hunter2hunter2hunter2hunter2" |
| 6 | + |
| 7 | +spawn $argv demo --no-line-editor --empty --nodes 5 --multitenant --log-dir=logs |
8 | 8 |
|
9 | 9 | start_test "Check that the demo cluster starts properly"
|
10 | 10 | eexpect "Welcome"
|
@@ -43,31 +43,67 @@ eexpect "defaultdb>"
|
43 | 43 | end_test
|
44 | 44 |
|
45 | 45 | start_test "Check that the demo add command adds a node with no error in ls"
|
46 |
| -send "\\demo add region=us-east-1\r" |
47 |
| -eexpect "node 4 has been added" |
| 46 | +send "\\demo add region=us-west1\r" |
| 47 | +eexpect "node 6 has been added" |
48 | 48 | eexpect "defaultdb>"
|
49 | 49 | send "\\demo ls\r"
|
50 | 50 | eexpect "node 1:"
|
51 | 51 | eexpect "node 2:"
|
52 | 52 | eexpect "node 3:"
|
53 | 53 | eexpect "node 4:"
|
| 54 | +eexpect "node 5:" |
| 55 | +eexpect "node 6:" |
54 | 56 | eexpect "Application tenant:"
|
55 | 57 | eexpect "System tenant:"
|
56 | 58 | eexpect "defaultdb>"
|
57 | 59 | end_test
|
58 | 60 |
|
59 | 61 | start_test "Check that a node can be restarted"
|
60 |
| -send "\\demo shutdown 4\r" |
61 |
| -eexpect "node 4 has been shutdown" |
| 62 | + |
| 63 | +# Switch to system tenant to check the liveness range. |
| 64 | +send "\\connect - - - - tenant=system\r" |
| 65 | +eexpect "the cluster ID has changed!" |
| 66 | +eexpect "defaultdb>" |
| 67 | + |
| 68 | +# Wait for the liveness range to have the default 5 voters. If its replication |
| 69 | +# factor is too low, shutting down the node below can cause it to lose quorum |
| 70 | +# and stall the shutdown command (example: #147867). |
| 71 | +set timeout 2 |
| 72 | +set stmt "select range_id, array_length(voting_replicas,1) from crdb_internal.ranges where range_id=2;\r" |
| 73 | +send $stmt |
| 74 | +expect { |
| 75 | + "2 | 5" { |
| 76 | + puts "\rliveness range has 5 voters" |
| 77 | + } |
| 78 | + timeout { |
| 79 | + puts "\rliveness range does not yet have 5 voters" |
| 80 | + sleep 2 |
| 81 | + send $stmt |
| 82 | + exp_continue |
| 83 | + } |
| 84 | +} |
| 85 | +# Reset timeout back to 45 to match common.tcl. |
| 86 | +set timeout 45 |
| 87 | +eexpect "defaultdb>" |
| 88 | + |
| 89 | +# Switch back to application tenant for the rest of the test. |
| 90 | +send "\\connect - - - - tenant=demoapp\r" |
| 91 | +eexpect "the cluster ID has changed!" |
| 92 | +eexpect "defaultdb>" |
| 93 | + |
| 94 | +send "\\demo shutdown 6\r" |
| 95 | +eexpect "node 6 has been shutdown" |
62 | 96 | eexpect "defaultdb>"
|
63 |
| -send "\\demo restart 4\r" |
64 |
| -eexpect "node 4 has been restarted" |
| 97 | +send "\\demo restart 6\r" |
| 98 | +eexpect "node 6 has been restarted" |
65 | 99 | eexpect "defaultdb>"
|
66 | 100 | send "\\demo ls\r"
|
67 | 101 | eexpect "node 1:"
|
68 | 102 | eexpect "node 2:"
|
69 | 103 | eexpect "node 3:"
|
70 | 104 | eexpect "node 4:"
|
| 105 | +eexpect "node 5:" |
| 106 | +eexpect "node 6:" |
71 | 107 | eexpect "Application tenant:"
|
72 | 108 | eexpect "System tenant:"
|
73 | 109 | eexpect "defaultdb>"
|
|
0 commit comments