Ejemplo n.º 1
0
        public RejitDeleteFile(AspNetFrameworkReJitMvcApplicationFixture fixture, ITestOutputHelper output)
        {
            _fixture = fixture;

            var deleteFileFilePath = _fixture.RemoteApplication.DestinationExtensionsDirectoryPath + @"\Integration.Testing.DeleteXmlFileTest.xml";

            _fixture.TestLogger = output;
            _fixture.Actions(
                setupConfiguration: () =>
            {
                var configModifier = new NewRelicConfigModifier(_fixture.DestinationNewRelicConfigFilePath);
                configModifier.AutoInstrumentBrowserMonitoring(false);

                CommonUtils.AddCustomInstrumentation(deleteFileFilePath, "RejitMvcApplication", "RejitMvcApplication.Controllers.RejitController", "CustomMethodDefaultWrapperDeleteFile", "NewRelic.Agent.Core.Wrapper.DefaultWrapper", "MyCustomDeleteMetricName", 7);
            },
                exerciseApplication: () =>
            {
                _fixture.InitializeApp();

                _fixture.TestDeleteFile();
                CommonUtils.DeleteFile(deleteFileFilePath, TimeSpan.FromSeconds(5));
                _fixture.AgentLog.WaitForLogLine(AgentLogBase.InstrumentationRefreshFileWatcherComplete, TimeSpan.FromMinutes(1));
                _fixture.TestDeleteFile();
            });

            _fixture.Initialize();
        }
        protected RejitChangeAttributeValueBase(TFixture fixture, ITestOutputHelper output) : base(fixture)
        {
            _fixture = fixture;

            var changeAttributeFilePath = _fixture.RemoteApplication.DestinationExtensionsDirectoryPath + @"\Integration.Testing.ChangeAttributeTest.xml";

            _fixture.TestLogger = output;
            _fixture.Actions(
                setupConfiguration: () =>
            {
                var configModifier = new NewRelicConfigModifier(_fixture.DestinationNewRelicConfigFilePath);
                configModifier.SetLogLevel("finest");
                configModifier.AutoInstrumentBrowserMonitoring(false);

                CommonUtils.AddCustomInstrumentation(changeAttributeFilePath, "AspNetCoreMvcRejitApplication", "RejitMvcApplication.Controllers.RejitController", "CustomMethodDefaultWrapperChangeAttributeValue", "NewRelic.Agent.Core.Wrapper.DefaultWrapper", "MyCustomChangeMetricName", 7);
            },
                exerciseApplication: () =>
            {
                _fixture.InitializeApp();

                _fixture.TestChangeAttributeValue();
                CommonUtils.ModifyOrCreateXmlAttribute(changeAttributeFilePath, "urn:newrelic-extension", new[] { "extension", "instrumentation", "tracerFactory" }, "metricName", "MyCustomRenamedMetricName");
                _fixture.AgentLog.WaitForLogLine(AgentLogBase.InstrumentationRefreshFileWatcherComplete, TimeSpan.FromMinutes(1));
                _fixture.TestChangeAttributeValue();
            });

            _fixture.Initialize();
        }
Ejemplo n.º 3
0
        public RejitAddNode(AspNetFrameworkReJitMvcApplicationFixture fixture, ITestOutputHelper output)
            : base(fixture)
        {
            _fixture = fixture;

            var addNodeFilePath = _fixture.RemoteApplication.DestinationExtensionsDirectoryPath + @"\Integration.Testing.AddNodeTest.xml";

            _fixture.TestLogger = output;
            _fixture.Actions(
                setupConfiguration: () =>
            {
                var configModifier = new NewRelicConfigModifier(_fixture.DestinationNewRelicConfigFilePath);
                configModifier.AutoInstrumentBrowserMonitoring(false);

                CommonUtils.CreateEmptyInstrumentationFile(addNodeFilePath);
            },
                exerciseApplication: () =>
            {
                _fixture.InitializeApp();

                _fixture.TestAddNode(1);     // this will cause this method require a full rejit (differnet profiler code)
                var document = CommonUtils.AddCustomInstrumentation(addNodeFilePath, "RejitMvcApplication", "RejitMvcApplication.Controllers.RejitController", "CustomMethodDefaultWrapperAddNode", "NewRelic.Agent.Core.Wrapper.DefaultWrapper", "MyCustomAddMetricName", 7, false);
                CommonUtils.AddXmlNode(addNodeFilePath, "urn:newrelic-extension", new[] { "extension", "instrumentation", "tracerFactory", "match" }, "exactMethodMatcher", string.Empty, "methodName", "CustomMethodDefaultWrapperAddNode1", false, document);
                // Potential future addition: Adding a test for new match element.  not adding now since it would require a second app to test really well.
                document.Save(addNodeFilePath);
                _fixture.AgentLog.WaitForLogLine(AgentLogBase.InstrumentationRefreshFileWatcherComplete, TimeSpan.FromMinutes(1));
                _fixture.TestAddNode(0);
                _fixture.TestAddNode(1);
            });

            _fixture.Initialize();
        }
