-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support MongoDB integration by nuget
- Loading branch information
Showing
12 changed files
with
155 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,7 +164,7 @@ jobs: | |
run: ./build.cmd BuildNuGetPackages | ||
|
||
- name: Test NuGet Packages | ||
run: ./build.cmd TestNuGetPackages | ||
run: ./build.cmd TestNuGetPackages --containers windows | ||
|
||
- name: Upload Nuget Artifacts | ||
uses: actions/[email protected] | ||
|
@@ -179,7 +179,9 @@ jobs: | |
matrix: | ||
include: | ||
- machine: ubuntu-20.04 | ||
containers: linux | ||
- machine: macos-11 | ||
containers: none | ||
runs-on: ${{ matrix.machine }} | ||
steps: | ||
- uses: actions/[email protected] | ||
|
@@ -196,4 +198,4 @@ jobs: | |
path: bin/nuget-artifacts/ | ||
|
||
- name: Test NuGet Packages | ||
run: ./build.cmd TestNuGetPackages | ||
run: ./build.cmd TestNuGetPackages --containers ${{ matrix.containers }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// <copyright file="NugetTestHelper.cs" company="OpenTelemetry Authors"> | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// </copyright> | ||
|
||
using System.Diagnostics; | ||
using FluentAssertions; | ||
using IntegrationTests.Helpers; | ||
using Xunit.Abstractions; | ||
|
||
namespace NuGetPackagesTests; | ||
|
||
public abstract class NugetTestHelper : TestHelper | ||
{ | ||
protected NugetTestHelper(string testApplicationName, ITestOutputHelper output, string testApplicationType = "nuget-packages") | ||
: base(testApplicationName, output, testApplicationType) | ||
{ | ||
} | ||
|
||
public override Process? StartTestApplication(TestSettings? testSettings = null) | ||
{ | ||
testSettings ??= new(); | ||
|
||
var instrumentationScriptExtension = EnvironmentTools.IsWindows() ? ".cmd" : ".sh"; | ||
var instrumentationScriptPath = Path.Combine(EnvironmentHelper.GetTestApplicationApplicationOutputDirectory(testSettings.PackageVersion, testSettings.Framework), "instrument") + instrumentationScriptExtension; | ||
|
||
if (!File.Exists(instrumentationScriptPath)) | ||
{ | ||
throw new Exception($"instrumentation script not found: {instrumentationScriptPath}"); | ||
} | ||
|
||
// get path to test application that the profiler will attach to | ||
var testApplicationPath = EnvironmentHelper.GetTestApplicationPath(testSettings.PackageVersion, testSettings.Framework); | ||
if (!File.Exists(testApplicationPath)) | ||
{ | ||
throw new Exception($"application not found: {testApplicationPath}"); | ||
} | ||
|
||
Output.WriteLine($"Starting Application: {instrumentationScriptPath} {testApplicationPath}"); | ||
|
||
var args = $"{(EnvironmentHelper.IsCoreClr() ? EnvironmentHelper.GetTestApplicationExecutionSource() : string.Empty)} {testApplicationPath} {testSettings.Arguments ?? string.Empty}"; | ||
|
||
return InstrumentedProcessHelper.Start(instrumentationScriptPath, args, EnvironmentHelper); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...cations/nuget-packages/TestApplication.MongoDB.Nuget/TestApplication.MongoDB.Nuget.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<SelfContained>true</SelfContained> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="..\..\integrations\TestApplication.MongoDB\*.cs" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<DefineConstants>$(DefineConstants);MONGODB_2_15_OR_GREATER</DefineConstants> | ||
|
||
<!-- Required to build multiple projects with the same Configuration|Platform --> | ||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> | ||
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="OpenTelemetry.AutoInstrumentation" Version="$(NuGetPackageVersion)" /> | ||
<PackageReference Include="MongoDB.Driver" Version="2.19.0" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters