public MsSqlQueryParameterCaptureTestsBase(RemoteServiceFixtures.IMsSqlClientFixture fixture, ITestOutputHelper output, string expectedTransactionName, bool paramsWithAtSigns)
        {
            _fixture                 = fixture;
            _fixture.TestLogger      = output;
            _expectedTransactionName = expectedTransactionName;
            _paramsWithAtSigns       = paramsWithAtSigns;


            _fixture.Actions
            (
                setupConfiguration: () =>
            {
                var configPath     = fixture.DestinationNewRelicConfigFilePath;
                var configModifier = new NewRelicConfigModifier(configPath);

                configModifier.ForceTransactionTraces();
                configModifier.SetLogLevel("finest");           //This has to stay at finest to ensure parameter check security


                CommonUtils.ModifyOrCreateXmlAttributeInNewRelicConfig(configPath, new[] { "configuration", "transactionTracer" }, "explainEnabled", "true");
                CommonUtils.ModifyOrCreateXmlAttributeInNewRelicConfig(configPath, new[] { "configuration", "transactionTracer" }, "explainThreshold", "1");
                CommonUtils.ModifyOrCreateXmlAttributeInNewRelicConfig(configPath, new[] { "configuration", "transactionTracer" }, "recordSql", "raw");
                CommonUtils.ModifyOrCreateXmlAttributeInNewRelicConfig(configPath, new[] { "configuration", "datastoreTracer", "queryParameters" }, "enabled", "true");

                var instrumentationFilePath = $@"{fixture.DestinationNewRelicExtensionsDirectoryPath}\NewRelic.Providers.Wrapper.Sql.Instrumentation.xml";
                CommonUtils.SetAttributeOnTracerFactoryInNewRelicInstrumentation(instrumentationFilePath, "", "enabled", "true");
            },
                exerciseApplication: () =>
            {
                _fixture.GetMsSql_WithParameterizedQuery(_paramsWithAtSigns);
            }
            );
            _fixture.Initialize();
        }
示例#2
0
 public HighSecurityModeEnabled(RemoteServiceFixtures.HSMBasicMvcApplicationTestFixture fixture, ITestOutputHelper output)
 {
     _fixture            = fixture;
     _fixture.TestLogger = output;
     _fixture.Actions
     (
         setupConfiguration: () =>
     {
         var configPath     = fixture.DestinationNewRelicConfigFilePath;
         var configModifier = new NewRelicConfigModifier(configPath);
         configModifier.ForceTransactionTraces();
         configModifier.SetLogLevel("debug");
         configModifier.SetHighSecurityMode(true);
         configModifier.SetEnableRequestParameters(true);
         configModifier.SetTransactionTracerRecordSql("raw");
         configModifier.SetCustomHostName("custom-host-name");
     },
         exerciseApplication: () =>
     {
         _fixture.GetWithData(QueryStringParameterValue);
         _fixture.ThrowException();
     }
     );
     _fixture.Initialize();
 }
示例#3
0
        public HighSecurityModeDisabled(RemoteServiceFixtures.BasicMvcApplicationTestFixture fixture, ITestOutputHelper output)
        {
            _fixture            = fixture;
            _fixture.TestLogger = output;
            _fixture.Actions
            (
                setupConfiguration: () =>
            {
                var configPath     = fixture.DestinationNewRelicConfigFilePath;
                var configModifier = new NewRelicConfigModifier(configPath);
                configModifier.ForceTransactionTraces();

                configModifier.ForceTransactionTraces();
                configModifier.SetLogLevel("debug");
                configModifier.SetHighSecurityMode(false);
                configModifier.SetEnableRequestParameters(true);
                configModifier.SetTransactionTracerRecordSql("raw");
                configModifier.SetCustomHostName("custom-host-name");

                //CommonUtils.ModifyOrCreateXmlAttributeInNewRelicConfig(configPath, new[] { "configuration", "log" }, "level", "debug");
                //CommonUtils.ModifyOrCreateXmlAttributeInNewRelicConfig(configPath, new[] { "configuration", "requestParameters" }, "enabled", "true");
                //CommonUtils.ModifyOrCreateXmlAttributeInNewRelicConfig(configPath, new[] { "configuration", "transactionTracer" }, "recordSql", "raw");
                //CommonUtils.ModifyOrCreateXmlAttributeInNewRelicConfig(configPath, new[] { "configuration", "highSecurity" }, "enabled", "false");
                //CommonUtils.ModifyOrCreateXmlAttributeInNewRelicConfig(configPath, new[] { "configuration", "service" }, "licenseKey", Configuration.License);
            },
                exerciseApplication: () =>
            {
                _fixture.GetWithData(QueryStringParameterValue);
                _fixture.ThrowException();
            }
            );
            _fixture.Initialize();
        }
