From 6e0a6a90ea2ccf0752dabe515e0c0f57ea717072 Mon Sep 17 00:00:00 2001 From: George Drak Date: Wed, 1 Mar 2023 15:44:47 +0500 Subject: [PATCH] test(elasticstack): fill test settings --- .../ElasticStackScope.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/Sitko.Core.ElasticStack.Tests/ElasticStackScope.cs b/tests/Sitko.Core.ElasticStack.Tests/ElasticStackScope.cs index 93c1fef04..ca47c1191 100644 --- a/tests/Sitko.Core.ElasticStack.Tests/ElasticStackScope.cs +++ b/tests/Sitko.Core.ElasticStack.Tests/ElasticStackScope.cs @@ -1,5 +1,6 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; +using Serilog.Sinks.Elasticsearch; using Sitko.Core.App.Web; using Sitko.Core.Xunit; @@ -19,6 +20,12 @@ public ElasticStartup(IConfiguration configuration, IHostEnvironment environment public class ElasticApplication : WebApplication { - public ElasticApplication(string[] args) : base(args) => this.AddElasticStack(); + public ElasticApplication(string[] args) : base(args) => this.AddElasticStack(options => + { + options.ElasticSearchUrls = new List { new("http://localhost:9200") }; + options.LoggingTemplateVersion = AutoRegisterTemplateVersion.ESv8; + options.LoggingIndexFormat = "logs-test"; + options.EmitEventFailure = EmitEventFailureHandling.WriteToSelfLog | EmitEventFailureHandling.RaiseCallback; + options.FailureCallback = e => Console.WriteLine("Unable to submit event to elastic: " + e.MessageTemplate); + }); } -