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

End-to-end tests contracts fails despite correct node setup #1875

Closed
0xf333 opened this issue Aug 14, 2023 · 3 comments
Closed

End-to-end tests contracts fails despite correct node setup #1875

0xf333 opened this issue Aug 14, 2023 · 3 comments
Assignees

Comments

@0xf333
Copy link

0xf333 commented Aug 14, 2023

Description:

End-to-end tests (e2e-tests feature) for the Ink contracts fail to run even when substrate-contracts-node is installed and setup properly.



Steps to Reproduce:

  1. Make sure you have the latest substrate-contracts-node and cargo-contract installed; if you don't please run:
cargo install contracts-node --git https://github.com/paritytech/substrate-contracts-node.git

and

cargo install cargo-contract --force
  1. clone this repo
git clone https://github.com/0xf333/scenario_for_E2E_test_issue
  1. Navigate to the flipper contract directory:
cd scenario_for_E2E_test_issue/issue/flipper
  1. First, run the following command to build:
cargo contract build --release
  1. And then run this command for the E2E test:
cargo test --features e2e-tests


Expected Behavior:

The E2E test should run successfully.

Actual Behavior:

The E2E test fails regardless of having substrate-contracts-node installed. Even if you are running the node in the background and then run the E2E test, it will still fail.

before.mp4


Environment:

OS: Debian
cargo-contract version 3.0.1
ink! version: 4.2.1
ink_e2e version: 4.2.1
substrate-contracts-node version: 0.30.0-72e68577688
Rustc version: 1.71.1 stable

.

0xf333 added a commit to 0xf333/ink that referenced this issue Aug 14, 2023
This commit addresses the issue where e2e-tests for ink contracts
are failing even with the correct substrate-contracts-node setup.

Change made
===========
- I've Introduced `tokio::task::spawn_blocking` to offload the
  task of reading the substrate process's output to a separate
  thread since the previous approach wasn't working.
- I've used `std::sync::mpsc` channel to relay the extracted port
  from the reader thread back to the main async context.
- I've improved the `find_substrate_port_from_output` function to
  ensure continuous reading of process output, in order to prevent
  potential blockages.

Note:
=====
For details on how to test this fix, please read the PR write up.

Impact:
=======
This commit addresses issue use-ink#1875
0xf333 added a commit to 0xf333/ink that referenced this issue Aug 14, 2023
This commit addresses the issue where e2e-tests for ink contracts
are failing even with the correct substrate-contracts-node setup.

Change made
===========
- I've Introduced `tokio::task::spawn_blocking` to offload the
  task of reading the substrate process's output to a separate
  thread since the previous approach wasn't working.
- I've used `std::sync::mpsc` channel to relay the extracted port
  from the reader thread back to the main async context.
- I've improved the `find_substrate_port_from_output` function to
  ensure continuous reading of process output, in order to prevent
  potential blockages.

Note:
=====
For details on how to test this fix, please read the PR write up.

Impact:
=======
This commit addresses issue use-ink#1875
0xf333 added a commit to 0xf333/ink that referenced this issue Aug 14, 2023
This commit addresses the issue where e2e-tests for ink contracts
are failing even with the correct substrate-contracts-node setup.

Change made
===========
- I've Introduced `tokio::task::spawn_blocking` to offload the
  task of reading the substrate process's output to a separate
  thread since the previous approach wasn't working.
- I've used `std::sync::mpsc` channel to relay the extracted port
  from the reader thread back to the main async context.
- I've improved the `find_substrate_port_from_output` function to
  ensure continuous reading of process output, in order to prevent
  potential blockages.

Note:
=====
For details on how to test this fix, please read the PR write up.

Impact:
=======
This commit addresses issue use-ink#1875
0xf333 added a commit to 0xf333/ink that referenced this issue Aug 14, 2023
This commit addresses the issue where e2e-tests for ink contracts
are failing even with the correct substrate-contracts-node setup.

Change made
===========
- I've Introduced `tokio::task::spawn_blocking` to offload the
  task of reading the substrate process's output to a separate
  thread since the previous approach wasn't working.
- I've used `std::sync::mpsc` channel to relay the extracted port
  from the reader thread back to the main async context.
- I've improved the `find_substrate_port_from_output` function to
  ensure continuous reading of process output, in order to prevent
  potential blockages.

Note:
=====
For details on how to test this fix, please read the PR write up.

Impact:
=======
This commit addresses issue use-ink#1875
0xf333 added a commit to 0xf333/ink that referenced this issue Aug 14, 2023
This commit addresses the issue where e2e-tests for ink contracts
are failing even with the correct substrate-contracts-node setup.

Change made
===========
- I've Introduced `tokio::task::spawn_blocking` to offload the
  task of reading the substrate process's output to a separate
  thread since the previous approach wasn't working.
- I've used `std::sync::mpsc` channel to relay the extracted port
  from the reader thread back to the main async context.
- I've improved the `find_substrate_port_from_output` function to
  ensure continuous reading of process output, in order to prevent
  potential blockages.

Note:
=====
For details on how to test this fix, please read the PR write up.

