Skip to content

Commit

Permalink
fixup! [FLINK-32858][tests][JUnit5 migration] Address Jiabao's other …
Browse files Browse the repository at this point in the history
…comments
  • Loading branch information
X-czh committed Aug 17, 2023
1 parent 051cb01 commit 1c3fa12
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
Expand Up @@ -46,7 +46,7 @@ public void testJavaMemory() {
assertThat(free).isGreaterThanOrEqualTo(0);
} catch (RuntimeException e) {
// this may only occur if the Xmx is not set
assertThat(Long.MAX_VALUE).isEqualTo(EnvironmentInformation.getMaxJvmHeapMemory());
assertThat(EnvironmentInformation.getMaxJvmHeapMemory()).isEqualTo(Long.MAX_VALUE);
}

// we cannot make these assumptions, because the test JVM may grow / shrink during the
Expand Down
Expand Up @@ -176,8 +176,9 @@ void testConvertToFractionOfSlot() {
Optional.of(true),
ClassLoader.getSystemClassLoader());

assertThat(fractionOfUseCase * OPERATOR_WEIGHT / TOTAL_WEIGHT)
.isCloseTo(fractionOfSlot, Offset.offset(DELTA));
assertThat(fractionOfSlot)
.isCloseTo(
fractionOfUseCase * OPERATOR_WEIGHT / TOTAL_WEIGHT, Offset.offset(DELTA));
}

@Test
Expand Down Expand Up @@ -209,7 +210,7 @@ void testConvertToFractionOfSlotWeightNotConfigured() {
Optional.of(true),
ClassLoader.getSystemClassLoader());

assertThat(0.0).isCloseTo(fractionOfSlot, Offset.offset(DELTA));
assertThat(fractionOfSlot).isCloseTo(0.0, Offset.offset(DELTA));
}

@Test
Expand Down Expand Up @@ -268,12 +269,12 @@ private void testConvertToFractionOfSlotGivenWhetherStateBackendUsesManagedMemor
Optional.of(stateBackendUsesManagedMemory),
ClassLoader.getSystemClassLoader());

assertThat(expectedOperatorFractionOfSlot)
.isCloseTo(opFractionOfSlot, Offset.offset(DELTA));
assertThat(expectedStateFractionOfSlot)
.isCloseTo(stateFractionOfSlot, Offset.offset(DELTA));
assertThat(expectedPythonFractionOfSlot)
.isCloseTo(pythonFractionOfSlot, Offset.offset(DELTA));
assertThat(opFractionOfSlot)
.isCloseTo(expectedOperatorFractionOfSlot, Offset.offset(DELTA));
assertThat(stateFractionOfSlot)
.isCloseTo(expectedStateFractionOfSlot, Offset.offset(DELTA));
assertThat(pythonFractionOfSlot)
.isCloseTo(expectedPythonFractionOfSlot, Offset.offset(DELTA));
}

@Test
Expand Down
Expand Up @@ -131,9 +131,9 @@ void testExceptionShouldContainRequiredConfigOptions() {
processSpecFromConfig(new Configuration());
} catch (IllegalConfigurationException e) {
options.getRequiredFineGrainedOptions()
.forEach(option -> assertThat(e.getMessage()).contains(option.key()));
assertThat(e.getMessage()).contains(options.getTotalFlinkMemoryOption().key());
assertThat(e.getMessage()).contains(options.getTotalProcessMemoryOption().key());
.forEach(option -> assertThat(e).hasMessageContaining(option.key()));
assertThat(e).hasMessageContaining(options.getTotalFlinkMemoryOption().key());
assertThat(e).hasMessageContaining(options.getTotalProcessMemoryOption().key());
}
}

Expand Down

0 comments on commit 1c3fa12

Please sign in to comment.