示例#4
0
        public HighSecurityModeServerDisabled(RemoteServiceFixtures.OwinWebApiFixture fixture, ITestOutputHelper output)
        {
            _fixture            = fixture;
            _fixture.TestLogger = output;
            _fixture.Actions
            (
                setupConfiguration: () =>
            {
                var configPath = fixture.DestinationNewRelicConfigFilePath;

                var configModifier = new NewRelicConfigModifier(configPath);
                configModifier.SetLogLevel("debug");
                configModifier.SetHighSecurityMode(true);
                configModifier.SetEnableRequestParameters(true);
            },
                exerciseApplication: () =>
            {
                _fixture.GetData();
                _fixture.Get();
                _fixture.Get404();
                _fixture.GetId();
                _fixture.Post();
            }
            );
            _fixture.Initialize();
        }
示例#5
0
        public MsSqlStoredProcedureUsingOleDbDriverTestsBase(OleDbBasicMvcFixture fixture, ITestOutputHelper output, bool paramsWithAtSigns) : base(fixture)
        {
            _paramsWithAtSigns = paramsWithAtSigns;

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

                configModifier.ForceTransactionTraces();
                configModifier.SetLogLevel("finest");

                CommonUtils.ModifyOrCreateXmlAttributeInNewRelicConfig(configPath, new[] { "configuration", "transactionTracer" }, "explainEnabled", "true");
                CommonUtils.ModifyOrCreateXmlAttributeInNewRelicConfig(configPath, new[] { "configuration", "transactionTracer" }, "recordSql", "raw");
                CommonUtils.ModifyOrCreateXmlAttributeInNewRelicConfig(configPath, new[] { "configuration", "transactionTracer" }, "explainThreshold", "1");
                CommonUtils.ModifyOrCreateXmlAttributeInNewRelicConfig(configPath, new[] { "configuration", "datastoreTracer", "queryParameters" }, "enabled", "true");
            },
                exerciseApplication: () =>
            {
                _fixture.GetMsSqlParameterizedStoredProcedureUsingOleDbDriver(_paramsWithAtSigns);
                _fixture.AgentLog.WaitForLogLine(AgentLogBase.TransactionTransformCompletedLogLineRegex);
            }
            );
            _fixture.Initialize();
        }
示例#6
0
        public OwinCATChainTests(OwinTracingChainFixture fixture, ITestOutputHelper output) : base(fixture)
        {
            _fixture            = fixture;
            _fixture.TestLogger = output;
            _fixture.Actions
            (
                setupConfiguration: () =>
            {
                var configModifier = new NewRelicConfigModifier(_fixture.DestinationNewRelicConfigFilePath);
                configModifier.SetOrDeleteDistributedTraceEnabled(false);
                configModifier.SetOrDeleteSpanEventsEnabled(false);
                configModifier.SetLogLevel("all");

                _fixture.ReceiverApplication = _fixture.SetupReceiverApplication(isDistributedTracing: false, isWebApplication: false);
                _fixture.ReceiverApplication.Start(string.Empty, captureStandardOutput: true);
            },
                exerciseApplication: () =>
            {
                _fixture.ExecuteTraceRequestChainHttpClient();

                _fixture.ReceiverApplication.AgentLog.WaitForLogLine(AgentLogFile.AnalyticsEventDataLogLineRegex, TimeSpan.FromMinutes(2));
            }
            );

            _fixture.Initialize();
        }
        public ConnectResponseHandlingTests(MvcWithCollectorFixture fixture, ITestOutputHelper output)
        {
            _fixture            = fixture;
            _fixture.TestLogger = output;
            _fixture.AddActions
            (
                setupConfiguration: () =>
            {
                var configModifier = new NewRelicConfigModifier(fixture.DestinationNewRelicConfigFilePath);
                configModifier.EnableSpanEvents(true);
                configModifier.ForceTransactionTraces();
                configModifier.SetLogLevel("finest");
            },
                exerciseApplication: () =>
            {
                _fixture.Get();
                _fixture.AgentLog.WaitForLogLine(AgentLogFile.AgentConnectedLogLineRegex, TimeSpan.FromMinutes(1));
                _fixture.AgentLog.WaitForLogLine(AgentLogFile.HarvestFinishedLogLineRegex, TimeSpan.FromMinutes(1));
                _collectedRequests = _fixture.GetCollectedRequests();
                _requestHeaderMapValidationData = _fixture.GetRequestHeaderMapValidationData();
            }
            );

            _fixture.Initialize();
        }
