jonasgeiregat commented on PR #546:
URL: https://github.com/apache/pulsar-manager/pull/546#issuecomment-1934668065
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)
```java
@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`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]