Ejemplo n.º 4
0
        protected RejitAddFileBase(TFixture fixture, ITestOutputHelper output) : base(fixture)
        {
            _fixture = fixture;

            _fixture.TestLogger = output;
            _fixture.Actions(
                setupConfiguration: () =>
            {
                var configModifier = new NewRelicConfigModifier(_fixture.DestinationNewRelicConfigFilePath);
                configModifier.SetLogLevel("finest");
                configModifier.AutoInstrumentBrowserMonitoring(false);
            },
                exerciseApplication: () =>
            {
                _fixture.InitializeApp();

                _fixture.TestAddFile();
                var createFilePath = _fixture.RemoteApplication.DestinationNewRelicHomeDirectoryPath + @"\Integration.Testing.AddXmlFileTest.xml";
                CommonUtils.AddCustomInstrumentation(createFilePath, "AspNetCoreMvcRejitApplication", "RejitMvcApplication.Controllers.RejitController", "CustomMethodDefaultWrapperAddFile", "NewRelic.Agent.Core.Wrapper.DefaultWrapper", "MyCustomAddMetricName", 7);
                var destinationFilePath = _fixture.RemoteApplication.DestinationExtensionsDirectoryPath + @"\Integration.Testing.AddXmlFileTest.xml";
                CommonUtils.MoveFile(createFilePath, destinationFilePath, TimeSpan.FromSeconds(5));
                _fixture.AgentLog.WaitForLogLine(AgentLogBase.InstrumentationRefreshFileWatcherComplete, TimeSpan.FromMinutes(1));
                _fixture.TestAddFile();
            });

            _fixture.Initialize();
        }
        protected RejitDeleteNodeBase(TFixture fixture, ITestOutputHelper output) : base(fixture)
        {
            _fixture = fixture;

            var deleteNodeFilePath = _fixture.RemoteApplication.DestinationExtensionsDirectoryPath + @"\Integration.Testing.DeleteNodeTest.xml";

            _fixture.TestLogger = output;
            _fixture.Actions(
                setupConfiguration: () =>
            {
                var configModifier = new NewRelicConfigModifier(_fixture.DestinationNewRelicConfigFilePath);
                configModifier.SetLogLevel("finest");
                configModifier.AutoInstrumentBrowserMonitoring(false);

                var document = CommonUtils.AddCustomInstrumentation(deleteNodeFilePath, "AspNetCoreMvcRejitApplication", "RejitMvcApplication.Controllers.RejitController", "CustomMethodDefaultWrapperDeleteNode", "NewRelic.Agent.Core.Wrapper.DefaultWrapper", "MyCustomDeleteMetricName", 7, false);
                CommonUtils.AddXmlNode(deleteNodeFilePath, "urn:newrelic-extension", new[] { "extension", "instrumentation", "tracerFactory", "match" }, "exactMethodMatcher", string.Empty, "methodName", "CustomMethodDefaultWrapperDeleteNode1", true, document);
            },
                exerciseApplication: () =>
            {
                _fixture.InitializeApp();

                _fixture.TestDeleteNode(0);
                _fixture.TestDeleteNode(1);
                CommonUtils.DeleteXmlNode(deleteNodeFilePath, "urn:newrelic-extension",
                                          new[] { "extension", "instrumentation", "tracerFactory", "match" }, "exactMethodMatcher"); // deletes first one (CustomMethodDefaultWrapperDeleteNode)
                _fixture.AgentLog.WaitForLogLine(AgentLogBase.InstrumentationRefreshFileWatcherComplete, TimeSpan.FromMinutes(1));
                _fixture.TestDeleteNode(0);
                _fixture.TestDeleteNode(1);


                // Uncommenting the following lines lead to odd metric counts. Manual testing of this scenario does not seem
                // to indicate a problem. For now, just chalking it up to timing issue with how our tests are run...

                //CommonUtils.DeleteXmlNode(_deleteNodeFilePath, "urn:newrelic-extension",
                //	new[] { "extension", "instrumentation" }, "tracerFactory");
                //_fixture.AgentLog.WaitForLogLine(AgentLogBase.InstrumentationRefreshFileWatcherComplete, TimeSpan.FromMinutes(1));
                //_fixture.TestDeleteNode(0);
                //_fixture.TestDeleteNode(1);
            });

            _fixture.Initialize();
        }
Ejemplo n.º 6
0
        public GetBrowserTimingHeader(RemoteServiceFixtures.BasicMvcApplicationTestFixture fixture, ITestOutputHelper output)
        {
            _fixture            = fixture;
            _fixture.TestLogger = output;
            _fixture.Actions
            (
                setupConfiguration: () =>
            {
                var configPath = fixture.DestinationNewRelicConfigFilePath;

                var configModifier = new NewRelicConfigModifier(configPath);
                configModifier.AutoInstrumentBrowserMonitoring(false);
                configModifier.BrowserMonitoringEnableAttributes(true);
            },
                exerciseApplication: () =>
            {
                _browserTimingHeader = _fixture.GetBrowserTimingHeader();
            }
            );
            _fixture.Initialize();
        }