Impact:
=======
This commit addresses issue use-ink#1875
0xf333 added a commit to 0xf333/ink that referenced this issue Aug 14, 2023
This commit addresses the issue where e2e-tests for ink contracts
are failing even with the correct substrate-contracts-node setup.

Change made
===========
- I've Introduced `tokio::task::spawn_blocking` to offload the
  task of reading the substrate process's output to a separate
  thread since the previous approach wasn't working.
- I've used `std::sync::mpsc` channel to relay the extracted port
  from the reader thread back to the main async context.
- I've improved the `find_substrate_port_from_output` function to
  ensure continuous reading of process output, in order to prevent
  potential blockages.

Note:
=====
For details on how to test this fix, please read the PR write up.

Impact:
=======
This commit addresses issue use-ink#1875
0xf333 added a commit to 0xf333/ink that referenced this issue Aug 14, 2023
This commit addresses the issue where e2e-tests for ink contracts
are failing even with the correct substrate-contracts-node setup.

Change made
===========
- I've Introduced `tokio::task::spawn_blocking` to offload the
  task of reading the substrate process's output to a separate
  thread since the previous approach wasn't working.
- I've used `std::sync::mpsc` channel to relay the extracted port
  from the reader thread back to the main async context.
- I've improved the `find_substrate_port_from_output` function to
  ensure continuous reading of process output, in order to prevent
  potential blockages.

Note:
=====
For details on how to test this fix, please read the PR write up.

Impact:
=======
This commit addresses issue use-ink#1875
0xf333 added a commit to 0xf333/ink that referenced this issue Aug 14, 2023
This commit addresses the issue where e2e-tests for ink contracts
are failing even with the correct substrate-contracts-node setup.

Change made
===========
- I've Introduced `tokio::task::spawn_blocking` to offload the
  task of reading the substrate process's output to a separate
  thread since the previous approach wasn't working.
- I've used `std::sync::mpsc` channel to relay the extracted port
  from the reader thread back to the main async context.
- I've improved the `find_substrate_port_from_output` function to
  ensure continuous reading of process output, in order to prevent
  potential blockages.

Note:
=====
For details on how to test this fix, please read the PR write up.

Impact:
=======
This commit addresses issue use-ink#1875
0xf333 added a commit to 0xf333/ink that referenced this issue Aug 14, 2023
This commit addresses the issue where e2e-tests for ink contracts
are failing even with the correct substrate-contracts-node setup.

Change made
===========
- I've Introduced `tokio::task::spawn_blocking` to offload the
  task of reading the substrate process's output to a separate
  thread since the previous approach wasn't working.
- I've used `std::sync::mpsc` channel to relay the extracted port
  from the reader thread back to the main async context.
- I've improved the `find_substrate_port_from_output` function to
  ensure continuous reading of process output, in order to prevent
  potential blockages.

Note:
=====
For details on how to test this fix, please read the PR write up.

Impact:
=======
This commit addresses issue use-ink#1875
0xf333 added a commit to 0xf333/ink that referenced this issue Aug 14, 2023
This commit addresses the issue where e2e-tests for ink contracts
are failing even with the correct substrate-contracts-node setup.

Change made
===========
- I've Introduced `tokio::task::spawn_blocking` to offload the
  task of reading the substrate process's output to a separate
  thread since the previous approach wasn't working.
- I've used `std::sync::mpsc` channel to relay the extracted port
  from the reader thread back to the main async context.
- I've improved the `find_substrate_port_from_output` function to
  ensure continuous reading of process output, in order to prevent
  potential blockages.

Note:
=====
For details on how to test this fix, please read the PR write up.

Impact:
=======
This commit addresses issue use-ink#1875
0xf333 added a commit to 0xf333/ink that referenced this issue Aug 14, 2023
This commit addresses the issue where e2e-tests for ink contracts
are failing even with the correct substrate-contracts-node setup.

Change made
===========
- I've Introduced `tokio::task::spawn_blocking` to offload the
  task of reading the substrate process's output to a separate
  thread since the previous approach wasn't working.
- I've used `std::sync::mpsc` channel to relay the extracted port
  from the reader thread back to the main async context.
- I've improved the `find_substrate_port_from_output` function to
  ensure continuous reading of process output, in order to prevent
  potential blockages.

Note:
=====
For details on how to test this fix, please read the PR write up.

Impact:
=======
This commit addresses issue use-ink#1875
@SkymanOne SkymanOne self-assigned this Aug 14, 2023
@SkymanOne
Copy link
Contributor

Related to use-ink/cargo-contract#1239 (comment)

@ascjones
Copy link
Collaborator

ascjones commented Aug 15, 2023

I believe the problem here is that the latest substrate-contracts-node is not compatible with the released 4.2.1 of ink_e2e on crates.io. This is because of changes to the port discovery string.

ink! version: 4.2.1
ink_e2e version: 4.2.1
substrate-contracts-node version: 0.30.0-72e68577688

^^ These are not compatible. You need an earlier substrate-contracts-node version for 4.2.1

Otherwise use ink master branch which is compatible with substrate-contracts-node version: 0.30.0-72e68577688

See #1876 (review)

@ascjones
Copy link
Collaborator

This should be fixed in 4.3.0 and also 5.0.0-alpha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants