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

Test: hadoopfs tests remove the use of @Value.Immutable #8572

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

nopcoder
Copy link
Contributor

@nopcoder nopcoder commented Jan 29, 2025

Add Pagination implementation to replace the current usage of @Value.Immutable in the test code.

The two main drives to this change:

The current test code define interface for pagination information an using code generation based on the interface, uses a builder to pass the pagination information to the test code.
Think this is a bit over engineerig and can be simplify by just using the same class with generated builder (also not required).
The use of Optional class was also removed as we just check for null.
If you think it is too much and we should drive for no null check code and check of absent I can revert that change. But my drive to make the code simple.

Note that this change doesn't solve the issue of Java dependency, as Hadoop requires it. but it reduce the dependency and simplify the build process as not code generation is required for running the tests.

PS removed dup entry in the packages list

- Added ImmutablePagination class to handle pagination parameters in tests.
- Updated test setup to use ImmutablePagination class for pagination parameters.
- This change removes the use of @Value.Immutable in the test and works
  with latest Java compilers.
@nopcoder nopcoder added area/testing Improvements or additions to tests exclude-changelog PR description should not be included in next release changelog minor-change Used for PRs that don't require issue attached labels Jan 29, 2025
@nopcoder nopcoder self-assigned this Jan 29, 2025
Copy link

E2E Test Results - DynamoDB Local - Local Block Adapter

13 passed

Copy link

E2E Test Results - Quickstart

11 passed

Copy link
Contributor

@arielshaqed arielshaqed left a comment

Choose a reason for hiding this comment

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

Thanks!

But frankly I am not sure why this would be required. E.g. the docs (and even the changelog) say nothing about not working with a modern JVM. Ideally we would link to an issue that says immutable Values don't work with a modern Java. Maybe just bump to 2.10.1? Or are we using it incorrectly???

I am not a fan of writing generated code by hand. For instance the code generated by immutable.Value gives actual value types; the type here does not. "Value type" means, for instance, the existence of working equals and hashCode methods. You also get any number of great routines; see here.

@@ -0,0 +1,56 @@
package io.lakefs;
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 understand: this used to be auto-generated; is this now manually written?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Used the common builder pattern to implement the Pagination class.
This class is used by the test code to pass pagination argumens (some optional).
If Java add optional field initialization I'm sure we didn't had this class in the first place. We do not use the generated code in non-test.

@@ -0,0 +1,56 @@
package io.lakefs;

import com.google.common.base.Optional;
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 use the standard java.util.Optional instead? (Maybe not if code is generated with a different Optional...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I thought the code prefered Google's package so we left it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This code is used in a single location - and already used 'if' to check the optional value. So I've updarted to check for null.

@nopcoder nopcoder requested a review from arielshaqed February 2, 2025 11:11
@nopcoder
Copy link
Contributor Author

nopcoder commented Feb 2, 2025

Updated the description with the open issue from the immutables package and simplify the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing Improvements or additions to tests exclude-changelog PR description should not be included in next release changelog minor-change Used for PRs that don't require issue attached
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants