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

feat: Add parallelism support for sqlness #71

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

waynexia
Copy link
Member

Rationale

The test time can be very long with increasing test cases. Supporting run them in parallel is a way to relieve this.

Detailed Changes

Support to build multiple environments, and schedule test cases to those env on file level

Test Plan

This change itself is relatively simple, and a major part is for lifetime

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 6 out of 10 changed files in this pull request and generated 2 comments.

Files not reviewed (4)
  • sqlness/src/interceptor.rs: Evaluated as low risk
  • sqlness/examples/basic.rs: Evaluated as low risk
  • sqlness/Cargo.toml: Evaluated as low risk
  • sqlness/src/environment.rs: Evaluated as low risk
Comments suppressed due to low confidence (2)

sqlness/src/runner.rs:170

  • Ensure that the new parallelism feature is explicitly tested to verify its behavior.
futures::future::join_all(futures).await;

sqlness/examples/bad.rs:19

  • The removal of the return statement may affect the intended behavior. Consider adding the return statement back.
Box::new("Unexpected")

waynexia and others added 2 commits February 12, 2025 11:31
Signed-off-by: Ruihang Xia <[email protected]>
@waynexia waynexia changed the title feat: Add parallelism support feat: Add parallelism support for sqlness Feb 12, 2025
/// The id is used to distinguish different database instances in the same environment.
/// For example, you may want to run the sqlness test in parallel against different instances
/// of the same environment to accelerate the test.
async fn start(&self, env: &str, id: usize, config: Option<&Path>) -> Self::DB;
Copy link
Member

Choose a reason for hiding this comment

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

Strings can be used for identifiers (id) because they offer flexibility and can accommodate any character-based data, making them suitable for dynamic or user-generated IDs that might include numbers, letters, or special characters.

let db = self.env_controller.start(&env, config_path).await;
let run_result = self.run_env(&env, &db).await;
self.env_controller.stop(&env, db).await;
let parallelism = self.config.parallelism.max(1);
Copy link
Member

Choose a reason for hiding this comment

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

min(1)?

Copy link
Member Author

Choose a reason for hiding this comment

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

min will become either 0 or 1. This is "take the min/max among two" (really misleading, I've fallen into this many times...)

@@ -112,6 +112,7 @@ fn main() {

let config = ConfigBuilder::default()
.case_dir(args.case_dir)
.parallelism(1)
Copy link
Member

Choose a reason for hiding this comment

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

add it to clap parser?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants