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

test: enable testing against a live node #1257

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

iqdecay
Copy link
Contributor

@iqdecay iqdecay commented Jan 22, 2024

This PR closes #1135 by adding a new feature test-against-live-node which can be turned on to run some integration tests against a live node.
For some of them, to avoid SqueezedOutTransaction errors, I added a sleep call.

Copy link
Member

@Br1ght0ne Br1ght0ne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left a minor suggestion.

}
let provider = Provider::connect(TESTNET_NODE_URL)
.await
.expect("Should be able to connect to {TESTNET_NODE_URL}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect you wanted the value to be interpolated here:

Suggested change
.expect("Should be able to connect to {TESTNET_NODE_URL}");
.unwrap_or_else(|_| panic!("Should be able to connect to {TESTNET_NODE_URL}"));

Note

why not expect(&format!(...))? See this clippy lint

@@ -35,3 +35,4 @@ which = { workspace = true, default-features = false }
default = ["fuels-accounts", "std"]
std = ["fuels-accounts?/std", "fuels-core/std"]
fuel-core-lib = ["fuel-core"]
test-against-live-node = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather we don't introduce a feature if we don't have to. Since the test code compiles always (unlike the case with full sway type paths tests) I'd rather we make the decision to target the test net based on an env variable:

if env!(TARGET_TEST_NET) ... 

This way our internal testing approach doesn't leak into user features.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went this direction because that was what transpired in the previous discussion here. Happy to change it though.

@@ -85,6 +86,44 @@ pub async fn launch_custom_provider_and_get_wallets(
Ok(wallets)
}

pub async fn connect_to_testnet_node_and_get_wallets(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't put these in the test helpers crate. The test helpers contain stuff we deem to be useful to all users. This is more of our internal desire to test the testnet. Why limit our users to stuff like:

  • no more than 3 wallets
  • the test net must be the official one from fuel (URL hardcoded)
  • the env variables must be strictly the ones we set here (TEST_WALLET_SECRET_KEY_*)
  • etc

I'd rather we move this helper to our e2e tests and have it be private there since they are the only reason this exists.

Base automatically changed from iqdecay/chore-use-beta5-live to master May 7, 2024 10:46
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

Successfully merging this pull request may close these issues.

None yet

3 participants