i am form China , i dont know if its network issue
this is my code
use fuels::{prelude::*, types::ContractId};
// Load abi from json
abigen!(Contract(
name = "MyContract",
abi = "out/debug/counter-contract-abi.json"
));
async fn get_contract_instance() -> (MyContract<WalletUnlocked>, ContractId) {
// Launch a local network and deploy the contract
let mut wallets = launch_custom_provider_and_get_wallets(
WalletsConfig::new(
Some(1), /* Single wallet */
Some(1), /* Single coin (UTXO) */
Some(1_000_000_000), /* Amount per coin */
),
None,
None,
)
.await
.unwrap();
let wallet = wallets.pop().unwrap();
let id = Contract::load_from(
"./out/debug/counter-contract.bin",
LoadConfiguration::default(),
)
.unwrap()
.deploy(&wallet, TxPolicies::default())
.await
.unwrap();
let instance = MyContract::new(id.clone(), wallet);
(instance, id.into())
}
#[tokio::test]
async fn can_get_contract_id() {
let (instance, _id) = get_contract_instance().await;
// Now you have an instance of your contract you can use to test each function
instance.methods().count().call().await.unwrap();
}
#[tokio::test]
async fn test_increment() {
let (instance, _id) = get_contract_instance().await;
// Increment the counter
instance.methods().increment().call().await.unwrap();
// Get the current value of the counter
let result = instance.methods().count().call().await.unwrap();
// Check that the current value of the counter is 1.
// Recall that the initial value of the counter was 0.
assert_eq!(result.value, 1);
}
this is error
cargo test
Finished test [unoptimized + debuginfo] target(s) in 1.05s
Running tests/harness.rs (target/debug/deps/integration_tests-ba92b5ecc759ead1)
running 2 tests
test can_get_contract_id ... FAILED
test test_increment ... FAILED
failures:
---- can_get_contract_id stdout ----
thread 'can_get_contract_id' panicked at tests/harness.rs:21:6:
called `Result::unwrap()` on an `Err` value: IOError(Custom { kind: Other, error: ErrorResponse(502, "") })
---- test_increment stdout ----
thread 'test_increment' panicked at tests/harness.rs:21:6:
called `Result::unwrap()` on an `Err` value: IOError(Custom { kind: Other, error: ErrorResponse(502, "") })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
can_get_contract_id
test_increment
test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.78s
error: test failed, to rerun pass `--test integration_tests`
i am form China , i dont know if its network issue
this is my code
this is error
this is fuelup show