-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSqlClientSystemDataTests.cs
56 lines (45 loc) · 1.45 KB
/
SqlClientSystemDataTests.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
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
#if NETFRAMEWORK
using IntegrationTests.Helpers;
using OpenTelemetry.AutoInstrumentation.Configurations;
using Xunit.Abstractions;
namespace IntegrationTests;
public class SqlClientSystemDataTests : TestHelper
{
public SqlClientSystemDataTests(ITestOutputHelper output)
: base("SqlClient.System.NetFramework", output)
{
}
[Fact]
[Trait("Category", "EndToEnd")]
public void SubmitTraces()
{
using var collector = new MockSpansCollector(Output);
SetExporter(collector);
collector.Expect("OpenTelemetry.Instrumentation.SqlClient");
RunTestApplication();
collector.AssertExpectations();
}
[Fact]
[Trait("Category", "EndToEnd")]
public void SubmitMetrics()
{
using var collector = new MockMetricsCollector(Output);
SetExporter(collector);
collector.Expect("OpenTelemetry.Instrumentation.SqlClient");
SetEnvironmentVariable("LONG_RUNNING", "true");
SetEnvironmentVariable("OTEL_METRIC_EXPORT_INTERVAL", "100");
SetEnvironmentVariable(ConfigurationKeys.Traces.TracesEnabled, bool.FalseString); // make sure that traces instrumentation is not needed
using var process = StartTestApplication();
try
{
collector.AssertExpectations();
}
finally
{
process?.Kill();
}
}
}
#endif