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

feature(structre): extract utils into seperate common module #1212

Merged

Conversation

CodeLieutenant
Copy link

Since there will be more folders in scylla/tests, not just integration tests, then we'll need to extract common logic need by all tests folders into seperate module (common) before moving forward.

Pre-review checklist

  • I have split my patch into logically separate commits.
  • All commit messages clearly explain what they change and why.
  • I added relevant tests for new features and bug fixes.
  • All commits compile, pass static checks and pass test.
  • PR description sums up the changes and reasons why they should be introduced.
  • I have provided docstrings for the public items that I want to introduce.
  • I have adjusted the documentation in ./docs/source/.
  • I added appropriate Fixes: annotations to PR description.

scylla/tests/common/retry_policy.rs Outdated Show resolved Hide resolved
wprzytula
wprzytula previously approved these changes Feb 10, 2025
Since there will be more folders in scylla/tests, not just
integration tests, then we'll need to extract common logic need by
all tests folders into seperate module (`common`) before moving forward.

Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com>
@Lorak-mmk Lorak-mmk changed the base branch from main to branch-hackathon February 10, 2025 14:36
Copy link

cargo semver-checks found no API-breaking changes in this PR! 🎉🥳
Checked commit: 36518fc

@Lorak-mmk Lorak-mmk merged commit f6d37a6 into scylladb:branch-hackathon Feb 10, 2025
11 checks passed
@CodeLieutenant
Copy link
Author

@Lorak-mmk What do you think to set in common/mod.rs

pub(crate) use utils::*;

so that every import in other modules can be

#[path = "../common/mod.rs"]
mod utils;

@Lorak-mmk
Copy link
Collaborator

Lorak-mmk commented Feb 10, 2025

#[path = "../common/mod.rs"]
mod utils;

Are you sure you meant to paste this snippet? This is not an import statement.

@CodeLieutenant
Copy link
Author

#[path = "../common/mod.rs"]
mod utils;

Are you sure you meant to paste this snippet? This is not an import statement.

Yes, not an import statement, but needed for the tests, each integration test file in rust is compiled as separate crate and each directory is separate crate, to include common in depth-2 without creating module and integration_test.rs in tests/ root, this is what's need to make it compile and run.

@Lorak-mmk
Copy link
Collaborator

Sorry, I'm not following :( What change would you like to make? Right now (because this PR was merged) integration tests can use utils::something like before, and ccm tests can use common::utils::something. Would you like to make the ccm tests imports the same as in integration tests? That makes sense.

@CodeLieutenant
Copy link
Author

CodeLieutenant commented Feb 10, 2025

Sorry, I'm not following :( What change would you like to make? Right now (because this PR was merged) integration tests can use utils::something like before, and ccm tests can use common::utils::something. Would you like to make the ccm tests imports the same as in integration tests? That makes sense.

yes exactly, to unify the imports (mod), right now, integration-tests need just the utils, but as more tests are added, there will be more utils 100%, and if we change it to code I suggested, would unify the mod statements.

#[path = "../common/mod.rs"]
mod utils;

exposing everything from utils, so that we dont have to change all the imports in integration-tests (backward compatible and at least for now, minize the number of conflicts - basically if i change crate::utils::function to crate::common::utils::function, there would be ton of conflicts as many people are working the the code right now). Like the temporary fix for the hackathon and later can be made to properly fix it with crate::common::utils::my_needed_function.

@Lorak-mmk
Copy link
Collaborator

Can you please do the following:

  • In both integration and ccm_integration do
#[path = "../common/mod.rs"]
mod common;
  • In both do
pub(crate) use common::utils;

This way they will have access to utils module without too many path = hacks.

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.

3 participants