Skip to content

Commit e004e48

Browse files
committed
local-cluster: add tests
1 parent f016414 commit e004e48

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

local-cluster/tests/local_cluster.rs

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6223,9 +6223,8 @@ fn test_alpenglow_imbalanced_stakes_catchup() {
62236223
);
62246224
}
62256225

6226-
fn test_alpenglow_migration(num_nodes: usize) {
6226+
fn test_alpenglow_migration(num_nodes: usize, test_name: &str) -> LocalCluster {
62276227
solana_logger::setup_with_default(AG_DEBUG_LOG_FILTER);
6228-
let test_name = &format!("test_alpenglow_migration_{num_nodes}");
62296228

62306229
let vote_listener_socket = solana_net_utils::bind_to_localhost().unwrap();
62316230
let vote_listener_addr = vote_listener_socket.try_clone().unwrap();
@@ -6341,24 +6340,49 @@ fn test_alpenglow_migration(num_nodes: usize) {
63416340

63426341
// Additionally ensure that roots are being made
63436342
cluster.check_for_new_roots(8, test_name, SocketAddrSpace::Unspecified);
6343+
cluster
63446344
}
63456345

63466346
#[test]
63476347
#[serial]
63486348
fn test_alpenglow_migration_1() {
6349-
test_alpenglow_migration(1)
6349+
test_alpenglow_migration(1, "test_alpenglow_migration_1");
63506350
}
63516351

63526352
#[test]
63536353
#[serial]
63546354
fn test_alpenglow_migration_2() {
6355-
test_alpenglow_migration(2)
6355+
test_alpenglow_migration(2, "test_alpenglow_migration_2");
63566356
}
63576357

63586358
#[test]
63596359
#[serial]
63606360
fn test_alpenglow_migration_4() {
6361-
test_alpenglow_migration(4)
6361+
test_alpenglow_migration(4, "test_alpenglow_migration_4");
6362+
}
6363+
6364+
#[test]
6365+
#[serial]
6366+
fn test_alpenglow_restart_post_migration() {
6367+
let test_name = "test_alpenglow_restart_post_migration";
6368+
6369+
// Start a 2 node cluster and have it go through the migration
6370+
let mut cluster = test_alpenglow_migration(2, test_name);
6371+
6372+
// Now restart one of the nodes. This causes the cluster to temporarily halt
6373+
let node_pubkey = cluster.get_node_pubkeys()[0];
6374+
cluster.exit_restart_node(
6375+
&node_pubkey,
6376+
safe_clone_config(&cluster.validators.get(&node_pubkey).unwrap().config),
6377+
SocketAddrSpace::Unspecified,
6378+
);
6379+
6380+
// The restarted node will startup from genesis (0) so this test verifies the following:
6381+
// - When processing the feature flag activation during startup increment `PreFeatureActivation` -> `Migration`
6382+
// - When processing the first alpenglow block during startup increment `Migration` -> `ReadyToEnable`
6383+
// - If we reach `ReadyToEnable` during startup, enable alpenglow
6384+
// - Ensure that during startup we set ticks correctly
6385+
cluster.check_for_new_roots(8, test_name, SocketAddrSpace::Unspecified);
63626386
}
63636387

63646388
fn broadcast_vote(

0 commit comments

Comments
 (0)