Skip to content
Snippets Groups Projects
Unverified Commit c3356c44 authored by Javier Viola's avatar Javier Viola Committed by GitHub
Browse files

fix native in ci and add test (#264)

parent dfdb3103
Branches
No related merge requests found
Pipeline #498456 failed with stage
in 22 minutes and 44 seconds
......@@ -36,3 +36,26 @@ k8s-integration-test-smoke:
CI_IMAGE: !reference [.ci-unified, variables, CI_IMAGE]
RUN_IN_CI: "1"
ZOMBIE_PROVIDER: "k8s"
native-integration-test:
stage: integration-test
<<: *common-refs
image: "${CI_IMAGE}"
tags:
- zombienet-polkadot-integration-test
script:
# download latest stable `polkadot-stable2407-2` // TODO: impl zombie-cli
- >
for bin in polkadot polkadot-execute-worker polkadot-prepare-worker; do
echo "downloading $bin";
curl -L -o /tmp/$bin https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-stable2407-2/$bin;
chmod 755 /tmp/$bin;
done
- ls -ltr /tmp
- export PATH=/tmp:$PATH
- echo $PATH
- RUST_LOG=zombienet_orchestrator=debug,zombienet_provider=debug cargo test --test smoke-native -- --nocapture
variables:
CI_IMAGE: !reference [.ci-unified, variables, CI_IMAGE]
RUN_IN_CI: "1"
ZOMBIE_PROVIDER: "native"
\ No newline at end of file
......@@ -475,7 +475,9 @@ fn validate_spec_with_provider_capabilities(
!parts.iter().any(|part| {
let path_to = format!("{}/{}", part, cmd);
trace!("checking {path_to}");
std::fs::metadata(path_to).is_ok()
let check_result = std::fs::metadata(path_to);
trace!("result {:?}", check_result);
check_result.is_ok()
})
};
......
......@@ -206,8 +206,13 @@ where
let (rpc_port_external, prometheus_port_external);
// Create port-forward iff we are not in CI
if !running_in_ci() {
// Create port-forward iff we are in CI and with k8s provider
if running_in_ci() && ctx.ns.capabilities().use_default_ports_in_cmd {
// running kubernets in ci require to use ip and default port
(rpc_port_external, prometheus_port_external) = (RPC_PORT, PROMETHEUS_PORT);
ip_to_use = running_node.ip().await?;
} else {
// Create port-forward iff we are not in CI or provider doesn't use the default ports (native)
let ports = futures::future::try_join_all(vec![
running_node.create_port_forward(node.rpc_port.0, RPC_PORT),
running_node.create_port_forward(node.prometheus_port.0, PROMETHEUS_PORT),
......@@ -218,10 +223,6 @@ where
ports[0].unwrap_or(node.rpc_port.0),
ports[1].unwrap_or(node.prometheus_port.0),
);
} else {
// running in ci require to use ip and default port
(rpc_port_external, prometheus_port_external) = (RPC_PORT, PROMETHEUS_PORT);
ip_to_use = running_node.ip().await?;
}
let ws_uri = format!("ws://{}:{}", ip_to_use, rpc_port_external);
......
use std::time::Instant;
use configuration::{NetworkConfig, NetworkConfigBuilder};
use zombienet_sdk::environment::get_spawn_fn;
fn small_network() -> NetworkConfig {
NetworkConfigBuilder::new()
.with_relaychain(|r| {
r.with_chain("rococo-local")
.with_default_command("polkadot")
.with_default_image("docker.io/parity/polkadot:v1.7.0")
.with_node(|node| node.with_name("alice"))
.with_node(|node| node.with_name("bob"))
})
.build()
.unwrap()
}
#[tokio::test(flavor = "multi_thread")]
async fn ci_native_smoke_should_works() {
tracing_subscriber::fmt::init();
const BEST_BLOCK_METRIC: &str = "block_height{status=\"best\"}";
let now = Instant::now();
let config = small_network();
let spawn_fn = get_spawn_fn();
let network = spawn_fn(config).await.unwrap();
let elapsed = now.elapsed();
println!("🚀🚀🚀🚀 network deployed in {:.2?}", elapsed);
// Get a ref to the node
let alice = network.get_node("alice").unwrap();
// wait 10 blocks
alice
.wait_metric(BEST_BLOCK_METRIC, |x| x > 9_f64)
.await
.unwrap();
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment