Skip to content

Commit

Permalink
Merge pull request #704 from hatoo/edition2024
Browse files Browse the repository at this point in the history
Edition 2024
  • Loading branch information
hatoo authored Feb 22, 2025
2 parents 291b8d1 + 79bcfb6 commit 5a26fe1
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 23 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ categories = [
"development-tools::profiling",
]
description = "Ohayou(おはよう), HTTP load generator, inspired by rakyll/hey with tui animation."
edition = "2021"
edition = "2024"
keywords = ["cli", "load-testing", "performance", "http"]
license = "MIT"
name = "oha"
readme = "README.md"
repository = "https://github.com/hatoo/oha"
version = "1.8.0"
rust-version = "1.77"
rust-version = "1.85"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG RUST_VERSION=1.79
ARG RUST_VERSION=1.85
FROM docker.io/library/rust:${RUST_VERSION} AS build
WORKDIR /app
COPY . /app
Expand Down
2 changes: 1 addition & 1 deletion src/aws_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use anyhow::Result;

use bytes::Bytes;
use hyper::{
header::{self, HeaderName},
HeaderMap,
header::{self, HeaderName},
};
use url::Url;

Expand Down
10 changes: 5 additions & 5 deletions src/client.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use bytes::Bytes;
use http_body_util::{BodyExt, Full};
use hyper::{http, Method};
use hyper::{Method, http};
use hyper_util::rt::{TokioExecutor, TokioIo};
use rand::prelude::*;
use std::{
borrow::Cow,
io::Write,
sync::{
atomic::{AtomicBool, Ordering::Relaxed},
Arc,
atomic::{AtomicBool, Ordering::Relaxed},
},
time::Instant,
};
Expand All @@ -20,10 +20,10 @@ use tokio::{
use url::{ParseError, Url};

use crate::{
ConnectToEntry,
aws_auth::AwsSignatureConfig,
pcg64si::Pcg64Si,
url_generator::{UrlGenerator, UrlGeneratorError},
ConnectToEntry,
};

type SendRequestHttp1 = hyper::client::conn::http1::SendRequest<Full<Bytes>>;
Expand Down Expand Up @@ -1868,8 +1868,8 @@ pub mod fast {

use crate::{
client::{
is_cancel_error, is_hyper_error, set_connection_time, setup_http2, ClientError,
ClientStateHttp1,
ClientError, ClientStateHttp1, is_cancel_error, is_hyper_error, set_connection_time,
setup_http2,
},
result_data::ResultData,
};
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use crossterm::tty::IsTty;
use hickory_resolver::config::{ResolverConfig, ResolverOpts};
use humantime::Duration;
use hyper::{
HeaderMap,
http::{
self,
header::{HeaderName, HeaderValue},
},
HeaderMap,
};
use printer::{PrintConfig, PrintMode};
use rand_regex::Regex;
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use clap::Parser;
use oha::{run, Opts};
use oha::{Opts, run};

fn main() {
let num_workers_threads = std::env::var("TOKIO_WORKER_THREADS")
Expand Down
4 changes: 2 additions & 2 deletions src/monitor.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
use byte_unit::Byte;
use crossterm::{
event::{Event, KeyCode, KeyEvent, KeyModifiers},
ExecutableCommand,
event::{Event, KeyCode, KeyEvent, KeyModifiers},
};
use hyper::http;
use ratatui::crossterm;
use ratatui::{
Terminal,
backend::CrosstermBackend,
layout::{Constraint, Direction, Layout},
style::{Color, Style},
text::{Line, Span},
widgets::{BarChart, Block, Borders, Gauge, Paragraph},
Terminal,
};
use std::{collections::BTreeMap, io};

Expand Down
2 changes: 1 addition & 1 deletion src/result_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
time::{Duration, Instant},
};

use average::{concatenate, Estimate, Max, Mean, Min};
use average::{Estimate, Max, Mean, Min, concatenate};
use hyper::StatusCode;

use crate::{
Expand Down
10 changes: 6 additions & 4 deletions src/url_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ mod tests {
);
let url = url_generator.generate(&mut rand::rng()).unwrap();
assert_eq!(url.host(), Some(Host::Ipv4(Ipv4Addr::new(127, 0, 0, 1))));
assert!(Regex::new(path_regex)
.unwrap()
.captures(url.path())
.is_some());
assert!(
Regex::new(path_regex)
.unwrap()
.captures(url.path())
.is_some()
);
}

#[test]
Expand Down
10 changes: 5 additions & 5 deletions tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ use std::{
future::Future,
io::Write,
net::{Ipv6Addr, SocketAddr},
sync::{atomic::AtomicU16, Arc},
sync::{Arc, atomic::AtomicU16},
};

use assert_cmd::Command;
use axum::{extract::Path, response::Redirect, routing::get, Router};
use axum::{Router, extract::Path, response::Redirect, routing::get};
use http::{HeaderMap, Request, Response};
use http_body_util::BodyExt;
use http_mitm_proxy::MitmProxy;
use hyper::{
body::{Body, Incoming},
http,
service::{service_fn, HttpService},
service::{HttpService, service_fn},
};
use hyper_util::rt::{TokioExecutor, TokioIo};

Expand Down Expand Up @@ -975,7 +975,7 @@ async fn test_json_schema() {
}

fn setup_mtls_server(
dir: &std::path::Path,
dir: std::path::PathBuf,
) -> (u16, impl Future<Output = Result<(), std::io::Error>>) {
let port = PORT.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
let addr = SocketAddr::from(([127, 0, 0, 1], port));
Expand Down Expand Up @@ -1041,7 +1041,7 @@ fn setup_mtls_server(
#[tokio::test]
async fn test_mtls() {
let dir = tempfile::tempdir().unwrap();
let (port, server) = setup_mtls_server(dir.path());
let (port, server) = setup_mtls_server(dir.path().to_path_buf());

tokio::spawn(server);

Expand Down

0 comments on commit 5a26fe1

Please sign in to comment.