mirror of https://github.com/apache/cassandra
Fix JMXFeatureTest failure due to disabled AsyncProfiler
patch by Arvind Kandpal; reviewed by Jyothsna Konisa, Stefan Miklosovic for CASSANDRA-21135
This commit is contained in:
parent
585f89bb42
commit
d1b4ddc32a
|
|
@ -368,6 +368,10 @@ public class AsyncProfilerService implements AsyncProfilerMBean
|
|||
@Override
|
||||
public String status()
|
||||
{
|
||||
if (!ASYNC_PROFILER_ENABLED.getBoolean())
|
||||
{
|
||||
return "Async Profiler is not enabled. Enable it by setting " + ASYNC_PROFILER_ENABLED.getKey() + " property to true.";
|
||||
}
|
||||
return run(new ThrowingFunction<>()
|
||||
{
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -264,14 +264,13 @@ public class AsyncProfilerServiceTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testProfilerDisabledThrowsException()
|
||||
public void testProfilerDisabledReturnsMessage()
|
||||
{
|
||||
try (WithProperties properties = new WithProperties().set(ASYNC_PROFILER_UNSAFE_MODE, true).set(ASYNC_PROFILER_ENABLED, false))
|
||||
{
|
||||
assertThatThrownBy(() -> {
|
||||
AsyncProfilerService profiler = getProfiler(true);
|
||||
profiler.status();
|
||||
}).hasMessageContaining("Async Profiler is not enabled. Enable it by setting cassandra.async_profiler.enabled property to true.");
|
||||
AsyncProfilerService profiler = getProfiler(true);
|
||||
String status = profiler.status();
|
||||
assertTrue(status.contains("Async Profiler is not enabled. Enable it by setting " + ASYNC_PROFILER_ENABLED.getKey() + " property to true."));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue