Skip to content

Commit

Permalink
Revert "MNT-23889 - added tests for checking readiness after reaching…
Browse files Browse the repository at this point in the history
… max transforms limit"

This reverts commit 0886f8a.
  • Loading branch information
goleksyalfresco committed Oct 18, 2023
1 parent 0886f8a commit dbd4299
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ public class ProbeTransform
private long maxTime = Long.MAX_VALUE;
private long nextTransformTime;

private boolean livenessTransformEnabled;
private final boolean livenessTransformEnabled;
private final long livenessTransformPeriod;
private long maxTransformCount;
private final long maxTransformCount;
private long maxTransformTime;

private final AtomicBoolean initialised = new AtomicBoolean(false);
Expand Down Expand Up @@ -166,16 +166,6 @@ private long getPositiveLongEnv(String name, long defaultValue)
return l;
}

public void setLivenessTransformEnabled(boolean enabled)
{
livenessTransformEnabled = enabled;
}

public void setMaxTransformCount(long transforms)
{
maxTransformCount = transforms;
}

// We don't want to be doing test transforms every few seconds, but do want frequent live probes.
public String doTransformOrNothing(boolean isLiveProbe, TransformHandler transformHandler)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@

import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
import static org.alfresco.transform.common.RequestParamMap.DIRECT_ACCESS_URL;
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_READY;
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM;
import static org.hamcrest.Matchers.containsString;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
Expand All @@ -86,7 +84,6 @@
*/
@SpringBootTest(classes={org.alfresco.transform.base.Application.class})
@AutoConfigureMockMvc

public abstract class AbstractBaseTest
{
// Added as part of ATS-702 to allow test resources to be read from the imported jar files to prevent test
Expand Down Expand Up @@ -314,28 +311,6 @@ public void simpleTransformTest() throws Exception
"attachment; filename*=UTF-8''transform." + targetExtension));
}

@Test
public void readinessShouldReturnAnErrorAfterReachingMaxTransforms() throws Exception
{
controller.getProbeTransform().setLivenessTransformEnabled(true);
controller.getProbeTransform().setMaxTransformCount(10);

int max_transforms = 11;
for (int i = 0; i<max_transforms; i++) {
mockMvc.perform(mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile))
.andExpect(status().isOk())
.andExpect(content().bytes(expectedTargetFileBytes))
.andExpect(header().string("Content-Disposition",
"attachment; filename*=UTF-8''transform." + targetExtension));
}

mockMvc.perform(MockMvcRequestBuilders.get(ENDPOINT_READY))
.andExpect(status().isTooManyRequests())
.andExpect(content().string(containsString("10 transformations")));

controller.getProbeTransform().setLivenessTransformEnabled(false);
}

@Test
public void dotDotSourceFilenameTest() throws Exception
{
Expand Down

0 comments on commit dbd4299

Please sign in to comment.