-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimisation: parallel test runs using testcontainer #96
Conversation
testcontainer
testcontainer
96f8038
to
bfbce36
Compare
c1e789e
to
6c9b32f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Completed Self Review, and implemented according improvements along the way.
Over to you @apoorvsadana
@@ -8,17 +8,20 @@ PORT=3000 | |||
AWS_ACCESS_KEY_ID="AWS_ACCESS_KEY_ID" | |||
AWS_SECRET_ACCESS_KEY="AWS_SECRET_ACCESS_KEY" | |||
AWS_REGION="us-east-1" | |||
AWS_S3_BUCKET_REGION="us-east-1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why can't we just reuse AWS_REGION
L2_BLOCK_NUMBER_FOR_TEST=671070 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think this should be an env var
crates/orchestrator/Cargo.toml
Outdated
@@ -46,6 +46,7 @@ num-bigint = { workspace = true } | |||
num-traits = { workspace = true } | |||
omniqueue = { workspace = true, optional = true } | |||
prover-client-interface = { workspace = true } | |||
reqwest = { version = "0.11", features = ["blocking"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should import from workspace ideally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Valid, resolved.
@@ -69,9 +70,12 @@ default = ["ethereum", "with_mongodb", "with_sqs"] | |||
ethereum = ["ethereum-da-client"] | |||
with_mongodb = ["mongodb"] | |||
with_sqs = ["omniqueue"] | |||
mongodb = ["dep:mongodb"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we already have with_mongodb
, why do we need this?
let sns_region = get_env_var_or_panic("AWS_SNS_REGION"); | ||
let topic_arn = get_env_var_or_panic("AWS_SNS_ARN"); | ||
let config = aws_config::from_env().region(Region::new(sns_region)).load().await; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should actually refactor this now on main because now we send aws_config
from the root, can you pick this up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Valid, added to #104
} | ||
|
||
pub async fn testcontainer_mongo_database(mut self) -> TestConfigBuilder { | ||
let (node, database) = mongodb_testcontainer_setup().await; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would call the setup
functions during build and not during these intermediate builder functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Builders only ensures that if anything is not built then add a mock client to it, rest all the functions be it testcontainers or adding creates/takes services and stores in the builder,
if we want to build them in .build()
function then we'll have to maintain extra variables to manage state of what needs to be built and what needs to be mocked, I don't think it's worth the effort.
WDYT ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussed in person
.with_stdout_level(log::Level::Info) | ||
.with_stdout_level(log::Level::Debug) | ||
.with_stdout_level(log::Level::Error) | ||
.with_stdout_level(log::Level::Trace) | ||
.with_stdout_level(log::Level::Warn) | ||
.with_stderr_level(log::Level::Info) | ||
.with_stderr_level(log::Level::Debug) | ||
.with_stderr_level(log::Level::Error) | ||
.with_stderr_level(log::Level::Trace) | ||
.with_stderr_level(log::Level::Warn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
repeated + trace includes everything afaik
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, only kept Trace,
I am not sure how to create a file scoped logger and use it here, can you share an example ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure how to create a file scoped logger
I didn't understand, wdym by a scoped logger?
|
||
let urll = sqs_client.get_queue_url().queue_name(JOB_PROCESSING_QUEUE.to_string()).send().await.unwrap(); | ||
|
||
println!("Sdsdfdf {:?}", urll); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
println!("Sdsdfdf {:?}", urll); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Valid, removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am not sure if this is very helpful because there's no assurity that different cases will actually run in parallel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't get you, could you elaborate ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the test cases here are meant to check if parallel testing works fine. For parallel testing, we create multiple dummy cases (random UUIDs each) for each test expecting these cases will run in ||. However, I think it's not necessary they actually run in || so these cases might not be relevant.
.with(eq(job.internal_id.to_string()), eq(JobType::StateTransition)) | ||
.returning(|_, _| Ok(None)); | ||
} | ||
// for job in completed_jobs { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we delete this comment? how was the code working with this commented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test case was expecting many instances of get_job_by_internal_id_and_type because of the loop, which were not being used since only the first one was being used we corrected it to only expect for 1st element of the vector. Removed the comment.
No description provided.