示例#8
0
        public PostgresStoredProcedureAsyncCoreTests(PostgresBasicMvcCoreFixture fixture, ITestOutputHelper output)
        {
            _fixture            = fixture;
            _fixture.TestLogger = output;
            _fixture.Actions
            (
                setupConfiguration: () =>
            {
                var configPath     = fixture.DestinationNewRelicConfigFilePath;
                var configModifier = new NewRelicConfigModifier(configPath);

                configModifier.ForceTransactionTraces();
                configModifier.SetLogLevel("finest");

                CommonUtils.ModifyOrCreateXmlAttributeInNewRelicConfig(configPath, new[] { "configuration", "transactionTracer" }, "explainEnabled", "true");
                CommonUtils.ModifyOrCreateXmlAttributeInNewRelicConfig(configPath, new[] { "configuration", "transactionTracer" }, "recordSql", "raw");
                CommonUtils.ModifyOrCreateXmlAttributeInNewRelicConfig(configPath, new[] { "configuration", "transactionTracer" }, "explainThreshold", "1");
                CommonUtils.ModifyOrCreateXmlAttributeInNewRelicConfig(configPath, new[] { "configuration", "datastoreTracer", "queryParameters" }, "enabled", "true");
            },
                exerciseApplication: () =>
            {
                _fixture.PostgresParameterizedStoredProcedureAsync(_procedureName);
                _fixture.AgentLog.WaitForLogLine(AgentLogBase.TransactionTransformCompletedLogLineRegex);
            }
            );
            _fixture.Initialize();
        }
        public RabbitMqLegacyReceiveTests(RemoteServiceFixtures.RabbitMqLegacyReceiverFixture fixture, ITestOutputHelper output)
        {
            _fixture                      = fixture;
            _fixture.TestLogger           = output;
            _fixture.CommandLineArguments = $"--queue={_fixture.QueueName}";

            _fixture.Actions
            (
                setupConfiguration: () =>
            {
                var configPath     = _fixture.DestinationNewRelicConfigFilePath;
                var configModifier = new NewRelicConfigModifier(configPath);

                configModifier.SetLogLevel("all");
                configModifier.ForceTransactionTraces();
            },
                exerciseApplication: () =>
            {
                _fixture.CreateQueueAndSendMessage();
                _fixture.AgentLog.WaitForLogLine(AgentLogBase.TransactionTransformCompletedLogLineRegex, TimeSpan.FromSeconds(30));
            }
            );

            _fixture.Initialize();
        }
