Skip to content

Commit

Permalink
Reset test threads to 1 (should fix test issues in GHA)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigaloid committed Dec 30, 2023
1 parent 90a800f commit d86b77a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,21 +354,21 @@ pub async fn json(path: String, quarantine: bool) -> Result<Value, String> {
}
}

#[tokio::test(flavor = "multi_thread", worker_threads = 8)]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_localization_popular() {
let val = json("/r/popular/hot.json?&raw_json=1&geo_filter=GLOBAL".to_string(), false).await.unwrap();
assert_eq!("GLOBAL", val["data"]["geo_filter"].as_str().unwrap());
}

#[tokio::test(flavor = "multi_thread", worker_threads = 8)]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_obfuscated_share_link() {
let share_link = "/r/rust/s/kPgq8WNHRK".into();
// Correct link without share parameters
let canonical_link = "/r/rust/comments/18t5968/why_use_tuple_struct_over_standard_struct/kfbqlbc".into();
assert_eq!(canonical_path(share_link).await, Ok(Some(canonical_link)));
}

#[tokio::test(flavor = "multi_thread", worker_threads = 8)]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_share_link_strip_json() {
let link = "/17krzvz".into();
let canonical_link = "/r/nfl/comments/17krzvz/rapoport_sources_former_no_2_overall_pick/".into();
Expand Down
8 changes: 4 additions & 4 deletions src/oauth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,21 +213,21 @@ fn choose<T: Copy>(list: &[T]) -> T {
*fastrand::choose_multiple(list.iter(), 1)[0]
}

#[tokio::test(flavor = "multi_thread", worker_threads = 8)]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_oauth_client() {
assert!(!OAUTH_CLIENT.read().await.token.is_empty());
}

#[tokio::test(flavor = "multi_thread", worker_threads = 8)]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_oauth_client_refresh() {
OAUTH_CLIENT.write().await.refresh().await.unwrap();
}
#[tokio::test(flavor = "multi_thread", worker_threads = 8)]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_oauth_token_exists() {
assert!(!OAUTH_CLIENT.read().await.token.is_empty());
}

#[tokio::test(flavor = "multi_thread", worker_threads = 8)]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_oauth_headers_len() {
assert!(OAUTH_CLIENT.read().await.headers_map.len() >= 3);
}
Expand Down
2 changes: 1 addition & 1 deletion src/subreddit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ async fn subreddit(sub: &str, quarantined: bool) -> Result<Subreddit, String> {
})
}

#[tokio::test(flavor = "multi_thread", worker_threads = 8)]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_fetching_subreddit() {
let subreddit = subreddit("rust", false).await;
assert!(subreddit.is_ok());
Expand Down
2 changes: 1 addition & 1 deletion src/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ async fn user(name: &str) -> Result<User, String> {
})
}

#[tokio::test(flavor = "multi_thread", worker_threads = 8)]
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn test_fetching_user() {
let user = user("spez").await;
assert!(user.is_ok());
Expand Down

0 comments on commit d86b77a

Please sign in to comment.