15
15
16
16
namespace ElasticLogger . Test
17
17
{
18
- public class ElasticsearchLoggerFilterTests : IClassFixture < ESFixture >
18
+ public class ElasticsearchLoggerFilterTests : IClassFixture < ElasticsearchFixture >
19
19
{
20
20
private readonly ITestOutputHelper _output ;
21
- private readonly ESFixture _fixture ;
21
+ private readonly ElasticsearchFixture _fixture ;
22
22
23
- public ElasticsearchLoggerFilterTests ( ESFixture fixture , ITestOutputHelper output )
23
+ public ElasticsearchLoggerFilterTests ( ElasticsearchFixture fixture , ITestOutputHelper output )
24
24
{
25
25
_fixture = fixture ;
26
26
_output = output ;
27
27
}
28
28
29
+ private ConnectionSettings connectionSettings ( Uri endpoint )
30
+ {
31
+ var connSettings = new ConnectionSettings ( _fixture . Endpoint ) ;
32
+ connSettings . ServerCertificateValidationCallback ( ( obj , cert , chain , policyerrors ) => true ) ;
33
+ return connSettings ;
34
+ }
35
+
29
36
[ Fact ]
30
37
public async Task No_categories_for_es_should_use_default ( )
31
38
{
@@ -64,7 +71,7 @@ public async Task No_categories_for_es_should_use_default()
64
71
logger . LogTrace ( "bananas taste yucky" ) ;
65
72
66
73
var delayTask = Task . Delay ( TimeSpan . FromSeconds ( 5 ) ) ;
67
- var client = new ElasticClient ( new ConnectionSettings ( _fixture . Endpoint ) ) ;
74
+ var client = new ElasticClient ( connectionSettings ( _fixture . Endpoint ) ) ;
68
75
await client . PingAsync ( ) ;
69
76
await delayTask ;
70
77
@@ -125,7 +132,7 @@ public async Task Configured_categories_dont_log_for_config()
125
132
logger . LogTrace ( "bananas taste yucky" ) ;
126
133
127
134
var delayTask = Task . Delay ( TimeSpan . FromSeconds ( 5 ) ) ;
128
- var client = new ElasticClient ( new ConnectionSettings ( _fixture . Endpoint ) ) ;
135
+ var client = new ElasticClient ( connectionSettings ( _fixture . Endpoint ) ) ;
129
136
await client . PingAsync ( ) ;
130
137
await delayTask ;
131
138
@@ -181,7 +188,7 @@ public async Task No_elasticsearch_section_should_use_default_log_level()
181
188
logger . LogTrace ( "bananas taste yucky" ) ;
182
189
183
190
var delayTask = Task . Delay ( TimeSpan . FromSeconds ( 5 ) ) ;
184
- var client = new ElasticClient ( new ConnectionSettings ( _fixture . Endpoint ) ) ;
191
+ var client = new ElasticClient ( connectionSettings ( _fixture . Endpoint ) ) ;
185
192
await client . PingAsync ( ) ;
186
193
await delayTask ;
187
194
@@ -287,7 +294,7 @@ private async Task LevelTesterPositive(string source, LogLevel logLevel)
287
294
logger . Log ( logLevel , new EventId ( ) , circularRefObj , null , ( circle , exception ) => "" ) ;
288
295
289
296
var delayTask = Task . Delay ( TimeSpan . FromSeconds ( 5 ) ) ;
290
- var client = new ElasticClient ( new ConnectionSettings ( _fixture . Endpoint ) ) ;
297
+ var client = new ElasticClient ( connectionSettings ( _fixture . Endpoint ) ) ;
291
298
await client . PingAsync ( ) ;
292
299
await delayTask ;
293
300
@@ -337,7 +344,7 @@ private async Task LevelTesterNegative(string source, LogLevel logLevel)
337
344
logger . Log ( logLevel , new EventId ( ) , circularRefObj , null , ( circle , exception ) => "" ) ;
338
345
339
346
var delayTask = Task . Delay ( TimeSpan . FromSeconds ( 5 ) ) ;
340
- var client = new ElasticClient ( new ConnectionSettings ( _fixture . Endpoint ) ) ;
347
+ var client = new ElasticClient ( connectionSettings ( _fixture . Endpoint ) ) ;
341
348
await client . PingAsync ( ) ;
342
349
await delayTask ;
343
350
@@ -359,7 +366,7 @@ private async Task LevelTesterNegative(string source, LogLevel logLevel)
359
366
public async Task Load_ES_with_explicit_type_write_and_search ( )
360
367
{
361
368
await _fixture . ReadyAsync ( ) ;
362
- var client = new ElasticClient ( new ConnectionSettings ( _fixture . Endpoint ) ) ;
369
+ var client = new ElasticClient ( connectionSettings ( _fixture . Endpoint ) ) ;
363
370
await client . PingAsync ( ) ;
364
371
365
372
var tweet = new Tweet
@@ -420,7 +427,7 @@ public async Task Missing_ElasticSearch_Section_In_Config_Should_Use_Logging_Def
420
427
logger . LogTrace ( "bananas taste yucky" ) ;
421
428
422
429
var delayTask = Task . Delay ( TimeSpan . FromSeconds ( 5 ) ) ;
423
- var client = new ElasticClient ( new ConnectionSettings ( _fixture . Endpoint ) ) ;
430
+ var client = new ElasticClient ( connectionSettings ( _fixture . Endpoint ) ) ;
424
431
await client . PingAsync ( ) ;
425
432
await delayTask ;
426
433
@@ -472,7 +479,8 @@ public async Task Missing_ElasticSearch_Section_In_Config_Should_Use_Logging_Def
472
479
logger . LogError ( "bananas taste yucky" ) ;
473
480
474
481
var delayTask = Task . Delay ( TimeSpan . FromSeconds ( 5 ) ) ;
475
- var client = new ElasticClient ( new ConnectionSettings ( _fixture . Endpoint ) ) ;
482
+
483
+ var client = new ElasticClient ( connectionSettings ( _fixture . Endpoint ) ) ;
476
484
await client . PingAsync ( ) ;
477
485
await delayTask ;
478
486
@@ -489,6 +497,8 @@ public async Task Missing_ElasticSearch_Section_In_Config_Should_Use_Logging_Def
489
497
Assert . Single ( dyndocs . Documents ) ;
490
498
}
491
499
500
+
501
+
492
502
[ Fact ]
493
503
public async Task Existing_ElasticSearch_Section_In_Config_Should_Be_Used_For_Log_Levels_Positive_Match ( )
494
504
{
@@ -525,7 +535,7 @@ public async Task Existing_ElasticSearch_Section_In_Config_Should_Be_Used_For_Lo
525
535
logger . LogTrace ( "bananas taste yucky" ) ;
526
536
527
537
var delayTask = Task . Delay ( TimeSpan . FromSeconds ( 5 ) ) ;
528
- var client = new ElasticClient ( new ConnectionSettings ( _fixture . Endpoint ) ) ;
538
+ var client = new ElasticClient ( connectionSettings ( _fixture . Endpoint ) ) ;
529
539
await client . PingAsync ( ) ;
530
540
await delayTask ;
531
541
@@ -578,7 +588,7 @@ public async Task Existing_ElasticSearch_Section_In_Config_Should_Be_Used_For_Lo
578
588
logger . LogCritical ( "bananas taste yucky" ) ;
579
589
580
590
var delayTask = Task . Delay ( TimeSpan . FromSeconds ( 5 ) ) ;
581
- var client = new ElasticClient ( new ConnectionSettings ( _fixture . Endpoint ) ) ;
591
+ var client = new ElasticClient ( connectionSettings ( _fixture . Endpoint ) ) ;
582
592
await client . PingAsync ( ) ;
583
593
await delayTask ;
584
594
@@ -632,7 +642,7 @@ public async Task Existing_ElasticSearch_Section_With_Category_Should_Match_Top_
632
642
logger . LogInformation ( "bananas taste yucky" ) ;
633
643
634
644
var delayTask = Task . Delay ( TimeSpan . FromSeconds ( 5 ) ) ;
635
- var client = new ElasticClient ( new ConnectionSettings ( _fixture . Endpoint ) ) ;
645
+ var client = new ElasticClient ( connectionSettings ( _fixture . Endpoint ) ) ;
636
646
await client . PingAsync ( ) ;
637
647
await delayTask ;
638
648
@@ -686,7 +696,7 @@ public async Task Existing_ElasticSearch_Section_With_Category_Should_Match_Top_
686
696
logger . LogInformation ( "bananas taste yucky" ) ;
687
697
688
698
var delayTask = Task . Delay ( TimeSpan . FromSeconds ( 5 ) ) ;
689
- var client = new ElasticClient ( new ConnectionSettings ( _fixture . Endpoint ) ) ;
699
+ var client = new ElasticClient ( connectionSettings ( _fixture . Endpoint ) ) ;
690
700
await client . PingAsync ( ) ;
691
701
await delayTask ;
692
702
@@ -740,7 +750,7 @@ public async Task Existing_ElasticSearch_Section_With_Category_Should_Match_Bott
740
750
logger . LogCritical ( "bananas taste yucky" ) ;
741
751
742
752
var delayTask = Task . Delay ( TimeSpan . FromSeconds ( 5 ) ) ;
743
- var client = new ElasticClient ( new ConnectionSettings ( _fixture . Endpoint ) ) ;
753
+ var client = new ElasticClient ( connectionSettings ( _fixture . Endpoint ) ) ;
744
754
await client . PingAsync ( ) ;
745
755
await delayTask ;
746
756
@@ -794,7 +804,7 @@ public async Task Existing_ElasticSearch_Section_With_Category_Should_Match_Bott
794
804
logger . LogInformation ( "bananas taste yucky" ) ;
795
805
796
806
var delayTask = Task . Delay ( TimeSpan . FromSeconds ( 5 ) ) ;
797
- var client = new ElasticClient ( new ConnectionSettings ( _fixture . Endpoint ) ) ;
807
+ var client = new ElasticClient ( connectionSettings ( _fixture . Endpoint ) ) ;
798
808
await client . PingAsync ( ) ;
799
809
await delayTask ;
800
810
0 commit comments