示例#10
0
        public RejitAddNode(AspNetCoreReJitMvcApplicationFixture fixture, ITestOutputHelper output)
        {
            _fixture = fixture;

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

            _fixture.TestLogger = output;
            _fixture.Actions(
                setupConfiguration: () =>
            {
                var configModifier = new NewRelicConfigModifier(_fixture.DestinationNewRelicConfigFilePath);
                configModifier.SetLogLevel("finest");
                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, "AspNetCoreMvcRejitApplication", "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();
        }
        public RejitAddFile(AspNetCoreReJitMvcApplicationFixture fixture, ITestOutputHelper output)
        {
            _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();
        }
        public RemoteApplication SetupReceiverApplication(bool isDistributedTracing, bool isWebApplication)
        {
            RemoteApplication receiverApplication;

            if (isWebApplication)
            {
                receiverApplication = new RemoteWebApplication("BasicMvcApplication", ApplicationType.Bounded);
            }
            else
            {
                receiverApplication = new RemoteService(_applicationDirectoryName, _executableName, _targetFramework, ApplicationType.Bounded, createsPidFile: true, isCoreApp: false, publishApp: false);
            }
            receiverApplication.TestLogger = new XUnitTestLogger(TestLogger);
            receiverApplication.DeleteWorkingSpace();
            receiverApplication.CopyToRemote();

            SetSecrets(receiverApplication.DestinationNewRelicConfigFilePath);

            var configModifier = new NewRelicConfigModifier(receiverApplication.DestinationNewRelicConfigFilePath);

            configModifier.SetLogLevel("all");

            if (isDistributedTracing)
            {
                configModifier.SetOrDeleteDistributedTraceEnabled(true);
                configModifier.SetOrDeleteSpanEventsEnabled(true);
            }
            else
            {
                configModifier.SetOrDeleteDistributedTraceEnabled(false);
                configModifier.SetOrDeleteSpanEventsEnabled(false);
            }

            return(receiverApplication);
        }
        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();
        }
示例#14
0
 private void UpdateNewRelicConfig()
 {
     foreach (var serviceName in ServiceNames)
     {
         var newRelicConfigPath     = Path.Combine(ApplicationPackagePath, $@"{serviceName}Pkg/Code/newrelic/newrelic.config");
         var newRelicConfigModifier = new NewRelicConfigModifier(newRelicConfigPath);
         newRelicConfigModifier.ForceTransactionTraces();
         newRelicConfigModifier.SetLogLevel("debug");
         newRelicConfigModifier.SetLicenseKey(TestConfiguration.LicenseKey);
         newRelicConfigModifier.SetHost(TestConfiguration.CollectorUrl);
     }
 }
示例#15
0
        public ThreadProfileNetCoreTests(AspNetCoreMvcWithCollectorFixture fixture, ITestOutputHelper output)
            : base(fixture)
        {
            _fixture            = fixture;
            _fixture.TestLogger = output;

            _fixture.AddActions(
                setupConfiguration: () =>
            {
                //Increasing the log level to attempt to diagnose the test runs where the profiling session does not terminate.
                var configModifier = new NewRelicConfigModifier(_fixture.DestinationNewRelicConfigFilePath);
                configModifier.SetLogLevel("finest");
            },
                exerciseApplication: () =>
            {
                var stopWatch = new Stopwatch();
                stopWatch.Start();

                _fixture.TestLogger?.WriteLine("[ThreadProfileNetCoreTests] Making first request to application.");
                _fixture.Get();

                _fixture.TestLogger?.WriteLine("[ThreadProfileNetCoreTests] Requesting a thread profile run at {0} ms.", stopWatch.ElapsedMilliseconds);
                _fixture.TriggerThreadProfile();
                _fixture.AgentLog.WaitForLogLine(AgentLogFile.ThreadProfileStartingLogLineRegex, TimeSpan.FromMinutes(3));
                _fixture.TestLogger?.WriteLine("[ThreadProfileNetCoreTests] Thread profile run detected at {0} ms.", stopWatch.ElapsedMilliseconds);

                var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(1));
                RequestUntilCancelled(cancellationTokenSource);
                _fixture.TestLogger?.WriteLine("[ThreadProfileNetCoreTests] Stopped exercising the app at {0} ms.", stopWatch.ElapsedMilliseconds);

                //We need to wait long enough for the thread profile run to finish
                try
                {
                    var threadProfileMatch = _fixture.AgentLog.WaitForLogLine(AgentLogFile.ThreadProfileDataLogLineRegex, TimeSpan.FromMinutes(3));
                    _threadProfileString   = threadProfileMatch.Value;
                    _fixture.TestLogger?.WriteLine("[ThreadProfileNetCoreTests] Retrieved thread profile at {0} ms.", stopWatch.ElapsedMilliseconds);
                }
                catch (Exception e)
                {
                    _fixture.TestLogger?.WriteLine("Thread profiler session did not end. {0}", e);
                    _fixture.TestLogger?.WriteLine("[ThreadProfileNetCoreTests] Begin Profiler log.");
                    _fixture.TestLogger?.WriteLine(_fixture.ProfilerLog.GetFullLogAsString());
                    _fixture.TestLogger?.WriteLine("[ThreadProfileNetCoreTests] End Profiler log.");
                    throw;
                }

                stopWatch.Stop();
            }
                );
            _fixture.Initialize();
        }
 public HighSecurityModeNoTransactionAgentApiTests(RemoteServiceFixtures.HSMAgentApiExecutor fixture, ITestOutputHelper output)
 {
     _fixture            = fixture;
     _fixture.TestLogger = output;
     _fixture.Actions(
         setupConfiguration: () =>
     {
         var configPath     = _fixture.DestinationNewRelicConfigFilePath;
         var configModifier = new NewRelicConfigModifier(configPath);
         configModifier.SetHighSecurityMode(true);
         configModifier.SetLogLevel("debug");
         configModifier.SetAutoStart(false);
     });
     _fixture.Initialize();
 }
        public ThreadProfileStressTests(ThreadProfileStressTestWithCollectorFixture fixture, ITestOutputHelper output)
        {
            fixture.TestLogger = output;

            fixture.AddActions(
                setupConfiguration: () =>
            {
                var configModifier = new NewRelicConfigModifier(fixture.DestinationNewRelicConfigFilePath);
                configModifier.SetLogLevel("debug");
            },
                exerciseApplication: () =>
            {
                var stopWatch = new Stopwatch();
                stopWatch.Start();

                fixture.TestLogger?.WriteLine("[ThreadProfileStressTests] Requesting a thread profile run at {0} ms.", stopWatch.ElapsedMilliseconds);
                fixture.TriggerThreadProfile();
                fixture.AgentLog.WaitForLogLine(AgentLogBase.ThreadProfileStartingLogLineRegex, TimeSpan.FromMinutes(3));
                fixture.TestLogger?.WriteLine("[ThreadProfileStressTests] Thread profile run detected at {0} ms.", stopWatch.ElapsedMilliseconds);

                //Wait for the thread profile run to begin before triggering the scenario because if we don't the agent has to compete with process
                //for thread pool resources and thread scheduling so the timing of things don't always work out.
                fixture.StartThreadStressScenario();

                //We need to wait long enough for the thread profile run to finish
                try
                {
                    var threadProfileMatch = fixture.AgentLog.WaitForLogLine(AgentLogBase.ThreadProfileDataLogLineRegex, TimeSpan.FromMinutes(3));
                    _threadProfileString   = threadProfileMatch.Value;
                    fixture.TestLogger?.WriteLine("[ThreadProfileStressTests] Retrieved thread profile at {0} ms.", stopWatch.ElapsedMilliseconds);
                }
                catch (Exception e)
                {
                    fixture.TestLogger?.WriteLine("Thread profiler session did not end. {0}", e);
                    fixture.TestLogger?.WriteLine("[ThreadProfileStressTests] Begin Profiler log.");
                    fixture.TestLogger?.WriteLine(fixture.ProfilerLog.GetFullLogAsString());
                    fixture.TestLogger?.WriteLine("[ThreadProfileStressTests] End Profiler log.");
                    throw;
                }

                stopWatch.Stop();
            }
                );
            fixture.Initialize();
        }
        protected RemoteService SetupDistributedTracingApplication()
        {
            var service = new RemoteService(ApplicationDirectoryName, ExecutableName, ApplicationType.Bounded, true, true, true);

            service.TestLogger = new XUnitTestLogger(TestLogger);
            service.DeleteWorkingSpace();
            service.CopyToRemote();

            SetSecrets(service.DestinationNewRelicConfigFilePath);

            var configModifier = new NewRelicConfigModifier(service.DestinationNewRelicConfigFilePath);

            configModifier.SetOrDeleteDistributedTraceEnabled(true);
            configModifier.SetOrDeleteSpanEventsEnabled(true);
            configModifier.SetLogLevel("all");

            return(service);
        }
