Skip to content
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

Closed
wants to merge 40 commits into from

Conversation

heemankv
Copy link
Contributor

No description provided.

@heemankv heemankv self-assigned this Aug 23, 2024
@heemankv heemankv changed the title Optimisation/parallel test runs Optimisation: parallel test runs using testcontainer Aug 23, 2024
@heemankv heemankv changed the title Optimisation: parallel test runs using testcontainer Optimisation: parallel test runs using testcontainer Aug 23, 2024
@coveralls
Copy link

coveralls commented Aug 23, 2024

Coverage Status

coverage: 61.038% (-3.6%) from 64.606%
when pulling 1d79902 on optimisation/parallel-test-runs
into f84ba41 on main.

@heemankv heemankv force-pushed the optimisation/parallel-test-runs branch from 96f8038 to bfbce36 Compare August 26, 2024 13:51
@heemankv heemankv force-pushed the optimisation/parallel-test-runs branch from c1e789e to 6c9b32f Compare August 27, 2024 06:29
Copy link
Contributor Author

@heemankv heemankv left a 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

@apoorvsadana apoorvsadana mentioned this pull request Sep 2, 2024
@@ -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"
Copy link
Contributor

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
Copy link
Contributor

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

@@ -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"] }
Copy link
Contributor

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

Copy link
Contributor Author

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"]
Copy link
Contributor

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;
Copy link
Contributor

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?

Copy link
Contributor Author

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;
Copy link
Contributor

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

Copy link
Contributor Author

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 ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed in person

Comment on lines 418 to 427
.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);
Copy link
Contributor

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

Copy link
Contributor Author

@heemankv heemankv Sep 3, 2024

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 ?

Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
println!("Sdsdfdf {:?}", urll);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid, removed.

Copy link
Contributor

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

Copy link
Contributor Author

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 ?

Copy link
Contributor

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 {
Copy link
Contributor

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

Copy link
Contributor Author

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.

@heemankv heemankv mentioned this pull request Sep 4, 2024
@heemankv heemankv added the deferred This PR is ready but should not be merged at the current time, contact manager to know more. label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deferred This PR is ready but should not be merged at the current time, contact manager to know more.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants