Skip to content

Add smoke test of distribution channel #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/continuous-monitoring.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Continuous monitoring of distribution channels

on:
workflow_dispatch:
schedule:
- cron: '0 */1 * * *'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need canary every hour?


jobs:
smoke-tests:
name: Run smoke tests
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [windows-latest,ubuntu-latest]
version: [net452,netcoreapp2.0]
exclude:
- os: ubuntu-latest
version: net452

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install dependencies
run: dotnet restore sdk/test/SmokeTests/AWSXRayRecorder.SmokeTests.csproj

- name: Build tests
run: dotnet build sdk/test/SmokeTests/AWSXRayRecorder.SmokeTests.csproj --configuration Release --no-restore

- name: Run tests
run: dotnet test sdk/test/SmokeTests/bin/Release/${{matrix.version}}/AWSXRayRecorder.SmokeTests.dll
11 changes: 10 additions & 1 deletion sdk/AWSXRayRecorder.sln
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AWSXRayRecorder.UnitTests",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AWSXRayRecorder.Handlers.AspNet", "src\Handlers\AspNet\AWSXRayRecorder.Handlers.AspNet.csproj", "{C647F311-4023-4E0B-9147-074EAF243D54}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AWSXRayRecorder.Handlers.EntityFramework", "src\Handlers\EntityFramework\AWSXRayRecorder.Handlers.EntityFramework.csproj", "{B5C2F674-6539-4A04-9B7D-14E300962BFE}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AWSXRayRecorder.Handlers.EntityFramework", "src\Handlers\EntityFramework\AWSXRayRecorder.Handlers.EntityFramework.csproj", "{B5C2F674-6539-4A04-9B7D-14E300962BFE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AWSXRayRecorder.SmokeTests", "test\SmokeTests\AWSXRayRecorder.SmokeTests.csproj", "{157BF1A6-324B-4F56-B5A5-619F22F5F314}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -88,6 +90,12 @@ Global
{B5C2F674-6539-4A04-9B7D-14E300962BFE}.Nuget|Any CPU.Build.0 = Release|Any CPU
{B5C2F674-6539-4A04-9B7D-14E300962BFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B5C2F674-6539-4A04-9B7D-14E300962BFE}.Release|Any CPU.Build.0 = Release|Any CPU
{157BF1A6-324B-4F56-B5A5-619F22F5F314}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{157BF1A6-324B-4F56-B5A5-619F22F5F314}.Debug|Any CPU.Build.0 = Debug|Any CPU
{157BF1A6-324B-4F56-B5A5-619F22F5F314}.Nuget|Any CPU.ActiveCfg = Debug|Any CPU
{157BF1A6-324B-4F56-B5A5-619F22F5F314}.Nuget|Any CPU.Build.0 = Debug|Any CPU
{157BF1A6-324B-4F56-B5A5-619F22F5F314}.Release|Any CPU.ActiveCfg = Release|Any CPU
{157BF1A6-324B-4F56-B5A5-619F22F5F314}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -102,6 +110,7 @@ Global
{B7D60B1F-C452-454E-AD4B-202A40E628E8} = {F0ED74B6-1639-47D3-9511-B4217012AC88}
{C647F311-4023-4E0B-9147-074EAF243D54} = {6FD9C919-1504-445D-B70D-D0F8AC2829C4}
{B5C2F674-6539-4A04-9B7D-14E300962BFE} = {6FD9C919-1504-445D-B70D-D0F8AC2829C4}
{157BF1A6-324B-4F56-B5A5-619F22F5F314} = {F0ED74B6-1639-47D3-9511-B4217012AC88}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E3276CD5-62B3-466D-BFDD-2AFDB8819B46}
Expand Down
25 changes: 25 additions & 0 deletions sdk/test/SmokeTests/AWSXRayRecorder.SmokeTests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net452;netcoreapp2.0</TargetFrameworks>
<Company>Amazon.com, Inc</Company>
<Product>Amazon Web Service X-Ray Recorder</Product>
<Copyright>Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.</Copyright>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<RootNamespace>Amazon.XRay.Recorder.SmokeTests</RootNamespace>
<DelaySign>true</DelaySign>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net452'">
<DefineConstants>NET45</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AWSXRayRecorder.Core" Version="*" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageReference Include="Moq" Version="4.7.137" />
<PackageReference Include="MSTest.TestAdapter" Version="1.1.18" />
<PackageReference Include="MSTest.TestFramework" Version="1.1.18" />
</ItemGroup>
</Project>
32 changes: 32 additions & 0 deletions sdk/test/SmokeTests/SmokeTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Amazon.XRay.Recorder.Core.Internal.Emitters;
using Amazon.XRay.Recorder.Core.Internal.Entities;
using Amazon.XRay.Recorder.Core.Internal.Utils;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;

namespace Amazon.XRay.Recorder.SmokeTests
{
[TestClass]
public class SmokeTest
{
private Mock<ISegmentEmitter> mockEmitter;

[TestInitialize]
public void Initialize()
{
mockEmitter = new Mock<ISegmentEmitter>();
}

[TestMethod]
public void Emits()
{
using (var client = AWSXRayRecorderFactory.CreateAWSXRayRecorder(mockEmitter.Object))
{
client.BeginSegment("test");
client.EndSegment();

mockEmitter.Verify(x => x.Send(It.IsAny<Segment>()), Times.Once);
}
}
}
}