示例#19
0
        public FasterEventHarvestTests(TFixture fixture, ITestOutputHelper output)
        {
            Fixture            = fixture;
            Fixture.TestLogger = output;

            Fixture.AddCommand($"FasterEventHarvest Test");

            Fixture.Actions
            (
                setupConfiguration: () =>
            {
                var configModifier = new NewRelicConfigModifier(Fixture.DestinationNewRelicConfigFilePath);
                configModifier.SetLogLevel("finest");
            }
            );

            Fixture.Initialize();
        }
        public W3CTestBase(T fixture, ITestOutputHelper output)
        {
            _fixture            = fixture;
            _fixture.TestLogger = output;

            _fixture.Actions
            (
                setupConfiguration: () =>
            {
                var configModifier = new NewRelicConfigModifier(_fixture.DestinationNewRelicConfigFilePath);
                configModifier.SetOrDeleteDistributedTraceEnabled(true);
                configModifier.SetOrDeleteSpanEventsEnabled(true);
                configModifier.SetLogLevel("debug");

                _fixture.ReceiverApplication = _fixture.SetupReceiverApplication(isDistributedTracing: true, isWebApplication: _fixture is OwinTracingChainFixture ? false : true);
                _fixture.ReceiverApplication.Start(string.Empty, captureStandardOutput: true);
            });
        }
        public AspNetCoreDistTraceRequestChainFixture()
            : base(new RemoteService(ApplicationDirectoryName, ExecutableName, ApplicationType.Bounded, true, true, true))
        {
            Actions(setupConfiguration: () =>
            {
                var configModifier = new NewRelicConfigModifier(DestinationNewRelicConfigFilePath);
                configModifier.SetOrDeleteDistributedTraceEnabled(true);
                configModifier.SetOrDeleteSpanEventsEnabled(true);
                configModifier.SetLogLevel("all");

                //Do during setup so TestLogger is set.
                FirstCallApplication  = SetupDistributedTracingApplication();
                SecondCallApplication = SetupDistributedTracingApplication();

                FirstCallApplication.Start(string.Empty, captureStandardOutput: true);
                SecondCallApplication.Start(string.Empty, captureStandardOutput: true);
            });
        }
