Skip to content

refactor(scan) move test utils to test_utils.rs - #3107

Open
xanderbailey wants to merge 4 commits into
apache:mainfrom
xanderbailey:xb/refactor_test_utils_for_scan
Open

refactor(scan) move test utils to test_utils.rs#3107
xanderbailey wants to merge 4 commits into
apache:mainfrom
xanderbailey:xb/refactor_test_utils_for_scan

Conversation

@xanderbailey

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

  • Closes #.

What changes are included in this PR?

scan mod.rs was bloated with a lot of test fixtures that are better placed in a test_utils.rs

Are these changes tested?

AI Disclosure

@blackmwkblackmwk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @xanderbailey for this pr!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We already have a crate leve test_utils, my suggestion is to split the crate level test_utils into a dir mod, and put different test utils into different file mods.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Happy to give it a go, I was following the pattern we have elsewhere for puffin, arrow etc

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Have done the first part, let me know what you think. Didn't want to start moving other test_utils around in this PR but happy to follow up if we're happy with the direction?

@blackmwkblackmwk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @xanderbailey , yes it's the right direction.

Comment threadcrates/iceberg/src/test_utils/mod.rs Outdated
Comment on lines +22 to +23
#[cfg(test)]
pub(crate) mod scan;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No, we should mark the whole test_utils mod available only in test configuration.. I know it will break pub api, but it's necessary, these are not api.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

The issue is then we can't use these across crate boundaries:

 error[E0432]: unresolved import `iceberg::test_utils`
--> crates/catalog/rest/src/catalog.rs:1668:18
--> crates/integrations/datafusion/tests/integration_datafusion_test.rs:34:14
--> crates/integrations/datafusion/src/physical_plan/project.rs:193:18
--> crates/integrations/datafusion/src/physical_plan/repartition.rs:185:18

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I just realized thate we have a test_utils crate, we can move shared utils there.

Sign up for freeto 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

@xanderbailey@blackmwk