Ignore certain tests

This commit is contained in:
Omar Abdulla
2025-10-05 17:52:09 +03:00
parent 329440c05e
commit 99b2618328
4 changed files with 101 additions and 11 deletions
+7 -4
View File
@@ -110,8 +110,11 @@ impl Process {
} }
let check_result = let check_result =
check_function(stdout_line.as_deref(), stderr_line.as_deref()) check_function(stdout_line.as_deref(), stderr_line.as_deref()).context(
.context("Failed to wait for the process to be ready")?; format!(
"Failed to wait for the process to be ready - {stdout} - {stderr}"
),
)?;
if check_result { if check_result {
break; break;
@@ -127,10 +130,10 @@ impl Process {
ProcessReadinessWaitBehavior::WaitForCommandToExit => { ProcessReadinessWaitBehavior::WaitForCommandToExit => {
if !child if !child
.wait() .wait()
.context("Failed waiting for kurtosis run process to finish")? .context("Failed waiting for process to finish")?
.success() .success()
{ {
anyhow::bail!("Failed to initialize kurtosis network",); anyhow::bail!("Failed to spawn command");
} }
} }
} }
+41 -2
View File
@@ -734,12 +734,44 @@ mod tests {
(context, node) (context, node)
} }
fn shared_state() -> &'static (TestExecutionContext, GethNode) {
static STATE: LazyLock<(TestExecutionContext, GethNode)> = LazyLock::new(new_node);
&STATE
}
fn shared_node() -> &'static GethNode { fn shared_node() -> &'static GethNode {
static NODE: LazyLock<(TestExecutionContext, GethNode)> = LazyLock::new(new_node); &shared_state().1
&NODE.1 }
#[tokio::test]
async fn node_mines_simple_transfer_transaction_and_returns_receipt() {
// Arrange
let (context, node) = shared_state();
let provider = node.provider().await.expect("Failed to create provider");
let account_address = context
.wallet_configuration
.wallet()
.default_signer()
.address();
let transaction = TransactionRequest::default()
.to(account_address)
.value(U256::from(100_000_000_000_000u128));
// Act
let receipt = provider.send_transaction(transaction).await;
// Assert
let _ = receipt
.expect("Failed to send the transfer transaction")
.get_receipt()
.await
.expect("Failed to get the receipt for the transfer");
} }
#[test] #[test]
#[ignore = "Ignored since they take a long time to run"]
fn version_works() { fn version_works() {
// Arrange // Arrange
let node = shared_node(); let node = shared_node();
@@ -756,6 +788,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_chain_id_from_node() { async fn can_get_chain_id_from_node() {
// Arrange // Arrange
let node = shared_node(); let node = shared_node();
@@ -769,6 +802,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_gas_limit_from_node() { async fn can_get_gas_limit_from_node() {
// Arrange // Arrange
let node = shared_node(); let node = shared_node();
@@ -786,6 +820,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_coinbase_from_node() { async fn can_get_coinbase_from_node() {
// Arrange // Arrange
let node = shared_node(); let node = shared_node();
@@ -803,6 +838,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_block_difficulty_from_node() { async fn can_get_block_difficulty_from_node() {
// Arrange // Arrange
let node = shared_node(); let node = shared_node();
@@ -820,6 +856,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_block_hash_from_node() { async fn can_get_block_hash_from_node() {
// Arrange // Arrange
let node = shared_node(); let node = shared_node();
@@ -837,6 +874,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_block_timestamp_from_node() { async fn can_get_block_timestamp_from_node() {
// Arrange // Arrange
let node = shared_node(); let node = shared_node();
@@ -854,6 +892,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_block_number_from_node() { async fn can_get_block_number_from_node() {
// Arrange // Arrange
let node = shared_node(); let node = shared_node();
@@ -307,6 +307,7 @@ impl LighthouseGethNode {
}), }),
}, },
) )
.context("Failed to spawn the kurtosis enclave")
.inspect_err(|err| { .inspect_err(|err| {
tracing::error!(?err, "Failed to spawn Kurtosis"); tracing::error!(?err, "Failed to spawn Kurtosis");
self.shutdown().expect("Failed to shutdown kurtosis"); self.shutdown().expect("Failed to shutdown kurtosis");
@@ -899,20 +900,46 @@ impl<F: TxFiller<Ethereum>, P: Provider<Ethereum>> ResolverApi
impl Node for LighthouseGethNode { impl Node for LighthouseGethNode {
#[instrument(level = "info", skip_all, fields(lighthouse_node_id = self.id))] #[instrument(level = "info", skip_all, fields(lighthouse_node_id = self.id))]
fn shutdown(&mut self) -> anyhow::Result<()> { fn shutdown(&mut self) -> anyhow::Result<()> {
if !Command::new(self.kurtosis_binary_path.as_path()) let mut child = Command::new(self.kurtosis_binary_path.as_path())
.arg("enclave") .arg("enclave")
.arg("rm") .arg("rm")
.arg("-f") .arg("-f")
.arg(self.enclave_name.as_str()) .arg(self.enclave_name.as_str())
.stdout(Stdio::null()) .stdout(Stdio::piped())
.stderr(Stdio::null()) .stderr(Stdio::piped())
.spawn() .spawn()
.expect("Failed to spawn the enclave kill command") .expect("Failed to spawn the enclave kill command");
if !child
.wait() .wait()
.expect("Failed to wait for the enclave kill command") .expect("Failed to wait for the enclave kill command")
.success() .success()
{ {
panic!("Failed to shut down the enclave {}", self.enclave_name) let stdout = {
let mut stdout = String::default();
child
.stdout
.take()
.expect("Should be piped")
.read_to_string(&mut stdout)
.context("Failed to read stdout of kurtosis inspect to string")?;
stdout
};
let stderr = {
let mut stderr = String::default();
child
.stderr
.take()
.expect("Should be piped")
.read_to_string(&mut stderr)
.context("Failed to read stderr of kurtosis inspect to string")?;
stderr
};
panic!(
"Failed to shut down the enclave {} - stdout: {stdout}, stderr: {stderr}",
self.enclave_name
)
} }
drop(self.process.take()); drop(self.process.take());
@@ -1130,6 +1157,7 @@ mod tests {
} }
#[test] #[test]
#[ignore = "Ignored since they take a long time to run"]
fn version_works() { fn version_works() {
// Arrange // Arrange
let (_context, node) = new_node(); let (_context, node) = new_node();
@@ -1146,6 +1174,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_chain_id_from_node() { async fn can_get_chain_id_from_node() {
// Arrange // Arrange
let (_context, node) = new_node(); let (_context, node) = new_node();
@@ -1159,6 +1188,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_gas_limit_from_node() { async fn can_get_gas_limit_from_node() {
// Arrange // Arrange
let (_context, node) = new_node(); let (_context, node) = new_node();
@@ -1176,6 +1206,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_coinbase_from_node() { async fn can_get_coinbase_from_node() {
// Arrange // Arrange
let (_context, node) = new_node(); let (_context, node) = new_node();
@@ -1193,6 +1224,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_block_difficulty_from_node() { async fn can_get_block_difficulty_from_node() {
// Arrange // Arrange
let (_context, node) = new_node(); let (_context, node) = new_node();
@@ -1210,6 +1242,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_block_hash_from_node() { async fn can_get_block_hash_from_node() {
// Arrange // Arrange
let (_context, node) = new_node(); let (_context, node) = new_node();
@@ -1227,6 +1260,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_block_timestamp_from_node() { async fn can_get_block_timestamp_from_node() {
// Arrange // Arrange
let (_context, node) = new_node(); let (_context, node) = new_node();
@@ -1244,6 +1278,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_block_number_from_node() { async fn can_get_block_number_from_node() {
// Arrange // Arrange
let (_context, node) = new_node(); let (_context, node) = new_node();
@@ -1224,6 +1224,7 @@ mod tests {
} }
#[test] #[test]
#[ignore = "Ignored since they take a long time to run"]
fn test_init_generates_chainspec_with_balances() { fn test_init_generates_chainspec_with_balances() {
let genesis_content = r#" let genesis_content = r#"
{ {
@@ -1277,6 +1278,7 @@ mod tests {
} }
#[test] #[test]
#[ignore = "Ignored since they take a long time to run"]
fn test_parse_genesis_alloc() { fn test_parse_genesis_alloc() {
// Create test genesis file // Create test genesis file
let genesis_json = r#" let genesis_json = r#"
@@ -1319,6 +1321,7 @@ mod tests {
} }
#[test] #[test]
#[ignore = "Ignored since they take a long time to run"]
fn print_eth_to_substrate_mappings() { fn print_eth_to_substrate_mappings() {
let eth_addresses = vec![ let eth_addresses = vec![
"0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1", "0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1",
@@ -1334,6 +1337,7 @@ mod tests {
} }
#[test] #[test]
#[ignore = "Ignored since they take a long time to run"]
fn test_eth_to_substrate_address() { fn test_eth_to_substrate_address() {
let cases = vec![ let cases = vec![
( (
@@ -1364,6 +1368,7 @@ mod tests {
} }
#[test] #[test]
#[ignore = "Ignored since they take a long time to run"]
fn version_works() { fn version_works() {
let node = shared_node(); let node = shared_node();
@@ -1376,6 +1381,7 @@ mod tests {
} }
#[test] #[test]
#[ignore = "Ignored since they take a long time to run"]
fn eth_rpc_version_works() { fn eth_rpc_version_works() {
let node = shared_node(); let node = shared_node();
@@ -1388,6 +1394,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_chain_id_from_node() { async fn can_get_chain_id_from_node() {
// Arrange // Arrange
let node = shared_node(); let node = shared_node();
@@ -1401,6 +1408,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_gas_limit_from_node() { async fn can_get_gas_limit_from_node() {
// Arrange // Arrange
let node = shared_node(); let node = shared_node();
@@ -1418,6 +1426,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_coinbase_from_node() { async fn can_get_coinbase_from_node() {
// Arrange // Arrange
let node = shared_node(); let node = shared_node();
@@ -1435,6 +1444,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_block_difficulty_from_node() { async fn can_get_block_difficulty_from_node() {
// Arrange // Arrange
let node = shared_node(); let node = shared_node();
@@ -1452,6 +1462,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_block_hash_from_node() { async fn can_get_block_hash_from_node() {
// Arrange // Arrange
let node = shared_node(); let node = shared_node();
@@ -1469,6 +1480,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_block_timestamp_from_node() { async fn can_get_block_timestamp_from_node() {
// Arrange // Arrange
let node = shared_node(); let node = shared_node();
@@ -1486,6 +1498,7 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[ignore = "Ignored since they take a long time to run"]
async fn can_get_block_number_from_node() { async fn can_get_block_number_from_node() {
// Arrange // Arrange
let node = shared_node(); let node = shared_node();