示例#22
0
 public AspNetCoreLocalHSMDisabledAndServerSideHSMEnabledTests(RemoteServiceFixtures.HSMAspNetCoreMvcBasicRequestsFixture fixture, ITestOutputHelper output) : base(fixture)
 {
     _fixture            = fixture;
     _fixture.TestLogger = output;
     _fixture.Actions
     (
         setupConfiguration: () =>
     {
         var configPath     = fixture.DestinationNewRelicConfigFilePath;
         var configModifier = new NewRelicConfigModifier(configPath);
         configModifier.ForceTransactionTraces();
         configModifier.SetLogLevel("debug");
         configModifier.SetEnableRequestParameters(true);
         configModifier.SetHighSecurityMode(false);
     },
         exerciseApplication: () => _fixture.GetWithData(QueryStringParameterValue)
     );
     _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();
        }
示例#24
0
        public OtherTransactionResponseTimeTestsConsole(RemoteServiceFixtures.ConsoleOtherTransactionWrapperFixture fixture, ITestOutputHelper output)
        {
            _fixture            = fixture;
            _fixture.TestLogger = output;

            _fixture.Actions
            (
                setupConfiguration: () =>
            {
                var configModifier = new NewRelicConfigModifier(_fixture.DestinationNewRelicConfigFilePath);
                configModifier.SetLogLevel("Finest");
                configModifier.ForceTransactionTraces();
            },
                exerciseApplication: () =>
            {
            }
            );

            _fixture.Initialize();
        }
