protected override void OnBeforeCall(IElasticClient client) { var executeWatchResponse = client.ExecuteWatch(e => e .Id(CallIsolatedValue) .TriggerData(tr => tr .TriggeredTime("now") .ScheduledTime("now") ) .ActionModes(f => f .Add("_all", ActionExecutionMode.Execute) ) .RecordExecution() ); if (!executeWatchResponse.IsValid) { throw new Exception($"Problem with ExecuteWatch for integration test: {executeWatchResponse.DebugInformation}"); } }
protected override void IntegrationSetup(IElasticClient client, CallUniqueValues values) { // set up a watch that can be acknowledged foreach (var callUniqueValue in values) { var watchId = callUniqueValue.Value; var putWatchResponse = client.PutWatch(watchId, p => p .Input(i => i .Simple(s => s .Add("payload", new { send = "yes" }) ) ) .Trigger(t => t .Schedule(s => s .Hourly(h => h .Minute(0, 5) ) ) ) .Condition(co => co .Always() ) .Actions(a => a .Index("test_index", i => i .ThrottlePeriod("15m") .Index("test-" + CallIsolatedValue) .DocType("acknowledgement") ) ) ); if (!putWatchResponse.IsValid) { throw new Exception("Problem setting up PutWatch for integration test"); } var getWatchResponse = client.GetWatch(watchId); if (!getWatchResponse.IsValid) { throw new Exception("Problem with GetWatch for integration test"); } getWatchResponse.Status.Actions["test_index"].Acknowledgement.State.Should().Be(AcknowledgementState.AwaitsSuccessfulExecution); var executeWatchResponse = client.ExecuteWatch(e => e .Id(watchId) .RecordExecution() ); if (!executeWatchResponse.IsValid) { throw new Exception("Problem with ExecuteWatch for integration test"); } getWatchResponse = client.GetWatch(watchId); if (!getWatchResponse.IsValid) { throw new Exception("Problem with GetWatch for integration test"); } getWatchResponse.Status.Actions["test_index"].Acknowledgement.State.Should().Be(AcknowledgementState.Acknowledgable); } }