Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion linera-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ base64.workspace = true
call-evm-counter.workspace = true
counter.workspace = true
counter-no-graphql.workspace = true
create-and-call.workspace = true
criterion = { workspace = true, features = ["async_tokio"] }
crowd-funding.workspace = true
ethereum-tracker.workspace = true
Expand Down
72 changes: 0 additions & 72 deletions linera-service/tests/linera_net_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1700,78 +1700,6 @@ async fn test_wasm_end_to_end_counter_no_graphql(config: impl LineraNetConfig) -
Ok(())
}

#[cfg_attr(feature = "storage-service", test_case(LocalNetConfig::new_test(Database::Service, Network::Grpc) ; "storage_test_service_grpc"))]
#[cfg_attr(feature = "scylladb", test_case(LocalNetConfig::new_test(Database::ScyllaDb, Network::Grpc) ; "scylladb_grpc"))]
#[cfg_attr(all(feature = "rocksdb", feature = "scylladb"), test_case(LocalNetConfig::new_test(Database::DualRocksDbScyllaDb, Network::Grpc) ; "dualrocksdbscylladb_grpc"))]
#[cfg_attr(feature = "dynamodb", test_case(LocalNetConfig::new_test(Database::DynamoDb, Network::Grpc) ; "aws_grpc"))]
#[cfg_attr(feature = "kubernetes", test_case(SharedLocalKubernetesNetTestingConfig::new(Network::Grpc, BuildArg::Build) ; "kubernetes_grpc"))]
#[cfg_attr(feature = "remote-net", test_case(RemoteNetTestingConfig::new(None) ; "remote_net_grpc"))]
#[test_log::test(tokio::test)]
async fn test_create_and_call_end_to_end(config: impl LineraNetConfig) -> Result<()> {
use create_and_call::{CreateAndCallAbi, CreateAndCallRequest};
use linera_base::data_types::Bytecode;

let _guard = INTEGRATION_TEST_GUARD.lock().await;
tracing::info!("Starting test {}", test_name!());

let (mut net, client) = config.instantiate().await?;

// Step 1: Download the contract and service of "counter-no-graphql" as Vec<u8>
let (counter_contract_path, counter_service_path) =
client.build_example("counter-no-graphql").await?;
let counter_contract_bytecode = Bytecode::load_from_file(&counter_contract_path)?;
let counter_service_bytecode = Bytecode::load_from_file(&counter_service_path)?;
let contract_bytes = counter_contract_bytecode.bytes;
let service_bytes = counter_service_bytecode.bytes;

// Step 2: Instantiate the contract "create-and-call"
let chain = client.load_wallet()?.default_chain().unwrap();
let (create_call_contract, create_call_service) =
client.build_example("create-and-call").await?;

let application_id = client
.publish_and_create::<CreateAndCallAbi, (), ()>(
create_call_contract,
create_call_service,
VmRuntime::Wasm,
&(),
&(), // Initial value
&[],
None,
)
.await?;

let port = get_node_port().await;
let mut node_service = client.run_node_service(port, ProcessInbox::Skip).await?;

let application = node_service.make_application(&chain, &application_id)?;

// Step 3: Call a mutation that takes the Vec<u8> of "contract", "service",
// the initialization value of 43 and the increment of 5
let initialization_value = 43;
let increment_value = 5;

let mutation_request = CreateAndCallRequest::CreateAndCall(
contract_bytes,
service_bytes,
initialization_value,
increment_value,
);

application.run_json_query(&mutation_request).await?;

// Step 4: Query the contract and see if we obtain 48 (43 + 5)
let query_request = CreateAndCallRequest::Query;
let result_value = application.run_json_query(&query_request).await?;
assert_eq!(result_value, 48);

node_service.ensure_is_running()?;
net.ensure_is_running().await?;
net.terminate().await?;

Ok(())
}

#[cfg_attr(feature = "storage-service", test_case(LocalNetConfig::new_test(Database::Service, Network::Grpc) ; "storage_test_service_grpc"))]
#[cfg_attr(feature = "scylladb", test_case(LocalNetConfig::new_test(Database::ScyllaDb, Network::Grpc) ; "scylladb_grpc"))]
#[cfg_attr(feature = "dynamodb", test_case(LocalNetConfig::new_test(Database::DynamoDb, Network::Grpc) ; "aws_grpc"))]
Expand Down
Loading