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

build: disable testNewEnsembleBookieWithOneEmptyRegion method in TestRegionAwareEnsemblePlacementPolicy beyond jdk11 #4323

Merged
merged 2 commits into from
May 5, 2024

Conversation

shoothzj
Copy link
Member

@shoothzj shoothzj commented Apr 29, 2024

Motivation

In JDK21, it's is no way to change private static final variable currently, before figure out how to replace, disable it first

        Field logField = repp.getClass().getDeclaredField("LOG");
        Logger mockLogger = mock(Logger.class);
        Field modifiers = Field.class.getDeclaredField("modifiers");
        modifiers.setAccessible(true);
        modifiers.setInt(logField, logField.getModifiers() & ~Modifier.FINAL);

See also https://issues.apache.org/jira/browse/CASSANDRA-18181

Changes

  1. Added junit5 annotation @EnabledForJreRange(max = JRE.JAVA_17)(It's modern and better than junit4) to tests that use suspend and resume, effectively disabling these tests on JDK versions higher than 17 where these methods are not supported.
  2. BookieZKExpireTest should be annotated as junit5 test.
  3. Make BookKeeperClusterTestCase compatible to junit5.

…RegionAwareEnsemblePlacementPolicy beyond jdk11

Signed-off-by: ZhangJian He <shoothzj@gmail.com>
Signed-off-by: ZhangJian He <shoothzj@gmail.com>
@shoothzj
Copy link
Member Author

shoothzj commented May 5, 2024

Copy link
Member

@StevenLuMT StevenLuMT left a comment

Choose a reason for hiding this comment

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

LGTM

@shoothzj shoothzj merged commit b38b171 into apache:master May 5, 2024
20 checks passed
@shoothzj shoothzj deleted the fix-jdk21-test branch May 5, 2024 23:27
@hangc0276 hangc0276 added this to the 4.18.0 milestone May 25, 2024
zhiheng123 pushed a commit to zhiheng123/bookkeeper that referenced this pull request Jun 5, 2024
…RegionAwareEnsemblePlacementPolicy beyond jdk11 (apache#4323)

### Motivation

In JDK21, it's is no way to change private static final variable currently, before figure out how to replace, disable it first

```
        Field logField = repp.getClass().getDeclaredField("LOG");
        Logger mockLogger = mock(Logger.class);
        Field modifiers = Field.class.getDeclaredField("modifiers");
        modifiers.setAccessible(true);
        modifiers.setInt(logField, logField.getModifiers() & ~Modifier.FINAL);
```

See also https://issues.apache.org/jira/browse/CASSANDRA-18181

### Changes

1. Added junit5 annotation `@EnabledForJreRange(max = JRE.JAVA_17)`(It's modern and better than junit4) to tests that use `suspend` and `resume`, effectively disabling these tests on JDK versions higher than 17 where these methods are not supported.
2. BookieZKExpireTest should be annotated as junit5 test.
3. Make `BookKeeperClusterTestCase` compatible to junit5.

Signed-off-by: ZhangJian He <shoothzj@gmail.com>
zhiheng123 pushed a commit to zhiheng123/bookkeeper that referenced this pull request Jun 7, 2024
…RegionAwareEnsemblePlacementPolicy beyond jdk11 (apache#4323)

### Motivation

In JDK21, it's is no way to change private static final variable currently, before figure out how to replace, disable it first

```
        Field logField = repp.getClass().getDeclaredField("LOG");
        Logger mockLogger = mock(Logger.class);
        Field modifiers = Field.class.getDeclaredField("modifiers");
        modifiers.setAccessible(true);
        modifiers.setInt(logField, logField.getModifiers() & ~Modifier.FINAL);
```

See also https://issues.apache.org/jira/browse/CASSANDRA-18181

### Changes

1. Added junit5 annotation `@EnabledForJreRange(max = JRE.JAVA_17)`(It's modern and better than junit4) to tests that use `suspend` and `resume`, effectively disabling these tests on JDK versions higher than 17 where these methods are not supported.
2. BookieZKExpireTest should be annotated as junit5 test.
3. Make `BookKeeperClusterTestCase` compatible to junit5.

Signed-off-by: ZhangJian He <shoothzj@gmail.com>
zhiheng123 pushed a commit to zhiheng123/bookkeeper that referenced this pull request Jun 7, 2024
…RegionAwareEnsemblePlacementPolicy beyond jdk11 (apache#4323)

### Motivation

In JDK21, it's is no way to change private static final variable currently, before figure out how to replace, disable it first

```
        Field logField = repp.getClass().getDeclaredField("LOG");
        Logger mockLogger = mock(Logger.class);
        Field modifiers = Field.class.getDeclaredField("modifiers");
        modifiers.setAccessible(true);
        modifiers.setInt(logField, logField.getModifiers() & ~Modifier.FINAL);
```

See also https://issues.apache.org/jira/browse/CASSANDRA-18181

### Changes

1. Added junit5 annotation `@EnabledForJreRange(max = JRE.JAVA_17)`(It's modern and better than junit4) to tests that use `suspend` and `resume`, effectively disabling these tests on JDK versions higher than 17 where these methods are not supported.
2. BookieZKExpireTest should be annotated as junit5 test.
3. Make `BookKeeperClusterTestCase` compatible to junit5.

Signed-off-by: ZhangJian He <shoothzj@gmail.com>
Ghatage pushed a commit to sijie/bookkeeper that referenced this pull request Jul 12, 2024
…RegionAwareEnsemblePlacementPolicy beyond jdk11 (apache#4323)

### Motivation

In JDK21, it's is no way to change private static final variable currently, before figure out how to replace, disable it first

```
        Field logField = repp.getClass().getDeclaredField("LOG");
        Logger mockLogger = mock(Logger.class);
        Field modifiers = Field.class.getDeclaredField("modifiers");
        modifiers.setAccessible(true);
        modifiers.setInt(logField, logField.getModifiers() & ~Modifier.FINAL);
```

See also https://issues.apache.org/jira/browse/CASSANDRA-18181

### Changes

1. Added junit5 annotation `@EnabledForJreRange(max = JRE.JAVA_17)`(It's modern and better than junit4) to tests that use `suspend` and `resume`, effectively disabling these tests on JDK versions higher than 17 where these methods are not supported.
2. BookieZKExpireTest should be annotated as junit5 test.
3. Make `BookKeeperClusterTestCase` compatible to junit5.

Signed-off-by: ZhangJian He <shoothzj@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants