@@ -25,10 +25,12 @@ public abstract class RejitAddFileBase<TFixture> : NewRelicIntegrationTest<TFixt
25
25
where TFixture : AspNetCoreReJitMvcApplicationFixture
26
26
{
27
27
private readonly AspNetCoreReJitMvcApplicationFixture _fixture ;
28
+ private readonly bool _disableFileSystemWatcher ;
28
29
29
- protected RejitAddFileBase ( TFixture fixture , ITestOutputHelper output ) : base ( fixture )
30
+ protected RejitAddFileBase ( TFixture fixture , ITestOutputHelper output , bool disableFileSystemWatcher ) : base ( fixture )
30
31
{
31
32
_fixture = fixture ;
33
+ _disableFileSystemWatcher = disableFileSystemWatcher ;
32
34
33
35
_fixture . TestLogger = output ;
34
36
_fixture . Actions (
@@ -37,6 +39,7 @@ protected RejitAddFileBase(TFixture fixture, ITestOutputHelper output) : base(fi
37
39
var configModifier = new NewRelicConfigModifier ( _fixture . DestinationNewRelicConfigFilePath ) ;
38
40
configModifier . SetLogLevel ( "finest" ) ;
39
41
configModifier . AutoInstrumentBrowserMonitoring ( false ) ;
42
+ configModifier . SetDisableFileSystemWatcher ( disableFileSystemWatcher ) ;
40
43
} ,
41
44
exerciseApplication : ( ) =>
42
45
{
@@ -61,20 +64,29 @@ public void Test()
61
64
{
62
65
//transactions
63
66
new Assertions . ExpectedMetric { metricName = @"WebTransaction/MVC/Home/Index" , callCount = 1 } ,
64
- new Assertions . ExpectedMetric { metricName = @"WebTransaction/Custom/MyCustomAddMetricName" , callCount = 1 } ,
65
67
new Assertions . ExpectedMetric { metricName = @"WebTransaction/MVC/Rejit/GetAddFile" , callCount = 1 } ,
66
68
67
69
// Unscoped
68
70
new Assertions . ExpectedMetric { metricName = @"DotNet/HomeController/Index" , callCount = 1 } ,
69
- new Assertions . ExpectedMetric { metricName = @"Custom/MyCustomAddMetricName" , callCount = 1 } ,
70
- new Assertions . ExpectedMetric { metricName = @"DotNet/RejitController/GetAddFile" , callCount = 2 } ,
71
71
72
72
// Scoped
73
73
new Assertions . ExpectedMetric { metricName = @"DotNet/HomeController/Index" , metricScope = "WebTransaction/MVC/Home/Index" , callCount = 1 } ,
74
- new Assertions . ExpectedMetric { metricName = @"Custom/MyCustomAddMetricName" , metricScope = "WebTransaction/Custom/MyCustomAddMetricName" , callCount = 1 } ,
75
74
new Assertions . ExpectedMetric { metricName = @"DotNet/RejitController/GetAddFile" , metricScope = "WebTransaction/MVC/Rejit/GetAddFile" , callCount = 1 }
76
75
} ;
77
76
77
+ // Id file system watcher is disabled, these won't exist.
78
+ if ( _disableFileSystemWatcher )
79
+ {
80
+ expectedMetrics . Add ( new Assertions . ExpectedMetric { metricName = @"DotNet/RejitController/GetAddFile" , callCount = 1 } ) ;
81
+ }
82
+ else
83
+ {
84
+ expectedMetrics . Add ( new Assertions . ExpectedMetric { metricName = @"WebTransaction/Custom/MyCustomAddMetricName" , callCount = 1 } ) ;
85
+ expectedMetrics . Add ( new Assertions . ExpectedMetric { metricName = @"Custom/MyCustomAddMetricName" , callCount = 1 } ) ;
86
+ expectedMetrics . Add ( new Assertions . ExpectedMetric { metricName = @"Custom/MyCustomAddMetricName" , metricScope = "WebTransaction/Custom/MyCustomAddMetricName" , callCount = 1 } ) ;
87
+ expectedMetrics . Add ( new Assertions . ExpectedMetric { metricName = @"DotNet/RejitController/GetAddFile" , callCount = 2 } ) ;
88
+ }
89
+
78
90
var metrics = CommonUtils . GetMetrics ( _fixture . AgentLog ) ;
79
91
_fixture . TestLogger ? . WriteLine ( _fixture . AgentLog . GetFullLogAsString ( ) ) ;
80
92
@@ -84,18 +96,26 @@ public void Test()
84
96
}
85
97
}
86
98
87
- public class RejitAddFile : RejitAddFileBase < AspNetCoreReJitMvcApplicationFixture >
99
+ public class RejitAddFileWithFileWatcherEnabled : RejitAddFileBase < AspNetCoreReJitMvcApplicationFixture >
100
+ {
101
+ public RejitAddFileWithFileWatcherEnabled ( AspNetCoreReJitMvcApplicationFixture fixture , ITestOutputHelper output )
102
+ : base ( fixture , output , false )
103
+ {
104
+ }
105
+ }
106
+
107
+ public class RejitAddFileWithFileWatcherDisabled : RejitAddFileBase < AspNetCoreReJitMvcApplicationFixture >
88
108
{
89
- public RejitAddFile ( AspNetCoreReJitMvcApplicationFixture fixture , ITestOutputHelper output )
90
- : base ( fixture , output )
109
+ public RejitAddFileWithFileWatcherDisabled ( AspNetCoreReJitMvcApplicationFixture fixture , ITestOutputHelper output )
110
+ : base ( fixture , output , true )
91
111
{
92
112
}
93
113
}
94
114
95
115
public class RejitAddFileWithTieredCompilation : RejitAddFileBase < AspNetCoreReJitMvcApplicationFixtureWithTieredCompilation >
96
116
{
97
117
public RejitAddFileWithTieredCompilation ( AspNetCoreReJitMvcApplicationFixtureWithTieredCompilation fixture , ITestOutputHelper output )
98
- : base ( fixture , output )
118
+ : base ( fixture , output , false )
99
119
{
100
120
}
101
121
}
0 commit comments