-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚧 Adding Goose scenario for loadtesting
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
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,16 @@ | ||
[package] | ||
name = "hyle-loadtest" | ||
version.workspace = true | ||
edition.workspace = true | ||
homepage.workspace = true | ||
repository.workspace = true | ||
|
||
[dependencies] | ||
goose = "^0.17" | ||
serde_json = "1.0.133" | ||
tokio = "^1.12" | ||
hyle = { path = "../../" } | ||
# hyllar = { path = "../../contracts/hyllar" } | ||
# amm = { path = "../../contracts/amm" } | ||
# hydentity = { path = "../../contracts/hydentity" } | ||
hyle-contract-sdk = { path = "../../contract-sdk", features = ["tracing"] } |
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,36 @@ | ||
use goose::prelude::*; | ||
use hyle::model::{BlobTransaction, ContractName}; | ||
use hyle_contract_sdk::identity_provider::IdentityAction; | ||
|
||
async fn register_user(user: &mut GooseUser) -> TransactionResult { | ||
for i in 0..10000 { | ||
let identity = format!("identity-{}.hydentity", i); | ||
|
||
// Register identity | ||
let blobs = vec![IdentityAction::RegisterIdentity { | ||
account: identity.clone(), | ||
} | ||
.as_blob(ContractName("hydentity".to_owned()))]; | ||
|
||
let register_identity_blob_transaction = BlobTransaction { | ||
identity: identity.into(), | ||
blobs, | ||
}; | ||
user.post_json("/v1/tx/send/blob", ®ister_identity_blob_transaction) | ||
.await?; | ||
} | ||
Ok(()) | ||
} | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), GooseError> { | ||
GooseAttack::initialize()? | ||
.register_scenario( | ||
scenario!("RegisterUsersBlobTransactions") | ||
.register_transaction(transaction!(register_user)), | ||
) | ||
.execute() | ||
.await?; | ||
|
||
Ok(()) | ||
} |