示例#25
0
        public OtherTransactionResponseTimeTestsWebApi(RemoteServiceFixtures.WebApiAsyncFixture fixture, ITestOutputHelper output)
        {
            _fixture            = fixture;
            _fixture.TestLogger = output;

            _fixture.Actions
            (
                setupConfiguration: () =>
            {
                var configModifier = new NewRelicConfigModifier(_fixture.DestinationNewRelicConfigFilePath);
                configModifier.SetLogLevel("Finest");
                configModifier.ForceTransactionTraces();
            },
                exerciseApplication: () =>
            {
                _fixture.ExecuteResponseTimeTestOperation(_delayDuration);
            }
            );

            _fixture.Initialize();
        }
示例#26
0
        public AspNetCoreMvcCoreFrameworkTests(AspNetCoreMvcCoreFrameworkFixture fixture, ITestOutputHelper output)
        {
            _fixture            = fixture;
            _fixture.TestLogger = output;

            _fixture.Actions
            (
                setupConfiguration: () =>
            {
                var configPath     = fixture.DestinationNewRelicConfigFilePath;
                var configModifier = new NewRelicConfigModifier(configPath);
                configModifier.SetLogLevel("FINEST");
            },
                exerciseApplication: () =>
            {
                _fixture.Get();
                _fixture.Get();
            }
            );
            _fixture.Initialize();
        }
        public InstrumentationLoaderTestsCore(RemoteServiceFixtures.ConsoleInstrumentationLoaderFixtureCore fixture, ITestOutputHelper output) : base(fixture)
        {
            _fixture            = fixture;
            _fixture.TestLogger = output;

            _fixture.Actions
            (
                setupConfiguration: () =>
            {
                var configPath     = fixture.DestinationNewRelicConfigFilePath;
                var configModifier = new NewRelicConfigModifier(configPath);

                configModifier.ForceTransactionTraces();
                configModifier.SetLogLevel("finest");
            },
                exerciseApplication: () =>
            {
            }
            );

            _fixture.Initialize();
        }
        public ApiCallsTests(TFixture fixture, ITestOutputHelper output) : base(fixture)
        {
            Fixture            = fixture;
            Fixture.TestLogger = output;

            foreach (var apiCall in ApiCalls)
            {
                Fixture.AddCommand($"ApiCalls {apiCall}");
            }

            Fixture.Actions
            (
                setupConfiguration: () =>
            {
                var configModifier = new NewRelicConfigModifier(Fixture.DestinationNewRelicConfigFilePath);
                configModifier.SetOrDeleteDistributedTraceEnabled(true);
                configModifier.SetLogLevel("finest");
            }
            );

            Fixture.Initialize();
        }
 public AspNetCoreCollectibleAssemblyContextTests(RemoteServiceFixtures.AspNetCore3FeaturesFixture fixture, ITestOutputHelper output)
 {
     _fixture            = fixture;
     _fixture.TestLogger = output;
     _fixture.Actions
     (
         setupConfiguration: () =>
     {
         var configPath     = fixture.DestinationNewRelicConfigFilePath;
         var configModifier = new NewRelicConfigModifier(configPath);
         configModifier.ForceTransactionTraces();
         configModifier.SetLogLevel("finest");
     },
         exerciseApplication: () =>
     {
         _fixture.AccessCollectible();
         _fixture.AccessCollectible();
         _fixture.TestLogger?.WriteLine(_fixture.ProfilerLog.GetFullLogAsString());
     }
     );
     _fixture.Initialize();
 }
示例#30
0
        public CallStackFallbackMvc(RemoteServiceFixtures.BasicMvcApplicationTestFixture fixture, ITestOutputHelper output)
        {
            _fixture            = fixture;
            _fixture.TestLogger = output;
            _fixture.Actions
            (
                setupConfiguration: () =>
            {
                var configPath     = fixture.DestinationNewRelicConfigFilePath;
                var configModifier = new NewRelicConfigModifier(configPath);
                configModifier.ForceTransactionTraces();
                configModifier.SetLogLevel("Finest");

                _fixture.DisableAsyncLocalCallStack();
            },
                exerciseApplication: () =>
            {
                _fixture.Get();
            }
            );
            _fixture.Initialize();
        }