Skip to content

Commit

Permalink
🚧 Adding Goose scenario for loadtesting
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgttph committed Dec 17, 2024
1 parent 899d44d commit 8966ee9
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
16 changes: 16 additions & 0 deletions crates/hyle-loadtest/Cargo.toml
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"] }
36 changes: 36 additions & 0 deletions crates/hyle-loadtest/src/main.rs
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", &register_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(())
}

0 comments on commit 8966ee9

Please sign in to comment.