Skip to content

Commit e7a2bb3

Browse files
fix: tests, address comments
Signed-off-by: venilinvasilev <[email protected]>
1 parent b507ba1 commit e7a2bb3

File tree

6 files changed

+397
-221
lines changed

6 files changed

+397
-221
lines changed

.github/workflows/flow-rust-ci.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,11 @@ jobs:
165165

166166
- name: Prepare Hiero Solo for DAB Tests
167167
id: solo-dab
168-
uses: hiero-ledger/hiero-solo-action@6a1a77601cf3e69661fb6880530a4edf656b40d5 # v0.14.0
168+
uses: hiero-ledger/hiero-solo-action@2576140d0c1bb084c9be2ba59e82a4604c388e06 # branch: 75-add-support-for-multiple-consensus-nodes
169169
with:
170+
hieroVersion: v0.68.0-rc.1
170171
installMirrorNode: true
172+
dualMode: true
171173

172174
- name: Create env file for DAB Tests
173175
run: |
@@ -182,4 +184,4 @@ jobs:
182184
run: |
183185
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
184186
. $HOME/.cargo/env
185-
cargo test --test e2e node::update -- --nocapture
187+
cargo test --test e2e node::update::updates_addressbook_and_retries_after_node_account_id_change -- --nocapture --test-threads=1

protobufs/services

Submodule services updated 2901 files

src/client/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ impl Client {
639639

640640
/// Triggers an immediate network update from the address book.
641641
/// Note: This method is not part of the public API and may be changed or removed in future versions.
642-
pub(crate) async fn update_network_now(&self) {
642+
pub(crate) async fn refresh_network(&self) {
643643
match NodeAddressBookQuery::new()
644644
.execute_mirrornet(self.mirrornet().load().channel(), None)
645645
.await

src/execute.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ pub(crate) trait Execute: ValidateChecksums {
127127
fn response_pre_check_status(response: &Self::GrpcResponse) -> crate::Result<i32>;
128128
}
129129

130+
/// The lifetime `'a` represents the lifetime of the borrowed `Client` reference.
131+
/// This ensures the context cannot outlive the client it references.
130132
struct ExecuteContext<'a> {
131133
// When `Some` the `transaction_id` will be regenerated when expired.
132134
operator_account_id: Option<AccountId>,
@@ -456,7 +458,7 @@ async fn execute_single<'a, E: Execute + Sync>(
456458
)))
457459
}
458460

459-
Status::InvalidNodeAccountId => {
461+
Status::InvalidNodeAccount => {
460462
// The node account is invalid or doesn't match the submitted node
461463
// Mark the node as unhealthy and retry with backoff
462464
// This typically indicates the address book is out of date
@@ -466,8 +468,16 @@ async fn execute_single<'a, E: Execute + Sync>(
466468
"Node at index {node_index} / node id {node_account_id} returned {status:?}, marking unhealthy. Updating address book before retry."
467469
);
468470

469-
// Update the network address book before retrying
470-
ctx.client.update_network_now().await;
471+
// Update the network address book before retrying, but only if mirror network is configured
472+
if !ctx.client.mirror_network().is_empty() {
473+
ctx.client.refresh_network().await;
474+
log::info!("Address book updated");
475+
log::info!("network: {:?}", ctx.client.network());
476+
} else {
477+
log::warn!(
478+
"Cannot update address book: no mirror network configured. Retrying with existing network configuration."
479+
);
480+
}
471481

472482
Err(retry::Error::Transient(executable.make_error_pre_check(
473483
status,

tests/e2e/common/mod.rs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -193,39 +193,3 @@ pub(crate) fn setup_nonfree() -> Option<TestEnvironment> {
193193
}
194194
}
195195
}
196-
197-
/// Setup test environment for non-free tests with local 2-node network.
198-
/// Specifically configured for node update tests with:
199-
/// - Node 0.0.3 at 127.0.0.1:50211
200-
/// - Node 0.0.4 at 127.0.0.1:51211
201-
/// - Mirror network at 127.0.0.1:5600
202-
/// Returns None if TEST_RUN_NONFREE is not set or not on local network.
203-
pub(crate) fn setup_nonfree_local_two_nodes() -> Option<TestEnvironment> {
204-
let _ = dotenvy::dotenv();
205-
let _ = env_logger::builder().parse_default_env().is_test(true).try_init();
206-
207-
let config = &*CONFIG;
208-
209-
if !config.run_nonfree_tests {
210-
log::debug!("skipping non-free test");
211-
return None;
212-
}
213-
214-
if !config.is_local {
215-
log::debug!("skipping test, only runs on local network");
216-
return None;
217-
}
218-
219-
let mut network = HashMap::new();
220-
network.insert("127.0.0.1:50211".to_string(), AccountId::new(0, 0, 3));
221-
network.insert("127.0.0.1:51211".to_string(), AccountId::new(0, 0, 4));
222-
223-
let client = Client::for_network(network).unwrap();
224-
client.set_mirror_network(vec!["127.0.0.1:5600".to_string()]);
225-
226-
if let Some(op) = &config.operator {
227-
client.set_operator(op.account_id, op.private_key.clone());
228-
}
229-
230-
Some(TestEnvironment { config, client })
231-
}

0 commit comments

Comments
 (0)