Skip to content

Commit

Permalink
Fix Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
byronwasti committed Apr 3, 2024
1 parent e83585c commit 4dccabb
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 12 deletions.
3 changes: 3 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ prep:
cargo test --release
cargo semver-checks

version EXECUTE:
cargo release version --exclude balter-tests --exclude mock-service --exclude examples minor {{EXECUTE}}

publish:
cd balter-macros && cargo publish
cd balter-core && cargo publish
Expand Down
2 changes: 1 addition & 1 deletion balter-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "balter-core"
license = "MIT"
version = "0.1.0"
version = "0.2.0"
edition = "2021"
authors = ["Byron Wasti <[email protected]>"]
homepage = "https://github.com/byronwasti/balter"
Expand Down
6 changes: 6 additions & 0 deletions balter-core/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ pub struct SampleData {
pub elapsed: Duration,
}

impl Default for SampleData {
fn default() -> Self {
Self::new()
}
}

impl SampleData {
#[allow(unused)]
pub fn new() -> Self {
Expand Down
2 changes: 1 addition & 1 deletion balter-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "balter-macros"
license = "MIT"
version = "0.2.1"
version = "0.3.0"
edition = "2021"
readme = "README.md"
authors = ["Byron Wasti <[email protected]>"]
Expand Down
4 changes: 2 additions & 2 deletions balter-runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "balter-runtime"
version = "0.1.0"
version = "0.2.0"
edition = "2021"
license = "MIT"
authors = ["Byron Wasti <[email protected]>"]
Expand All @@ -12,7 +12,7 @@ categories = ["development-tools", "concurrency"]
publish = true

[dependencies]
balter-core = { version = "0.1", features = ["rt"], path = "../balter-core" }
balter-core = { version = "0.2", features = ["rt"], path = "../balter-core" }

async-channel = "2.1.1"
axum = { version = "0.7.2", features = ["macros", "ws", "tokio"] }
Expand Down
2 changes: 1 addition & 1 deletion balter-runtime/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl IntoResponse for HandlerError {
use HandlerError::*;
match self {
Runtime(RuntimeError::NoScenario) => {
(StatusCode::NOT_FOUND, format!("Scenario not found"))
(StatusCode::NOT_FOUND, "Scenario not found".to_string())
}
Send(err) => (
StatusCode::INTERNAL_SERVER_ERROR,
Expand Down
8 changes: 4 additions & 4 deletions balter/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "balter"
license = "MIT"
version = "0.4.0"
version = "0.5.0"
edition = "2021"
authors = ["Byron Wasti <[email protected]>"]
homepage = "https://github.com/byronwasti/balter"
Expand All @@ -13,9 +13,9 @@ categories = ["development-tools", "concurrency"]
publish = true

[dependencies]
balter-macros = { version = "0.2", path = "../balter-macros" }
balter-core = { version = "0.1", path = "../balter-core" }
balter-runtime = { version = "0.1", path = "../balter-runtime", optional = true }
balter-macros = { version = "0.3", path = "../balter-macros" }
balter-core = { version = "0.2", path = "../balter-core" }
balter-runtime = { version = "0.2", path = "../balter-runtime", optional = true }

arc-swap = "1.6.0"
governor = "0.6.0"
Expand Down
2 changes: 1 addition & 1 deletion balter/src/scenario.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ where
// NOTE: This loop is time-sensitive. Any long awaits or blocking will throw off measurements
loop {
if let (stable, Some(samples)) = sampler.get_samples().await {
let new_goal_tps = controllers.limit(&samples);
let new_goal_tps = controllers.limit(samples);

if new_goal_tps < sampler.goal_tps() || stable {
sampler.set_goal_tps(new_goal_tps);
Expand Down
14 changes: 12 additions & 2 deletions balter/src/scenario/sampler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,21 @@ mod tests {
use rand_distr::{Distribution, Normal};

async fn mock_trivial_scenario() {
let _ = crate::transaction::transaction_hook::<_, (), ()>(async { Ok(()) }).await;
let labels = balter_core::TransactionLabels {
success: "",
error: "",
latency: "",
};
let _ = crate::transaction::transaction_hook::<_, (), ()>(labels, async { Ok(()) }).await;
}

async fn mock_noisy_scenario() {
let _ = crate::transaction::transaction_hook::<_, (), ()>(async {
let labels = balter_core::TransactionLabels {
success: "",
error: "",
latency: "",
};
let _ = crate::transaction::transaction_hook::<_, (), ()>(labels, async {
let normal = Normal::new(100., 25.).unwrap();
let v: f64 = normal.sample(&mut rand::thread_rng());
tokio::time::sleep(Duration::from_micros(v.floor() as u64)).await;
Expand Down

0 comments on commit 4dccabb

Please sign in to comment.