Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v4.x.x] fix E2E tests for newer rust toolchain & contracts node #1884

Merged
merged 16 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/e2e/macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ proc-macro = true
[dependencies]
ink_ir = { version = "4.2.1", path = "../../ink/ir" }
cargo_metadata = "0.15.3"
contract-build = "2.0.2"
contract-build = "3.2.0"
derive_more = "0.99.17"
env_logger = "0.10.0"
log = "0.4.17"
Expand Down
6 changes: 5 additions & 1 deletion crates/e2e/macro/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
// limitations under the License.

use crate::ir;
use contract_build::ManifestPath;
use contract_build::{
ManifestPath,
Target,
};
use core::cell::RefCell;
use derive_more::From;
use proc_macro2::TokenStream as TokenStream2;
Expand Down Expand Up @@ -289,6 +292,7 @@ fn build_contract(path_to_cargo_toml: &str) -> String {
lint: false,
output_type: OutputType::HumanReadable,
skip_wasm_validation: false,
target: Target::Wasm,
};

match contract_build::execute(args) {
Expand Down
14 changes: 7 additions & 7 deletions crates/e2e/src/node_proc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ where
.stdout(process::Stdio::piped())
.stderr(process::Stdio::piped())
.arg("--port=0")
.arg("--rpc-port=0")
.arg("--ws-port=0");
.arg("--rpc-port=0");

if let Some(authority) = self.authority {
let authority = format!("{authority:?}");
Expand All @@ -135,21 +134,21 @@ where

// Wait for RPC port to be logged (it's logged to stderr):
let stderr = proc.stderr.take().unwrap();
let ws_port = find_substrate_port_from_output(stderr);
let ws_url = format!("ws://127.0.0.1:{ws_port}");
let port = find_substrate_port_from_output(stderr);
let url = format!("ws://127.0.0.1:{port}");

// Connect to the node with a `subxt` client:
let client = OnlineClient::from_url(ws_url.clone()).await;
let client = OnlineClient::from_url(url.clone()).await;
match client {
Ok(client) => {
Ok(TestNodeProcess {
proc,
client,
url: ws_url.clone(),
url: url.clone(),
})
}
Err(err) => {
let err = format!("Failed to connect to node rpc at {ws_url}: {err}");
let err = format!("Failed to connect to node rpc at {url}: {err}");
log::error!("{}", err);
proc.kill().map_err(|e| {
format!("Error killing substrate process '{}': {}", proc.id(), e)
Expand All @@ -176,6 +175,7 @@ fn find_substrate_port_from_output(r: impl Read + Send + 'static) -> u16 {
.or_else(|| {
line.rsplit_once("Running JSON-RPC WS server: addr=127.0.0.1:")
})
.or_else(|| line.rsplit_once("Running JSON-RPC server: addr=127.0.0.1:"))
.map(|(_, port_str)| port_str)?;

// trim non-numeric chars from the end of the port part of the line.
Expand Down