mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-08-14 17:58:27 +00:00
Reset probe in testing
This commit is contained in:
@@ -249,7 +249,7 @@ public abstract class ProbeTestTransform
|
||||
{
|
||||
throw new TransformException(TOO_MANY_REQUESTS,
|
||||
getMessagePrefix(isLiveProbe) + "Transformer requested to die. A transform took " +
|
||||
"longer than " + (maxTransformTime * 1000) + " seconds");
|
||||
"longer than " + (maxTransformTime / 1000) + " seconds");
|
||||
}
|
||||
|
||||
if (maxTransformCount > 0 && transformCount.get() > maxTransformCount)
|
||||
|
@@ -242,7 +242,7 @@ public class ProbeTransform
|
||||
{
|
||||
throw new TransformException(TOO_MANY_REQUESTS,
|
||||
getMessagePrefix(isLiveProbe) + "Transformer requested to die. A transform took " +
|
||||
"longer than " + (maxTransformTime * 1000) + " seconds");
|
||||
"longer than " + (maxTransformTime / 1000) + " seconds");
|
||||
}
|
||||
|
||||
if (maxTransformCount > 0 && transformCount.get() > maxTransformCount)
|
||||
@@ -302,8 +302,7 @@ public class ProbeTransform
|
||||
true)) || transCount > AVERAGE_OVER_TRANSFORMS)
|
||||
{
|
||||
nextTransformTime = System.currentTimeMillis() + livenessTransformPeriod;
|
||||
logger.trace("{} - {}ms+{}%={}ms", message, normalTime, livenessPercent,
|
||||
maxTime);
|
||||
logger.trace("{} - {}ms+{}%={}ms", message, normalTime, livenessPercent, maxTime);
|
||||
}
|
||||
}
|
||||
else if (!isLiveProbe && !readySent.getAndSet(true))
|
||||
@@ -356,4 +355,10 @@ public class ProbeTransform
|
||||
{
|
||||
return normalTime;
|
||||
}
|
||||
|
||||
public void resetForTesting()
|
||||
{
|
||||
die.set(false);
|
||||
transformCount.set(0);
|
||||
}
|
||||
}
|
||||
|
@@ -129,6 +129,7 @@ public class TransformControllerTest
|
||||
public File tempDir;
|
||||
@MockBean
|
||||
protected AlfrescoSharedFileStoreClient fakeSfsClient;
|
||||
|
||||
@BeforeEach
|
||||
public void fakeSfsClient()
|
||||
{
|
||||
@@ -229,6 +230,7 @@ public class TransformControllerTest
|
||||
@Test
|
||||
public void testReadyEndpointReturnsSuccessful() throws Exception
|
||||
{
|
||||
transformController.probeTransform.resetForTesting();
|
||||
mockMvc.perform(MockMvcRequestBuilders.get(ENDPOINT_READY))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().string(containsString("Success - ")));
|
||||
@@ -237,6 +239,7 @@ public class TransformControllerTest
|
||||
@Test
|
||||
public void testLiveEndpointReturnsSuccessful() throws Exception
|
||||
{
|
||||
transformController.probeTransform.resetForTesting();
|
||||
mockMvc.perform(MockMvcRequestBuilders.get(ENDPOINT_LIVE))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().string(containsString("Success - ")));
|
||||
|
Reference in New Issue
Block a user