Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
senia-psm committed Mar 13, 2024
1 parent 2b175e2 commit fecdde8
Showing 1 changed file with 12 additions and 29 deletions.
41 changes: 12 additions & 29 deletions tests/sharding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use libtest_mimic::{Arguments, Conclusion, Failed, Trial};
use rand::prelude::*;
use serde_json::Value;
use std::collections::HashSet;
use std::sync::Arc;
use std::sync::mpsc::Receiver;
use std::sync::Arc;
use std::time::Duration;
use testcontainers::clients;

Expand All @@ -32,7 +32,6 @@ fn run(context: ContextInfo) -> Conclusion {
fn main() -> Result<(), Failed> {
env_logger::init();


let (tx, rx) = std::sync::mpsc::channel();
let (stop_tx, stop_rx) = std::sync::mpsc::channel();

Expand Down Expand Up @@ -218,11 +217,7 @@ fn get_invocation_key_with_retry(
cli: &CliLive,
) -> Result<InvocationKey, Failed> {
loop {
match get_invocation_key(
template_id,
worker_name,
cli,
) {
match get_invocation_key(template_id, worker_name, cli) {
Ok(key) => return Ok(key),
Err(_) => {
std::thread::sleep(Duration::from_secs(1));
Expand Down Expand Up @@ -266,14 +261,7 @@ fn invoke_and_await_result_with_retry(
cli: &CliLive,
) -> Result<Value, Failed> {
loop {
match invoke_and_await_result(
template_id,
worker_name,
function,
params,
key,
cli,
) {
match invoke_and_await_result(template_id, worker_name, function, params, key, cli) {
Ok(res) => return Ok(res),
Err(e) => {
if e.message()
Expand Down Expand Up @@ -303,14 +291,8 @@ fn get_invocation_key_invoke_and_await_with_retry(
cli: &CliLive,
) -> Result<Value, Failed> {
let key = get_invocation_key_with_retry(&template_id, &worker_name, &cli)?;
let res = invoke_and_await_result_with_retry(
template_id,
worker_name,
function,
params,
&key,
cli,
);
let res =
invoke_and_await_result_with_retry(template_id, worker_name, function, params, &key, cli);
println!("*** WORKER {worker_name} INVOKED ***");
res
}
Expand All @@ -327,19 +309,20 @@ fn service_is_responsive_to_shard_changes(
"add",
&cfg.arg('t', "template-name"),
&template_name,
context.env.wasm_root.join("option-service.wasm").to_str().unwrap(),
context
.env
.wasm_root
.join("option-service.wasm")
.to_str()
.unwrap(),
])?;

let mut workers_with_names = Vec::new();

for n in 1..=4 {
println!("*** WORKER {n} STARTING ***");
let worker_name = format!("echo-service-{n}");
let worker_id = upload_and_start_worker(
&template,
&worker_name,
&cli,
)?;
let worker_id = upload_and_start_worker(&template, &worker_name, &cli)?;
println!("*** WORKER {n} STARTED ***");
workers_with_names.push((worker_id, worker_name))
}
Expand Down

0 comments on commit fecdde8

Please sign in to comment.