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

chore: upgrade gradle,java and spring-boot #546

Merged
merged 4 commits into from
Feb 16, 2024
Merged

Conversation

jonas-grgt
Copy link
Contributor

No description provided.

@jonas-grgt jonas-grgt force-pushed the upgrade branch 3 times, most recently from e050498 to d1b4a60 Compare February 5, 2024 12:43
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the contribution @jonasgeiregat

@lhotari lhotari requested a review from onobc February 7, 2024 10:41
@jonas-grgt
Copy link
Contributor Author

jonas-grgt commented Feb 7, 2024

Thanks.
Well there are some tests failures that I can't explain I was hoping someone could help me with or give me some pointers.
The failing tests run fine in isolation only together they fail I believe it must be related to not properly cleaning up the previous state but having a hard time proving it.

build.gradle Show resolved Hide resolved
build.gradle Outdated Show resolved Hide resolved
Copy link

@onobc onobc left a comment

Choose a reason for hiding this comment

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

Thanks. Well there are some tests failures that I can't explain I was hoping someone could help me with or give me some pointers. The failing tests run fine in isolation only together they fail I believe it must be related to not properly cleaning up the previous state but having a hard time proving it.

Thanks for the updates @jonasgeiregat . Do you mind pointing me to exact tests and I will give them a 👓 (I am guessing it has something to do w/ the Powermock (static mocking removals).

@jonas-grgt
Copy link
Contributor Author

To make it clear the goal was not to get things merged in but rather to have something to work together on as moving this project forward is quite a big and challenging task. View it as a collaboration branch.

@jonas-grgt
Copy link
Contributor Author

I don't believe the failing tests have anything to do with the removal of powermock but I might be wrong. As I see it it has something to do with database state not being properly cleaned after a test run.

For example the following test passes if I take in to account previous state (see comments)

@ActiveProfiles("test")
public class TenantsRepositoryImplTest {

    @Test
    public void getTenantsListTest() {
	Page<TenantEntity> tenantsEntities = tenantsRepository.getTenantsList(1, 10);
	long existingTotal = tenantsEntities.getTotal(); // I added this and the above line of code to let the test pass
        for (int i = 0; i < 10; i++) {
            TenantEntity tenantEntity = new TenantEntity();
            tenantEntity.setTenant("test" + i);
            tenantEntity.setAdminRoles("test" + i);
            tenantEntity.setAllowedClusters("test-cluster");
            tenantEntity.setEnvironmentName("test-environment");
            tenantsRepository.save(tenantEntity);
        }
        tenantsEntities = tenantsRepository.getTenantsList(1, 10);
        tenantsEntities.count(true);
        long total = tenantsEntities.getTotal();
        Assert.assertEquals(10 + existingTotal, total); // by adding this to the assert the test passes reliably

The main test that fails is DashboardServiceImplTest.getDashboardStatsTest, TenantsRepositoryImplTest.getTenantsListTest, TopicsServiceImplTest.getTopicsStatsImplTest and TenantsRepositoryImplTest.getTenantsListTest. But watch out they don't fail all the time except the first one DashboardServiceImplTest.getDashboardStatsTest

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

Great work !

@lhotari
Copy link
Member

lhotari commented Feb 16, 2024

Good work @jonasgeiregat!

There's a merge conflict in src/test/java/org/apache/pulsar/manager/service/BrokerTokensServiceImplTest.java . Please merge changes from master branch to the PR and resolve the conflict.

JonasG and others added 3 commits February 16, 2024 15:43
Bumped gradle to 8.5
Bumped spring-boot to 2.5.3
Removed useless BookiesServiceImplTest that was not asserting anything.
Removed static nature of HttpUtils to make it injectable and better testable (favor Mockito over staticly mocking things using Powermock).
Turned out newer versions of page helper do not work zero indexed but rather use one as the first page.
Removed unnecessary mocking of httpUtil.
The id generation is not always deterministic when saving an entity. Therefore, I opted to let the test code use the id returned by the save method instead of relying on a deterministic value.
Enabled distTar again by replacing the deprecated property by the new one.
@jonas-grgt
Copy link
Contributor Author

Please merge changes from master branch to the PR and resolve the conflict.

Fixed the merge conflicts

@lhotari lhotari requested a review from onobc February 16, 2024 15:07
Copy link

@onobc onobc left a comment

Choose a reason for hiding this comment

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

LGTM - thanks @jonasgeiregat !

Copy link

@onobc onobc left a comment

Choose a reason for hiding this comment

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

LGTM @jonasgeiregat

@lhotari lhotari merged commit 9e34505 into apache:master Feb 16, 2024
1 check passed
@lhotari
Copy link
Member

lhotari commented Feb 16, 2024

Great work @jonasgeiregat , merged

@lhotari
Copy link
Member

lhotari commented Feb 16, 2024

@jonasgeiregat do you have a chance to bump the Pulsar version? The current 2.7.0 is very old. We could go with either LTS 3.0.2 or most recent 3.2.0 version.

@jonas-grgt jonas-grgt deleted the upgrade branch February 17, 2024 07:53
@jonas-grgt
Copy link
Contributor Author

Will take a look at it

@lhotari
Copy link
Member

lhotari commented Feb 17, 2024

It seems that the log4j version is pinned:

ext['log4j2.version'] = '2.17.1'
. That should be removed. (Assuming updated deps in Spring Boot)

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.

4 participants