/
DefaultConfigurationTests.cs
3633 lines (3018 loc) · 173 KB
/
DefaultConfigurationTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2020 New Relic, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Serialization;
using NewRelic.Agent.Core.Config;
using NewRelic.Agent.Core.DataTransport;
using NewRelic.SystemInterfaces;
using NewRelic.SystemInterfaces.Web;
using NewRelic.Testing.Assertions;
using NUnit.Framework;
using Telerik.JustMock;
namespace NewRelic.Agent.Core.Configuration.UnitTest
{
internal class TestableDefaultConfiguration : DefaultConfiguration
{
public TestableDefaultConfiguration(IEnvironment environment, configuration localConfig, ServerConfiguration serverConfig, RunTimeConfiguration runTimeConfiguration, SecurityPoliciesConfiguration securityPoliciesConfiguration, IProcessStatic processStatic, IHttpRuntimeStatic httpRuntimeStatic, IConfigurationManagerStatic configurationManagerStatic, IDnsStatic dnsStatic)
: base(environment, localConfig, serverConfig, runTimeConfiguration, securityPoliciesConfiguration, processStatic, httpRuntimeStatic, configurationManagerStatic, dnsStatic) { }
public static void ResetStatics()
{
_agentEnabledAppSettingParsed = null;
_appSettingAgentEnabled = false;
}
}
[TestFixture, Category("Configuration")]
public class DefaultConfigurationTests
{
private IEnvironment _environment;
private IProcessStatic _processStatic;
private IHttpRuntimeStatic _httpRuntimeStatic;
private IConfigurationManagerStatic _configurationManagerStatic;
private configuration _localConfig;
private ServerConfiguration _serverConfig;
private RunTimeConfiguration _runTimeConfig;
private SecurityPoliciesConfiguration _securityPoliciesConfiguration;
private DefaultConfiguration _defaultConfig;
private IDnsStatic _dnsStatic;
[SetUp]
public void SetUp()
{
_environment = Mock.Create<IEnvironment>();
_processStatic = Mock.Create<IProcessStatic>();
_httpRuntimeStatic = Mock.Create<IHttpRuntimeStatic>();
_configurationManagerStatic = Mock.Create<IConfigurationManagerStatic>();
_localConfig = new configuration();
_serverConfig = new ServerConfiguration();
_runTimeConfig = new RunTimeConfiguration();
_securityPoliciesConfiguration = new SecurityPoliciesConfiguration();
_dnsStatic = Mock.Create<IDnsStatic>();
_defaultConfig = new TestableDefaultConfiguration(_environment, _localConfig, _serverConfig, _runTimeConfig, _securityPoliciesConfiguration, _processStatic, _httpRuntimeStatic, _configurationManagerStatic, _dnsStatic);
TestableDefaultConfiguration.ResetStatics();
}
[Test]
public void AgentEnabledShouldPassThroughToLocalConfig()
{
Assert.IsTrue(_defaultConfig.AgentEnabled);
_localConfig.agentEnabled = false;
Assert.IsFalse(_defaultConfig.AgentEnabled);
_localConfig.agentEnabled = true;
Assert.IsTrue(_defaultConfig.AgentEnabled);
}
[Test]
public void AgentEnabledShouldUseCachedAppSetting()
{
Mock.Arrange(() => _configurationManagerStatic.GetAppSetting("NewRelic.AgentEnabled")).Returns("false");
Assert.IsFalse(_defaultConfig.AgentEnabled);
Assert.IsFalse(_defaultConfig.AgentEnabled);
Mock.Assert(() => _configurationManagerStatic.GetAppSetting("NewRelic.AgentEnabled"), Occurs.Once());
}
[Test]
public void AgentEnabledShouldPreferAppSettingOverLocalConfig()
{
Mock.Arrange(() => _configurationManagerStatic.GetAppSetting("NewRelic.AgentEnabled")).Returns("false");
_localConfig.agentEnabled = true;
Assert.IsFalse(_defaultConfig.AgentEnabled);
}
[TestCase(null, true, ExpectedResult = true)]
[TestCase(null, false, ExpectedResult = false)]
[TestCase(true, true, ExpectedResult = true)]
[TestCase(true, false, ExpectedResult = false)]
[TestCase(false, true, ExpectedResult = false)]
[TestCase(false, false, ExpectedResult = false)]
public bool TransactionEventsCanBeDisabledByServer(bool? server, bool local)
{
_localConfig.transactionEvents.enabled = local;
_serverConfig.AnalyticsEventCollectionEnabled = server;
return _defaultConfig.TransactionEventsEnabled;
}
[Test]
public void EveryConfigShouldGetNewVersionNumber()
{
var newConfig = new TestableDefaultConfiguration(_environment, _localConfig, _serverConfig, _runTimeConfig, _securityPoliciesConfiguration, _processStatic, _httpRuntimeStatic, _configurationManagerStatic, _dnsStatic);
Assert.AreEqual(_defaultConfig.ConfigurationVersion, newConfig.ConfigurationVersion - 1);
}
[Test]
public void WhenConfigsAreDefaultThenTransactionEventsAreEnabled()
{
Assert.IsTrue(_defaultConfig.TransactionEventsEnabled);
}
[Test]
public void WhenConfigsAreDefaultThenPutForDataSendIsDisabled()
{
Assert.IsFalse(_defaultConfig.PutForDataSend);
}
[Test]
public void WhenConfigsAreDefaultThenInstanceReportingEnabledIsEnabled()
{
Assert.IsTrue(_defaultConfig.InstanceReportingEnabled);
}
[Test]
public void WhenConfigsAreDefaultThenDatabaseNameReportingEnabledIsEnabled()
{
Assert.IsTrue(_defaultConfig.DatabaseNameReportingEnabled);
}
[Test]
public void WhenConfigsAreDefaultThenDatastoreTracerQueryParametersEnabledIsDisabled()
{
Assert.IsFalse(_defaultConfig.DatastoreTracerQueryParametersEnabled);
}
[TestCase(true, false, false, false, configurationTransactionTracerRecordSql.raw, ExpectedResult = true)]
[TestCase(true, false, false, false, configurationTransactionTracerRecordSql.obfuscated, ExpectedResult = false)]
[TestCase(true, false, false, false, configurationTransactionTracerRecordSql.off, ExpectedResult = false)]
[TestCase(true, true, false, false, configurationTransactionTracerRecordSql.raw, ExpectedResult = false)]
[TestCase(true, false, true, true, configurationTransactionTracerRecordSql.raw, ExpectedResult = false)]
[TestCase(true, false, true, false, configurationTransactionTracerRecordSql.raw, ExpectedResult = false)]
[TestCase(false, false, false, false, configurationTransactionTracerRecordSql.raw, ExpectedResult = false)]
public bool DatastoreTracerQueryParametersEnabledRespectsHighSecurityModeAndSecurityPolicy(
bool queryParametersEnabled,
bool highSecurityModeEnabled,
bool securityPolicyEnabled,
bool recordSqlSecurityPolicyEnabled,
configurationTransactionTracerRecordSql recordSqlSetting)
{
_localConfig.datastoreTracer.queryParameters.enabled = queryParametersEnabled;
_localConfig.highSecurity.enabled = highSecurityModeEnabled;
_localConfig.transactionTracer.recordSql = recordSqlSetting;
if (securityPolicyEnabled)
{
SetupNewConfigsWithSecurityPolicy("record_sql", recordSqlSecurityPolicyEnabled);
}
return _defaultConfig.DatastoreTracerQueryParametersEnabled;
}
[Test]
public void CompressedContentEncodingShouldBeDeflateWhenConfigsAreDefault()
{
Assert.AreEqual("deflate", _defaultConfig.CompressedContentEncoding);
}
[Test]
public void WhenTransactionEventsAreEnabledInLocalConfigAndDoNotExistInServerConfigThenTransactionEventsAreEnabled()
{
_localConfig.transactionEvents.enabled = true;
Assert.IsTrue(_defaultConfig.TransactionEventsEnabled);
}
[Test]
public void WhenConfigsAreDefaultThenCaptureAgentTimingIsDisabled()
{
Assert.AreEqual(false, _defaultConfig.DiagnosticsCaptureAgentTiming);
}
[Test]
public void WhenTransactionEventsAreDisabledInLocalConfigAndDoNotExistInServerConfigThenTransactionEventsAreDisabled()
{
_localConfig.transactionEvents.enabled = false;
Assert.IsFalse(_defaultConfig.TransactionEventsEnabled);
}
[Test]
public void TransactionEventsMaxSamplesStoredPassesThroughToLocalConfig()
{
Assert.AreEqual(10000, _defaultConfig.TransactionEventsMaximumSamplesStored);
_localConfig.transactionEvents.maximumSamplesStored = 10001;
Assert.AreEqual(10001, _defaultConfig.TransactionEventsMaximumSamplesStored);
_localConfig.transactionEvents.maximumSamplesStored = 9999;
Assert.AreEqual(9999, _defaultConfig.TransactionEventsMaximumSamplesStored);
}
[Test]
public void TransactionEventsMaxSamplesStoredOverriddenByEventHarvestConfig()
{
_localConfig.transactionEvents.maximumSamplesStored = 10001;
_serverConfig.EventHarvestConfig = new EventHarvestConfig
{
ReportPeriodMs = 5000,
HarvestLimits = new Dictionary<string, int> { { EventHarvestConfig.TransactionEventHarvestLimitKey, 10 } }
};
Assert.AreEqual(10, _defaultConfig.TransactionEventsMaximumSamplesStored);
}
[TestCase("10", 20, 30, ExpectedResult = 30)]
[TestCase("10", null, 30, ExpectedResult = 30)]
[TestCase("10", 20, null, ExpectedResult = 10)]
[TestCase("10", null, null, ExpectedResult = 10)]
[TestCase(null, 20, 30, ExpectedResult = 30)]
[TestCase(null, null, 30, ExpectedResult = 30)]
[TestCase(null, 20, null, ExpectedResult = 20)]
[TestCase(null, null, null, ExpectedResult = 10000)]
public int TransactionEventsMaxSamplesStoredOverriddenByEnvironment(string environmentSetting, int? localSetting, int? serverSetting)
{
Mock.Arrange(() => _environment.GetEnvironmentVariable("MAX_TRANSACTION_SAMPLES_STORED")).Returns(environmentSetting);
if (localSetting != null)
{
_localConfig.transactionEvents.maximumSamplesStored = (int)localSetting;
}
if (serverSetting != null)
{
_serverConfig.EventHarvestConfig = new EventHarvestConfig
{
ReportPeriodMs = 5000,
HarvestLimits = new Dictionary<string, int> { { EventHarvestConfig.TransactionEventHarvestLimitKey, (int)serverSetting } }
};
}
return _defaultConfig.TransactionEventsMaximumSamplesStored;
}
[Test]
public void TransactionEventsHarvestCycleUsesDefaultOrEventHarvestConfig()
{
Assert.AreEqual(TimeSpan.FromMinutes(1), _defaultConfig.TransactionEventsHarvestCycle);
_serverConfig.EventHarvestConfig = new EventHarvestConfig
{
ReportPeriodMs = 5000,
HarvestLimits = new Dictionary<string, int> { { EventHarvestConfig.TransactionEventHarvestLimitKey, 10 } }
};
Assert.AreEqual(TimeSpan.FromSeconds(5), _defaultConfig.TransactionEventsHarvestCycle);
}
[Test]
public void TransactionEventsMaxSamplesOf0ShouldDisableTransactionEvents()
{
_localConfig.transactionEvents.maximumSamplesStored = 0;
Assert.IsFalse(_defaultConfig.TransactionEventsEnabled);
}
[Test]
public void DisableServerConfigIsFalseByDefault()
{
Assert.IsFalse(_defaultConfig.IgnoreServerSideConfiguration);
}
[TestCase("true", ExpectedResult = true)]
[TestCase("false", ExpectedResult = false)]
public bool DisableServerConfigSetFromEnvironment(string environment)
{
Mock.Arrange(() => _environment.GetEnvironmentVariable("NEW_RELIC_IGNORE_SERVER_SIDE_CONFIG")).Returns(environment);
return _defaultConfig.IgnoreServerSideConfiguration;
}
[TestCase(true, null, null, ExpectedResult = true)]
[TestCase(true, null, true, ExpectedResult = true)]
[TestCase(true, null, false, ExpectedResult = false)]
[TestCase(true, true, true, ExpectedResult = true)]
[TestCase(true, false, true, ExpectedResult = false)]
[TestCase(true, true, false, ExpectedResult = false)]
[TestCase(true, false, null, ExpectedResult = false)]
[TestCase(true, true, null, ExpectedResult = true)]
[TestCase(false, null, null, ExpectedResult = false)]
[TestCase(false, null, true, ExpectedResult = true)]
[TestCase(false, null, false, ExpectedResult = false)]
[TestCase(false, true, true, ExpectedResult = true)]
[TestCase(false, false, true, ExpectedResult = false)]
[TestCase(false, true, false, ExpectedResult = false)]
[TestCase(false, false, null, ExpectedResult = false)]
[TestCase(false, true, null, ExpectedResult = false)]
public bool ErrorCollectorEnabledWithRpmCollectorEnabledServerOverrides(bool local, bool? server, bool? rpmConfigServer)
{
_localConfig.errorCollector.enabled = local;
_serverConfig.ErrorCollectionEnabled = server;
_serverConfig.RpmConfig.ErrorCollectorEnabled = rpmConfigServer;
return _defaultConfig.ErrorCollectorEnabled;
}
[Test]
public void ErrorsMaximumPerPeriodReturnsStatic20()
{
Assert.AreEqual(20, _defaultConfig.ErrorsMaximumPerPeriod);
}
[Test]
public void SqlTracesPerPeriodReturnsStatic10()
{
Assert.AreEqual(10, _defaultConfig.SqlTracesPerPeriod);
}
[Test]
public void SlowSqlServerOverridesWhenSet()
{
_serverConfig.RpmConfig.SlowSqlEnabled = true;
_localConfig.slowSql.enabled = false;
Assert.AreEqual(true, _defaultConfig.SlowSqlEnabled);
}
[Test]
public void SlowSqlServerOverridesWhenLocalIsDefault()
{
_serverConfig.RpmConfig.SlowSqlEnabled = false;
Assert.AreEqual(false, _defaultConfig.SlowSqlEnabled);
}
[Test]
public void SlowSqlDefaultIsTrue()
{
Assert.IsTrue(_defaultConfig.SlowSqlEnabled);
}
[Test]
public void SlowSqlLocalConfigSetToFalse()
{
_localConfig.slowSql.enabled = false;
Assert.IsFalse(_defaultConfig.SlowSqlEnabled);
}
[Test]
public void WhenStackTraceMaximumFramesIsSet()
{
_localConfig.maxStackTraceLines = 100;
Assert.AreEqual(100, _defaultConfig.StackTraceMaximumFrames);
}
[TestCase(null, ExpectedResult = 80)]
[TestCase(100, ExpectedResult = 100)]
public int StackTraceMaximumFramesSetFromLocal(int? maxFrames)
{
var value = maxFrames ?? 80;
_localConfig.maxStackTraceLines = value;
return _defaultConfig.StackTraceMaximumFrames;
}
[TestCase(true, ExpectedResult = true)]
[TestCase(false, ExpectedResult = false)]
public bool InstrumentationLoggingEnabledSetFromLocal(bool local)
{
_localConfig.instrumentation.log = local;
return _defaultConfig.InstrumentationLoggingEnabled;
}
[TestCase("true", false, ExpectedResult = true)]
[TestCase("false", true, ExpectedResult = false)]
[TestCase("1", false, ExpectedResult = true)]
[TestCase("0", true, ExpectedResult = false)]
[TestCase("blarg", true, ExpectedResult = true)]
[TestCase(null, true, ExpectedResult = true)]
[TestCase(null, false, ExpectedResult = false)]
public bool SendDataOnExitIsOverriddenByEnvironment(string environmentSetting, bool localSetting)
{
Mock.Arrange(() => _environment.GetEnvironmentVariable("NEW_RELIC_SEND_DATA_ON_EXIT")).Returns(environmentSetting);
_localConfig.service.sendDataOnExit = localSetting;
return _defaultConfig.CollectorSendDataOnExit;
}
[TestCase("100", 500f, ExpectedResult = 100)]
[TestCase("blarg", 500f, ExpectedResult = 500f)]
[TestCase(null, 500f, ExpectedResult = 500f)]
public float SendDataOnExitThresholdIsOverriddenByEnvironment(string environmentSetting, float localSetting)
{
Mock.Arrange(() => _environment.GetEnvironmentVariable("NEW_RELIC_SEND_DATA_ON_EXIT_THRESHOLD_MS")).Returns(environmentSetting);
_localConfig.service.sendDataOnExitThreshold = localSetting;
return _defaultConfig.CollectorSendDataOnExitThreshold;
}
[Test]
public void DiagnosticsCaptureAgentTimingSetFromLocal
([Values(true, false, null)] bool? localIsEnabled,
[Values(10, 100, 0, -1, null)] int? localFrequency
)
{
var expectedIsEnabled = localIsEnabled.GetValueOrDefault() && localFrequency.GetValueOrDefault(1) > 0;
var expectedFrequency = localFrequency.GetValueOrDefault(1);
if (localIsEnabled.HasValue)
{
_localConfig.diagnostics.captureAgentTiming = localIsEnabled.Value;
}
if (localFrequency.HasValue)
{
_localConfig.diagnostics.captureAgentTimingFrequency = localFrequency.Value;
}
NrAssert.Multiple
(
() => Assert.AreEqual(expectedIsEnabled, _defaultConfig.DiagnosticsCaptureAgentTiming, "Performance Timing Enabled"),
() => Assert.AreEqual(expectedFrequency, _defaultConfig.DiagnosticsCaptureAgentTimingFrequency, "Perforamcne Timing Frequency")
);
}
[TestCase(true, null, null, ExpectedResult = true)]
[TestCase(true, null, true, ExpectedResult = true)]
[TestCase(true, null, false, ExpectedResult = false)]
[TestCase(true, true, true, ExpectedResult = true)]
[TestCase(true, false, true, ExpectedResult = false)]
[TestCase(true, true, false, ExpectedResult = false)]
[TestCase(true, false, null, ExpectedResult = false)]
[TestCase(true, true, null, ExpectedResult = true)]
[TestCase(false, null, null, ExpectedResult = false)]
[TestCase(false, null, true, ExpectedResult = true)]
[TestCase(false, null, false, ExpectedResult = false)]
[TestCase(false, true, true, ExpectedResult = true)]
[TestCase(false, false, true, ExpectedResult = false)]
[TestCase(false, true, false, ExpectedResult = false)]
[TestCase(false, false, null, ExpectedResult = false)]
[TestCase(false, true, null, ExpectedResult = false)]
public bool TransactionTracerEnabledWithRpmCollectorEnabledServerOverrides(bool local, bool? server, bool? rpmConfigServer)
{
_localConfig.transactionTracer.enabled = local;
_serverConfig.TraceCollectionEnabled = server;
_serverConfig.RpmConfig.TransactionTracerEnabled = rpmConfigServer;
return _defaultConfig.TransactionTracerEnabled;
}
[TestCase(true, ExpectedResult = true)]
[TestCase(false, ExpectedResult = false)]
public bool Property_DataTransmissionPutForDataSend_set_from_local(bool local)
{
_localConfig.dataTransmission.putForDataSend = local;
return _defaultConfig.PutForDataSend;
}
[TestCase(true, ExpectedResult = true)]
[TestCase(false, ExpectedResult = false)]
public bool DatastoreTracerInstanceReportingEnabledSetFromLocal(bool local)
{
_localConfig.datastoreTracer.instanceReporting.enabled = local;
return _defaultConfig.InstanceReportingEnabled;
}
[TestCase(true, ExpectedResult = true)]
[TestCase(false, ExpectedResult = false)]
public bool DatastoreTracerDatabaseNameReportingEnabledSetFromLocal(bool local)
{
_localConfig.datastoreTracer.databaseNameReporting.enabled = local;
return _defaultConfig.DatabaseNameReportingEnabled;
}
[TestCase(configurationDataTransmissionCompressedContentEncoding.deflate, ExpectedResult = "deflate")]
[TestCase(configurationDataTransmissionCompressedContentEncoding.gzip, ExpectedResult = "gzip")]
public string CompressedContentEncodingShouldSetFromLocalConfiguration(configurationDataTransmissionCompressedContentEncoding local)
{
_localConfig.dataTransmission.compressedContentEncoding = local;
return _defaultConfig.CompressedContentEncoding;
}
[TestCase(true, ExpectedResult = true)]
[TestCase(false, ExpectedResult = false)]
public bool ErrorCollectorCatpureEventsSetFromLocal(bool local)
{
_localConfig.errorCollector.captureEvents = local;
return _defaultConfig.ErrorCollectorCaptureEvents;
}
[TestCase(true, false, ExpectedResult = false)]
[TestCase(false, true, ExpectedResult = false)]
[TestCase(true, true, ExpectedResult = true)]
[TestCase(false, false, ExpectedResult = false)]
public bool ErrorCollectorCaptureEventsConditionalOverrideFromServer(bool local, bool server)
{
_localConfig.errorCollector.captureEvents = local;
_serverConfig.ErrorEventCollectionEnabled = server;
return _defaultConfig.ErrorCollectorCaptureEvents;
}
[TestCase(50, ExpectedResult = 50)]
public int ErrorCollectorMaxNumberEventSamplesSetFromLocal(int local)
{
_localConfig.errorCollector.maxEventSamplesStored = local;
return _defaultConfig.ErrorCollectorMaxEventSamplesStored;
}
[TestCase(ExpectedResult = 100)]
public int ErrorCollectorMaxNumberEventSamplesDefaultFromLocal()
{
return _defaultConfig.ErrorCollectorMaxEventSamplesStored;
}
[Test]
public void ErrorEventsMaxSamplesStoredOverriddenByEventHarvestConfig()
{
_localConfig.errorCollector.maxEventSamplesStored = 10001;
_serverConfig.EventHarvestConfig = new EventHarvestConfig
{
ReportPeriodMs = 5000,
HarvestLimits = new Dictionary<string, int> { { EventHarvestConfig.ErrorEventHarvestLimitKey, 10 } }
};
Assert.AreEqual(10, _defaultConfig.ErrorCollectorMaxEventSamplesStored);
}
[Test]
public void ErrorEventsHarvestCycleUsesDefaultOrEventHarvestConfig()
{
Assert.AreEqual(TimeSpan.FromMinutes(1), _defaultConfig.ErrorEventsHarvestCycle);
_serverConfig.EventHarvestConfig = new EventHarvestConfig
{
ReportPeriodMs = 5000,
HarvestLimits = new Dictionary<string, int> { { EventHarvestConfig.ErrorEventHarvestLimitKey, 10 } }
};
Assert.AreEqual(TimeSpan.FromSeconds(5), _defaultConfig.ErrorEventsHarvestCycle);
}
[Test]
public void ErrorEventsMaxSamplesOf0ShouldDisableErrorEvents()
{
_localConfig.errorCollector.maxEventSamplesStored = 0;
Assert.IsFalse(_defaultConfig.ErrorCollectorCaptureEvents);
}
[TestCase(true, null, ExpectedResult = true)]
[TestCase(false, null, ExpectedResult = false)]
[TestCase(true, true, ExpectedResult = true)]
[TestCase(true, false, ExpectedResult = false)]
[TestCase(false, true, ExpectedResult = true)]
[TestCase(false, false, ExpectedResult = false)]
public bool SqlExplainPlansEnabledServerOverridesLocal(bool local, bool? server)
{
_localConfig.transactionTracer.explainEnabled = local;
_serverConfig.RpmConfig.TransactionTracerExplainEnabled = server;
return _defaultConfig.SqlExplainPlansEnabled;
}
[TestCase(3000.0, null, ExpectedResult = 3000.0)]
#if NET
[TestCase(3000.5, null, ExpectedResult = 3000.5)] // .NET doesn't round timespans the same way Framework did...
#else
[TestCase(3000.5, null, ExpectedResult = 3001.0)]
#endif
[TestCase(4000.0, 0.5, ExpectedResult = 500.0)]
[TestCase(200.0, 5.0, ExpectedResult = 5000.0)]
[TestCase(1.0, 0.2, ExpectedResult = 200.0)]
public double ExplainPlanThresholdSetFromServerOverridesLocal(double local, double? server)
{
_localConfig.transactionTracer.explainThreshold = (float)local;
if (server != null)
{
_serverConfig.RpmConfig.TransactionTracerExplainThreshold = server;
}
var configValue = _defaultConfig.SqlExplainPlanThreshold;
return configValue.TotalMilliseconds;
}
[TestCase(0.5, ExpectedResult = 500.0)]
[TestCase(1.0, ExpectedResult = 1000.0)]
[TestCase(1.5, ExpectedResult = 1500.0)]
public double ServerSideExplainPlanThresholdShouldConvertFromSeconds(double serverThreshold)
{
_serverConfig.RpmConfig.TransactionTracerExplainThreshold = serverThreshold;
var configValue = _defaultConfig.SqlExplainPlanThreshold;
return configValue.TotalMilliseconds;
}
[TestCase(100.0, ExpectedResult = 100.0)]
[TestCase(1500.0, ExpectedResult = 1500.0)]
[TestCase(3000.0, ExpectedResult = 3000.0)]
public double LocalExplainPlanThresholdShouldConvertFromMilliseconds(double localThreshold)
{
_localConfig.transactionTracer.explainThreshold = (float)localThreshold;
var configValue = _defaultConfig.SqlExplainPlanThreshold;
return configValue.TotalMilliseconds;
}
[Test]
public void SqlStatementsPerTransactionAlwaysReturns500()
{
Assert.AreEqual(500, _defaultConfig.SqlStatementsPerTransaction);
}
[TestCase(true, true, ExpectedResult = true)]
[TestCase(true, false, ExpectedResult = false)]
[TestCase(false, true, ExpectedResult = false)]
[TestCase(false, false, ExpectedResult = false)]
[TestCase(false, null, ExpectedResult = false)]
public bool TransactionEventsEnabledSetFromLocalServerCanDisable(bool local, bool? server)
{
_serverConfig.AnalyticsEventCollectionEnabled = server;
_localConfig.transactionEvents.enabled = local;
return _defaultConfig.TransactionEventsEnabled;
}
[TestCase(false, configurationTransactionTracerRecordSql.obfuscated, null, ExpectedResult = "obfuscated")]
[TestCase(false, configurationTransactionTracerRecordSql.off, null, ExpectedResult = "off")]
[TestCase(false, configurationTransactionTracerRecordSql.raw, null, ExpectedResult = "raw")]
[TestCase(false, configurationTransactionTracerRecordSql.obfuscated, "off", ExpectedResult = "off")]
[TestCase(false, configurationTransactionTracerRecordSql.off, "obfuscated", ExpectedResult = "obfuscated")]
[TestCase(false, configurationTransactionTracerRecordSql.raw, "off", ExpectedResult = "off")]
[TestCase(true, configurationTransactionTracerRecordSql.off, null, ExpectedResult = "off")]
[TestCase(true, configurationTransactionTracerRecordSql.obfuscated, null, ExpectedResult = "obfuscated")]
[TestCase(true, configurationTransactionTracerRecordSql.raw, null, ExpectedResult = "obfuscated")]
[TestCase(true, configurationTransactionTracerRecordSql.off, "off", ExpectedResult = "off")]
[TestCase(true, configurationTransactionTracerRecordSql.obfuscated, "off", ExpectedResult = "off")]
[TestCase(true, configurationTransactionTracerRecordSql.raw, "off", ExpectedResult = "off")]
[TestCase(true, configurationTransactionTracerRecordSql.obfuscated, "raw", ExpectedResult = "obfuscated")]
public string TransactionTracerRecordSqlSetFromLocalAndServerHighSecurityOverridesServerOverrides(bool highSecurity, configurationTransactionTracerRecordSql local, string server)
{
_localConfig.highSecurity.enabled = highSecurity;
_localConfig.transactionTracer.recordSql = local;
_serverConfig.RpmConfig.TransactionTracerRecordSql = server;
return _defaultConfig.TransactionTracerRecordSql;
}
[TestCase(configurationTransactionTracerRecordSql.raw, "raw", true, ExpectedResult = "obfuscated")]
[TestCase(configurationTransactionTracerRecordSql.raw, "raw", false, ExpectedResult = "off")]
[TestCase(configurationTransactionTracerRecordSql.raw, "obfuscated", true, ExpectedResult = "obfuscated")]
[TestCase(configurationTransactionTracerRecordSql.raw, "obfuscated", false, ExpectedResult = "off")]
[TestCase(configurationTransactionTracerRecordSql.raw, null, true, ExpectedResult = "obfuscated")]
[TestCase(configurationTransactionTracerRecordSql.raw, null, false, ExpectedResult = "off")]
[TestCase(configurationTransactionTracerRecordSql.obfuscated, "raw", true, ExpectedResult = "obfuscated")]
[TestCase(configurationTransactionTracerRecordSql.obfuscated, "raw", false, ExpectedResult = "off")]
[TestCase(configurationTransactionTracerRecordSql.obfuscated, "obfuscated", true, ExpectedResult = "obfuscated")]
[TestCase(configurationTransactionTracerRecordSql.obfuscated, "obfuscated", false, ExpectedResult = "off")]
[TestCase(configurationTransactionTracerRecordSql.obfuscated, null, true, ExpectedResult = "obfuscated")]
[TestCase(configurationTransactionTracerRecordSql.obfuscated, null, false, ExpectedResult = "off")]
[TestCase(configurationTransactionTracerRecordSql.off, "raw", true, ExpectedResult = "off")]
[TestCase(configurationTransactionTracerRecordSql.off, "raw", false, ExpectedResult = "off")]
[TestCase(configurationTransactionTracerRecordSql.off, "obfuscated", true, ExpectedResult = "off")]
[TestCase(configurationTransactionTracerRecordSql.off, "obfuscated", false, ExpectedResult = "off")]
[TestCase(configurationTransactionTracerRecordSql.off, null, true, ExpectedResult = "off")]
[TestCase(configurationTransactionTracerRecordSql.off, null, false, ExpectedResult = "off")]
public string RecordSqlMostSecureWinsNeverRawWithSecurityPolicies(configurationTransactionTracerRecordSql local, string server, bool securityPolicyEnabled)
{
SetupNewConfigsWithSecurityPolicy("record_sql", securityPolicyEnabled);
_localConfig.transactionTracer.recordSql = local;
_serverConfig.RpmConfig.TransactionTracerRecordSql = server;
return _defaultConfig.TransactionTracerRecordSql;
}
[TestCase(true, true, ExpectedResult = true)]
[TestCase(true, false, ExpectedResult = true)]
[TestCase(true, null, ExpectedResult = true)]
[TestCase(false, true, ExpectedResult = false)]
[TestCase(false, false, ExpectedResult = false)]
[TestCase(false, null, ExpectedResult = false)]
public bool HighSecuritySetFromLocalOverridesServer(bool local, bool? server)
{
_localConfig.highSecurity.enabled = local;
_serverConfig.HighSecurityEnabled = server;
return _defaultConfig.HighSecurityModeEnabled;
}
[TestCase(true, null, ExpectedResult = true)]
[TestCase(true, "true", ExpectedResult = true)]
[TestCase(true, "1", ExpectedResult = true)]
[TestCase(true, "false", ExpectedResult = false)]
[TestCase(true, "0", ExpectedResult = false)]
[TestCase(true, "invalid", ExpectedResult = true)]
[TestCase(false, null, ExpectedResult = false)]
[TestCase(false, "true", ExpectedResult = true)]
[TestCase(false, "1", ExpectedResult = true)]
[TestCase(false, "false", ExpectedResult = false)]
[TestCase(false, "0", ExpectedResult = false)]
[TestCase(false, "invalid", ExpectedResult = false)]
[TestCase(null, "true", ExpectedResult = true)]
[TestCase(null, "1", ExpectedResult = true)]
[TestCase(null, "false", ExpectedResult = false)]
[TestCase(null, "0", ExpectedResult = false)]
[TestCase(null, "invalid", ExpectedResult = false)]
[TestCase(null, null, ExpectedResult = false)]
public bool HighSecuritySetFromEnvironmentOverridesLocal(bool? localConfigValue, string envConfigValue)
{
Mock.Arrange(() => _environment.GetEnvironmentVariable("NEW_RELIC_HIGH_SECURITY")).Returns(envConfigValue);
if (localConfigValue.HasValue)
{
_localConfig.highSecurity.enabled = localConfigValue.Value;
}
return _defaultConfig.HighSecurityModeEnabled;
}
[TestCase(true, true, ExpectedResult = false)]
[TestCase(true, false, ExpectedResult = false)]
[TestCase(false, false, ExpectedResult = false)]
[TestCase(false, true, ExpectedResult = true)]
public bool CustomInstrumentationEditorHighSecurityOverrides(bool highSecurity, bool customInstrumentationEditor)
{
_localConfig.highSecurity.enabled = highSecurity;
_localConfig.customInstrumentationEditor.enabled = customInstrumentationEditor;
return _defaultConfig.CustomInstrumentationEditorEnabled;
}
[TestCase(true, true, ExpectedResult = true)]
[TestCase(true, false, ExpectedResult = false)]
[TestCase(false, true, ExpectedResult = false)]
[TestCase(false, false, ExpectedResult = false)]
public bool CustomInstrumentationEditorMostSecureWinsWithSecurityPolicies(bool localEnabled, bool securityPolicyEnabled)
{
SetupNewConfigsWithSecurityPolicy("custom_instrumentation_editor", securityPolicyEnabled);
_localConfig.customInstrumentationEditor.enabled = localEnabled;
return _defaultConfig.CustomInstrumentationEditorEnabled;
}
private void SetupNewConfigsWithSecurityPolicy(string securityPolicyName, bool securityPolicyEnabled)
{
var securityPolicies = new Dictionary<string, SecurityPolicyState> { { securityPolicyName, new SecurityPolicyState(securityPolicyEnabled, false) } };
_securityPoliciesConfiguration = new SecurityPoliciesConfiguration(securityPolicies);
_defaultConfig = new TestableDefaultConfiguration(_environment, _localConfig, _serverConfig, _runTimeConfig, _securityPoliciesConfiguration, _processStatic, _httpRuntimeStatic, _configurationManagerStatic, _dnsStatic);
}
[TestCase(true, true, ExpectedResult = true)]
[TestCase(true, false, ExpectedResult = true)]
[TestCase(false, false, ExpectedResult = false)]
[TestCase(false, true, ExpectedResult = true)]
public bool StripExceptionMessagesHighSecurityOverrides(bool highSecurity, bool stripErrorMessages)
{
_localConfig.highSecurity.enabled = highSecurity;
_localConfig.stripExceptionMessages.enabled = stripErrorMessages;
return _defaultConfig.StripExceptionMessages;
}
[TestCase(true, true, ExpectedResult = true)]
[TestCase(true, false, ExpectedResult = true)]
[TestCase(false, true, ExpectedResult = false)]
[TestCase(false, false, ExpectedResult = true)]
public bool StripExceptionMessagesMostSecureWinsWithSecurityPolicies(bool localEnabled, bool securityPolicyEnabled)
{
SetupNewConfigsWithSecurityPolicy("allow_raw_exception_messages", securityPolicyEnabled);
_localConfig.stripExceptionMessages.enabled = localEnabled;
return _defaultConfig.StripExceptionMessages;
}
[Test]
public void UseSslOverriddenByLocalHighSecurity()
{
_localConfig.highSecurity.enabled = true;
_localConfig.browserMonitoring.sslForHttp = false;
Assert.IsTrue(_defaultConfig.BrowserMonitoringUseSsl);
}
[TestCase(true, true, ExpectedResult = false)]
[TestCase(true, false, ExpectedResult = false)]
[TestCase(false, true, ExpectedResult = true)]
[TestCase(false, false, ExpectedResult = false)]
public bool CaptureCustomParametersOverriddenByLocalHighSecurity(bool highSecurityEnabled, bool localEnabled)
{
_localConfig.highSecurity.enabled = highSecurityEnabled;
_localConfig.customParameters.enabled = localEnabled;
return _defaultConfig.CaptureCustomParameters;
}
[TestCase(true, true, ExpectedResult = true)]
[TestCase(true, false, ExpectedResult = false)]
[TestCase(false, true, ExpectedResult = false)]
[TestCase(false, false, ExpectedResult = false)]
public bool CaptureCustomParametersMostSecureWinsWithSecurityPolicies(bool localEnabled, bool securityPolicyEnabled)
{
SetupNewConfigsWithSecurityPolicy("custom_parameters", securityPolicyEnabled);
_localConfig.customParameters.enabled = localEnabled;
return _defaultConfig.CaptureCustomParameters;
}
[TestCase("apdex_f", null, 5, ExpectedResult = 20000)]
[TestCase("1", null, 5, ExpectedResult = 1)]
#if NETFRAMEWORK
[TestCase("1.5", null, 5, ExpectedResult = 2)]
#else
[TestCase("1.5", null, 5, ExpectedResult = 1.5)]
#endif
[TestCase("apdex_f", 3, 5, ExpectedResult = 3000)]
[TestCase("apdex_f", 3.5, 5, ExpectedResult = 3500)]
[TestCase("apdex_f", "4", 5, ExpectedResult = 4000)]
[TestCase("apdex_f", "4.5", 5, ExpectedResult = 4500)]
[TestCase("apdex_f", "apdex_f", 5, ExpectedResult = 20000)]
[TestCase("apdex_f", "foo", 5, ExpectedResult = 20000)]
[TestCase(null, null, 5, ExpectedResult = 20000)]
[TestCase(null, 2, 5, ExpectedResult = 2000)]
public double TransactionTraceThresholdSetFromServerOverridesLocal(string local, object server, double apdexT)
{
_serverConfig.ApdexT = apdexT;
_serverConfig.RpmConfig.TransactionTracerThreshold = server;
_localConfig.transactionTracer.transactionThreshold = local;
return _defaultConfig.TransactionTraceThreshold.TotalMilliseconds;
}
[Test]
public void WhenTransactionTraceThresholdSetToApdexfThenEqualsApdextTimes4()
{
_serverConfig.ApdexT = 42;
_localConfig.transactionTracer.transactionThreshold = "apdex_f";
Assert.AreEqual(42 * 4, _defaultConfig.TransactionTraceThreshold.TotalSeconds);
}
[Test]
public void CaptureCustomParametersSetFromLocalDefaultsToTrue()
{
Assert.IsTrue(_defaultConfig.CaptureCustomParameters);
}
[TestCase(false, false, false, ExpectedResult = true)]
[TestCase(false, true, false, ExpectedResult = false)]
[TestCase(false, true, true, ExpectedResult = true)]
[TestCase(true, false, true, ExpectedResult = false)]
[TestCase(true, true, true, ExpectedResult = false)]
public bool CaptureCustomParametersHsmAndLocal(bool highSecurity, bool customParametersSpecified, bool customParametersEnabled)
{
_localConfig.highSecurity.enabled = highSecurity;
if (customParametersSpecified)
{
_localConfig.customParameters.enabledSpecified = customParametersSpecified;
_localConfig.customParameters.enabled = customParametersEnabled;
}
return _defaultConfig.CaptureCustomParameters;
}
[Test]
public void CaptureIdentityParametersSetFromLocalDefaultsToFalse()
{
Assert.IsTrue(_defaultConfig.CaptureAttributesDefaultExcludes.Contains("identity.*"));
}
[Test]
public void CaptureResponseHeaderParametersSetFromLocalDefaultsToTrue()
{
Assert.IsFalse(_defaultConfig.CaptureAttributesExcludes.Contains("response.headers.*"));
}
[TestCase(new[] { "local" }, new[] { "server" }, ExpectedResult = "server")]
[TestCase(new[] { "local" }, null, ExpectedResult = "local")]
public string ExceptionsToIgnoreSetFromLocalAndServerOverrides(string[] local, string[] server)
{
_serverConfig.RpmConfig.ErrorCollectorIgnoreClasses = server;
_localConfig.errorCollector.ignoreClasses.errorClass = new List<string>(local);
CreateDefaultConfiguration();
return _defaultConfig.IgnoreErrorsConfiguration.Keys.FirstOrDefault();
}
[Test]
public void Decodes_IgnoreAndExpectedClasses_IgnoreAndExpectedMessages_ExpectedStatusCodes_Configurations_Successfully()
{
const string xmlString = @"<?xml version=""1.0""?>
<configuration xmlns=""urn:newrelic-config"" agentEnabled=""true"">
<service licenseKey=""REPLACE_WITH_LICENSE_KEY"" ssl=""true"" />
<errorCollector enabled=""true"" captureEvents=""true"" maxEventSamplesStored=""100"">
<ignoreClasses>
<errorClass>ErrorClass1</errorClass>
<errorClass>ErrorClass2</errorClass>
</ignoreClasses>
<ignoreMessages>
<errorClass name=""ErrorClass2"">
<message>error message 1 in ErrorClass2</message>
</errorClass>
<errorClass name=""ErrorClass3"">
<message>error message 1 in ErrorClass3</message>
<message>error message 2 in ErrorClass3</message>
</errorClass>
</ignoreMessages>
<ignoreStatusCodes>
<code>404</code>
<code>500</code>
</ignoreStatusCodes>
<expectedClasses>
<errorClass>ErrorClass1</errorClass>
<errorClass>ErrorClass2</errorClass>
</expectedClasses>
<expectedStatusCodes>404,500</expectedStatusCodes>
<expectedMessages>
<errorClass name=""ErrorClass2"">
<message>error message 1 in ErrorClass2</message>
</errorClass>
<errorClass name=""ErrorClass3"">
<message>error message 1 in ErrorClass3</message>
<message>error message 2 in ErrorClass3</message>
</errorClass>
</expectedMessages>
</errorCollector >
</configuration>";
var root = new XmlRootAttribute { ElementName = "configuration", Namespace = "urn:newrelic-config" };
var serializer = new XmlSerializer(typeof(configuration), root);
configuration localConfiguration;
using (var reader = new StringReader(xmlString))
{
localConfiguration = serializer.Deserialize(reader) as configuration;
}
_defaultConfig = new TestableDefaultConfiguration(_environment, localConfiguration, _serverConfig, _runTimeConfig, _securityPoliciesConfiguration, _processStatic, _httpRuntimeStatic, _configurationManagerStatic, _dnsStatic);
CollectionAssert.AreEquivalent(_defaultConfig.ExpectedErrorStatusCodesForAgentSettings, new[] { "404", "500" });
var expectedMessages = _defaultConfig.ExpectedErrorsConfiguration;
Assert.That(expectedMessages.ContainsKey("ErrorClass1"));
var expectedErrorClass2 = expectedMessages.Where(x => x.Key == "ErrorClass2").FirstOrDefault();
Assert.NotNull(expectedErrorClass2);
Assert.IsFalse(expectedErrorClass2.Value.Any());
var expectedErrorClass3 = expectedMessages.Where(x => x.Key == "ErrorClass3").FirstOrDefault();
Assert.NotNull(expectedErrorClass3);
Assert.That(expectedErrorClass3.Value.Contains("error message 1 in ErrorClass3"));
Assert.That(expectedErrorClass3.Value.Contains("error message 2 in ErrorClass3"));
var ignoreMessages = _defaultConfig.IgnoreErrorsConfiguration;
Assert.That(ignoreMessages.ContainsKey("ErrorClass1"));
var ignoreErrorClass2 = ignoreMessages.Where(x => x.Key == "ErrorClass2").FirstOrDefault();
Assert.NotNull(ignoreErrorClass2);
Assert.IsFalse(ignoreErrorClass2.Value.Any());
var ignoreErrorClass3 = ignoreMessages.Where(x => x.Key == "ErrorClass3").FirstOrDefault();
Assert.NotNull(ignoreErrorClass3);
Assert.That(ignoreErrorClass3.Value.Contains("error message 1 in ErrorClass3"));
Assert.That(ignoreErrorClass3.Value.Contains("error message 2 in ErrorClass3"));
Assert.That(_defaultConfig.IgnoreErrorsConfiguration.ContainsKey("404"));
Assert.That(_defaultConfig.IgnoreErrorsConfiguration.ContainsKey("500"));
}
[TestCase(new[] { "local" }, new[] { "server" }, ExpectedResult = "server,server")]
[TestCase(new[] { "local" }, null, ExpectedResult = "local,local")]
public string IgnoreAndExpectedClassesSetFromLocalAndServerOverrides(string[] local, string[] server)
{
_serverConfig.RpmConfig.ErrorCollectorExpectedClasses = server;
_localConfig.errorCollector.expectedClasses.errorClass = new List<string>(local);
_serverConfig.RpmConfig.ErrorCollectorIgnoreClasses = server;
_localConfig.errorCollector.ignoreClasses.errorClass = new List<string>(local);
CreateDefaultConfiguration();
return _defaultConfig.ExpectedErrorsConfiguration.FirstOrDefault().Key + "," + _defaultConfig.IgnoreErrorsConfiguration.FirstOrDefault().Key;
}
[TestCase(new[] { "Class1", "Class2" }, new[] { "Class1" }, ExpectedResult = "Class1,Class2")]
[TestCase(new[] { "Class1" }, new[] { "Class2" }, ExpectedResult = "Class1")]
public string IgnoreErrorsAndIgnoreClassesCombineTests(string[] ignoreClasses, string[] ignoreErrors)
{