Skip to content

Commit

Permalink
add test for OT
Browse files Browse the repository at this point in the history
  • Loading branch information
qdraw committed Oct 18, 2024
1 parent 2e55a01 commit a94d909
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
6 changes: 3 additions & 3 deletions starsky/starsky.foundation.platform/Helpers/ArgsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -416,18 +416,18 @@ public void NeedHelpShowDialog()
// OpenTelemetry
if ( !string.IsNullOrEmpty(_appSettings.OpenTelemetry?.LogsEndpoint) )
{
_console.WriteLine($"LogsEndpoint {_appSettings.OpenTelemetry.LogsEndpoint} ");
_console.WriteLine($"OpenTelemetry LogsEndpoint: {_appSettings.OpenTelemetry.LogsEndpoint} ");
}

if ( !string.IsNullOrEmpty(_appSettings.OpenTelemetry?.MetricsEndpoint) )
{
_console.WriteLine(
$"MetricsEndpoint {_appSettings.OpenTelemetry.MetricsEndpoint} ");
$"OpenTelemetry MetricsEndpoint: {_appSettings.OpenTelemetry.MetricsEndpoint} ");
}

if ( !string.IsNullOrEmpty(_appSettings.OpenTelemetry?.TracesEndpoint) )
{
_console.WriteLine($"TracesEndpoint {_appSettings.OpenTelemetry.TracesEndpoint} ");
_console.WriteLine($"OpenTelemetry TracesEndpoint: {_appSettings.OpenTelemetry.TracesEndpoint} ");
}

_console.Write("SyncIgnore ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,31 @@ public void NeedHelpShowDialog_WebHtml_Verbose()

Assert.IsTrue(contains);
}

[TestMethod]
public void ArgsHelper_NeedHelpShowDialog_OpenTelemetry()
{
var console = new FakeConsoleWrapper();
var appSettings = new AppSettings
{
ApplicationType = AppSettings.StarskyAppType.Sync,
OpenTelemetry = new OpenTelemetrySettings
{
LogsEndpoint = "http://localhost:4317",
TracesEndpoint = "http://localhost:4318",
MetricsEndpoint = "http://localhost:4319"
},
Verbose = true
};
new ArgsHelper(appSettings, console).NeedHelpShowDialog();

Assert.IsTrue(console.WrittenLines.Exists(p => p.Contains($"OpenTelemetry LogsEndpoint: " +
$"{appSettings.OpenTelemetry.LogsEndpoint}")));
Assert.IsTrue(console.WrittenLines.Exists(p => p.Contains($"OpenTelemetry TracesEndpoint: " +
$"{appSettings.OpenTelemetry.TracesEndpoint}")));
Assert.IsTrue(console.WrittenLines.Exists(p => p.Contains($"OpenTelemetry MetricsEndpoint: " +
$"{appSettings.OpenTelemetry.MetricsEndpoint}")));
}

[TestMethod]
[ExpectedException(typeof(FieldAccessException))]
Expand Down

0 comments on commit a94d909

Please sign in to comment.