-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c682964
commit 7059745
Showing
9 changed files
with
192 additions
and
7 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
## app_install | ||
## first_call | ||
|
||
### Description | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[package] | ||
name = "write_query" | ||
version = "0.1.0" | ||
edition = "2021" | ||
build = "../scenario_build.rs" | ||
|
||
[dependencies] | ||
anyhow = { workspace = true } | ||
holochain_types = { workspace = true } | ||
holochain_wind_tunnel_runner = { workspace = true } | ||
|
||
[build-dependencies] | ||
happ_builder = { workspace = true } | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[package.metadata.required-dna] | ||
name = "crud" | ||
zomes = ["crud"] | ||
|
||
[package.metadata.required-happ] | ||
name = "crud" | ||
dnas = ["crud"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
## write_query | ||
|
||
### Description | ||
|
||
Creates an entry, then queries the source chain and performs a simple operation on the entries, then repeat. | ||
|
||
### Suggested command | ||
|
||
```bash | ||
RUST_LOG=info cargo run --package write_query -- --connection-string ws://localhost:8888 --duration 300 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
use holochain_types::prelude::ActionHash; | ||
use holochain_wind_tunnel_runner::prelude::*; | ||
use holochain_wind_tunnel_runner::scenario_happ_path; | ||
use std::path::Path; | ||
|
||
#[derive(Debug, Default)] | ||
struct ScenarioValues { | ||
call_count: u32, | ||
} | ||
|
||
impl UserValuesConstraint for ScenarioValues {} | ||
|
||
|
||
fn setup(ctx: &mut RunnerContext<HolochainRunnerContext>) -> HookResult { | ||
configure_app_ws_url(ctx)?; | ||
Ok(()) | ||
} | ||
|
||
fn agent_setup( | ||
ctx: &mut AgentContext<HolochainRunnerContext, HolochainAgentContext<ScenarioValues>>, | ||
) -> HookResult { | ||
install_app(ctx, scenario_happ_path!("crud"), &"crud".to_string())?; | ||
|
||
Ok(()) | ||
} | ||
|
||
fn agent_behaviour( | ||
ctx: &mut AgentContext<HolochainRunnerContext, HolochainAgentContext<ScenarioValues>>, | ||
) -> HookResult { | ||
let _: ActionHash = call_zome( | ||
ctx, | ||
"crud", | ||
"create_sample_entry", | ||
"this is a test entry value", | ||
)?; | ||
|
||
let response: u32 = call_zome(ctx, "crud", "chain_query_count_len", ())?; | ||
|
||
let values = &mut ctx.get_mut().scenario_values; | ||
values.call_count += 1; | ||
|
||
// Minimal check that we're querying the right content and getting the expected result from the | ||
// calculation in this zome function. | ||
assert_eq!(values.call_count * 26, response, "Expected call count to match response"); | ||
|
||
Ok(()) | ||
} | ||
|
||
fn main() -> WindTunnelResult<()> { | ||
let builder = | ||
ScenarioDefinitionBuilder::<HolochainRunnerContext, HolochainAgentContext<ScenarioValues>>::new_with_init( | ||
env!("CARGO_PKG_NAME"), | ||
) | ||
.with_default_duration_s(60) | ||
.use_setup(setup) | ||
.use_agent_setup(agent_setup) | ||
.use_agent_behaviour(agent_behaviour) | ||
.use_agent_teardown(|ctx| { | ||
uninstall_app(ctx, None).ok(); | ||
Ok(()) | ||
}); | ||
|
||
run(builder)?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
## single_write_many_read | ||
## write_read | ||
|
||
### Description | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters