Пример #1
0
        public void DoesNotHaveChangesWhenSameIntegrationGeneratedSpan()
        {
            var collector = new IntegrationTelemetryCollector();

            collector.RecordTracerSettings(new ImmutableTracerSettings(new TracerSettings()));

            collector.GetData();
            collector.HasChanges().Should().BeFalse();

            collector.IntegrationGeneratedSpan(IntegrationId);
            collector.HasChanges().Should().BeTrue();
            collector.GetData();

            collector.IntegrationGeneratedSpan(IntegrationId);
            collector.HasChanges().Should().BeFalse();
        }
Пример #2
0
        public void DoesNotHaveChangesWhenSameIntegrationDisabled()
        {
            var collector = new IntegrationTelemetryCollector();

            collector.RecordTracerSettings(new ImmutableTracerSettings(new TracerSettings()));

            collector.GetData();
            collector.HasChanges().Should().BeFalse();

            collector.IntegrationDisabledDueToError(IntegrationId, "Testing");
            collector.HasChanges().Should().BeTrue();
            collector.GetData();

            collector.IntegrationDisabledDueToError(IntegrationId, "Another error");
            collector.HasChanges().Should().BeFalse();
        }
Пример #3
0
        public void HasChangesWhenNewIntegrationRunning()
        {
            var collector = new IntegrationTelemetryCollector();

            collector.RecordTracerSettings(new ImmutableTracerSettings(new TracerSettings()));

            collector.GetData();
            collector.HasChanges().Should().BeFalse();

            collector.IntegrationRunning(IntegrationId);
            collector.HasChanges().Should().BeTrue();
        }
Пример #4
0
        public void WhenIntegrationRunsButDoesNotGenerateSpanHasExpectedValues()
        {
            var collector = new IntegrationTelemetryCollector();

            collector.RecordTracerSettings(new ImmutableTracerSettings(new TracerSettings()));

            collector.IntegrationRunning(IntegrationId);

            var data        = collector.GetData();
            var integration = data.FirstOrDefault(x => x.Name == IntegrationName);

            integration.Should().NotBeNull();
            integration.AutoEnabled.Should().BeTrue();
            integration.Enabled.Should().BeFalse();
            integration.Error.Should().BeNull();
        }
Пример #5
0
        public void WhenIntegrationErrorsHasExpectedValues()
        {
            const string error     = "Some error";
            var          collector = new IntegrationTelemetryCollector();

            collector.RecordTracerSettings(new ImmutableTracerSettings(new TracerSettings()));

            collector.IntegrationRunning(IntegrationId);
            collector.IntegrationDisabledDueToError(IntegrationId, error);

            var data        = collector.GetData();
            var integration = data.FirstOrDefault(x => x.Name == IntegrationName);

            integration.Should().NotBeNull();
            integration.AutoEnabled.Should().BeTrue();
            integration.Enabled.Should().BeFalse();
            integration.Error.Should().Be(error);
        }