-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conversation
There was a problem hiding this 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}"); |
There was a problem hiding this comment.
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:
.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 = [] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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.
Closing in favor of #1471. |
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.