forked from github/copilot-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTelemetryTests.cs
More file actions
65 lines (54 loc) · 1.85 KB
/
Copy pathTelemetryTests.cs
File metadata and controls
65 lines (54 loc) · 1.85 KB
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
57
58
59
60
61
62
63
64
65
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/
using System.Diagnostics;
using Xunit;
namespace GitHub.Copilot.SDK.Test;
public class TelemetryTests
{
[Fact]
public void TelemetryConfig_DefaultValues_AreNull()
{
var config = new TelemetryConfig();
Assert.Null(config.OtlpEndpoint);
Assert.Null(config.FilePath);
Assert.Null(config.ExporterType);
Assert.Null(config.SourceName);
Assert.Null(config.CaptureContent);
}
[Fact]
public void TelemetryConfig_CanSetAllProperties()
{
var config = new TelemetryConfig
{
OtlpEndpoint = "http://localhost:4318",
FilePath = "/tmp/traces.json",
ExporterType = "otlp-http",
SourceName = "my-app",
CaptureContent = true
};
Assert.Equal("http://localhost:4318", config.OtlpEndpoint);
Assert.Equal("/tmp/traces.json", config.FilePath);
Assert.Equal("otlp-http", config.ExporterType);
Assert.Equal("my-app", config.SourceName);
Assert.True(config.CaptureContent);
}
[Fact]
public void CopilotClientOptions_Telemetry_DefaultsToNull()
{
var options = new CopilotClientOptions();
Assert.Null(options.Telemetry);
}
[Fact]
public void CopilotClientOptions_Clone_CopiesTelemetry()
{
var telemetry = new TelemetryConfig
{
OtlpEndpoint = "http://localhost:4318",
ExporterType = "otlp-http"
};
var options = new CopilotClientOptions { Telemetry = telemetry };
var clone = options.Clone();
Assert.Same(telemetry, clone.Telemetry);
}
}