[ 
https://issues.apache.org/jira/browse/SOLR-13079?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hoss Man reassigned SOLR-13079:
-------------------------------

      Assignee: Hoss Man
    Attachment: SOLR-13079.patch

Attaching a patch – it's mostly a lot of rote refactoring.

For #1, Tests that use to look like this...
{code:java}
import static 
org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
...
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, ...);
{code}
...now look like this...
{code:java}
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
...
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, ...);
{code}
For #2 & #3, tests that use to look like something like this...
{code:java}
// disable .scheduled_maintenance
String suspendTriggerCommand = "{" +
    "'suspend-trigger' : {'name' : '.scheduled_maintenance'}" +
    "}";
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, 
suspendTriggerCommand);
SolrClient solrClient = cluster.getSolrClient();
NamedList<Object> response = solrClient.request(req);
assertEquals(response.get("result").toString(), "success");
{code}
...now look like this if they are a sim test...
{code:java}
// disable .scheduled_maintenance (once it exists)
CloudTestUtils.waitForTriggerToBeScheduled(cluster, ".scheduled_maintenance");
CloudTestUtils.suspendTrigger(cluster, ".scheduled_maintenance");
{code}
...or this if they use a full MiniSolrCloudCluster...
{code:java}
// disable .scheduled_maintenance (once it exists)
CloudTestUtils.waitForTriggerToBeScheduled(cluster.getOpenOverseer().getSolrCloudManager(),
 ".scheduled_maintenance");
CloudTestUtils.suspendTrigger(cluster.getOpenOverseer().getSolrCloudManager(), 
".scheduled_maintenance");
{code}
...any concerns?

> refactor and harden common 'suspend-trigger' patern in autoscaling test setup
> -----------------------------------------------------------------------------
>
>                 Key: SOLR-13079
>                 URL: https://issues.apache.org/jira/browse/SOLR-13079
>             Project: Solr
>          Issue Type: Sub-task
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Hoss Man
>            Assignee: Hoss Man
>            Priority: Major
>         Attachments: SOLR-13079.patch
>
>
> A semi-common pattern in autoscaling tests is that immediately after 
> configuring the cluster, they (ab)use 
> {{AutoScalingHandlerTest.createAutoScalingRequest(...)}} to exec 
> {{suspend-trigger}} on {{".scheduled_maintenance"}}.
> The problem that can occasionally pops up in jenkins failures is that it's 
> possible the OverseerThread hasn't gotten a chance to add this implicit 
> trigger to the schedule by the time the test code tries to do this...
> {noformat}
>    [junit4] ERROR   0.03s J1 | TestSimTriggerIntegration.testCooldown <<<
>    [junit4]    > Throwable #1: java.io.IOException: 
> java.util.concurrent.ExecutionException: java.io.IOException: 
> org.apache.solr.api.ApiBag$ExceptionWithErrObject: Error in command payload, 
> errors: [{suspend-trigger={name=.scheduled_maintenance}, errorMessages=[No 
> trigger exists with name: .scheduled_maintenance]}], 
>    [junit4]    >        at 
> __randomizedtesting.SeedInfo.seed([51029DC2D3857924:60BCF026AD2F0CD6]:0)
>    [junit4]    >        at 
> org.apache.solr.cloud.autoscaling.sim.SimCloudManager.request(SimCloudManager.java:654)
>    [junit4]    >        at 
> org.apache.solr.cloud.autoscaling.sim.SimCloudManager$1.request(SimCloudManager.java:224)
>    [junit4]    >        at 
> org.apache.solr.client.solrj.SolrClient.request(SolrClient.java:1260)
>    [junit4]    >        at 
> org.apache.solr.cloud.autoscaling.sim.TestSimTriggerIntegration.setupTest(TestSimTriggerIntegration.java:136)
> {noformat}
> I think we should:
> # refactor the {{AutoScalingHandlerTest.AutoScalingRequest}} static inner 
> class into {{CloudTestUtils}}
> # add a helper method to {{CloudTestUtils}} to make it easy to wait for a 
> trigger to be scheduled
> # add a helper method to {{CloudTestUtils}} to make it easy to susspend an 
> existing trigger



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to