-
Notifications
You must be signed in to change notification settings - Fork 11
Fix test server build race condition (#134) #135
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
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f6b30d9
Added test case for race condition when building test server #134
Fgruntjes b0464c1
Bug fix: Race condition when building using multiple build servers (#…
Fgruntjes 2852753
Moved graphql-aspnet-testframework-tests to unit-tests solution folder
Fgruntjes 96da0ea
Fixed linting errors in graphql-aspnet-testframework-tests/TestServer…
Fgruntjes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
40 changes: 40 additions & 0 deletions
40
src/unit-tests/graphql-aspnet-testframework-tests/GlobalSuppressions.cs
This file contains hidden or 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,40 @@ | ||
// ************************************************************* | ||
// project: graphql-aspnet | ||
// -- | ||
// repo: https://github.com/graphql-aspnet | ||
// docs: https://graphql-aspnet.github.io | ||
// -- | ||
// License: MIT | ||
// ************************************************************* | ||
|
||
using System.Diagnostics.CodeAnalysis; | ||
|
||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage( | ||
"StyleCop.CSharp.DocumentationRules", | ||
"SA1600:Elements should be documented", | ||
Justification = "Documenting test methods is unwarranted at this time.", | ||
Scope = "module")] | ||
|
||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage( | ||
"StyleCop.CSharp.NamingRules", | ||
"SA1313:Parameter names should begin with lower-case letter", | ||
Justification = "Testing of Alternative Naming schemas is required for unit tests", | ||
Scope = "module")] | ||
|
||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage( | ||
"StyleCop.CSharp.NamingRules", | ||
"SA1300:Element should begin with upper-case letter", | ||
Justification = "Testing of Alternative Naming schemas is required for unit tests", | ||
Scope = "module")] | ||
|
||
[assembly: SuppressMessage( | ||
"Design", | ||
"CA1065:Do not raise exceptions in unexpected locations", | ||
Justification = "Test Project exceptions are for testing only", | ||
Scope = "module")] | ||
|
||
[assembly: SuppressMessage( | ||
"Design", | ||
"CA1063:Implement IDisposable Correctly", | ||
Justification = "Proper IDisposable not necessary for unit test project", | ||
Scope = "module")] |
56 changes: 56 additions & 0 deletions
56
src/unit-tests/graphql-aspnet-testframework-tests/TestServerBuilderTests.cs
This file contains hidden or 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 @@ | ||
// ************************************************************* | ||
// project: graphql-aspnet | ||
// -- | ||
// repo: https://github.com/graphql-aspnet | ||
// docs: https://graphql-aspnet.github.io | ||
// -- | ||
// License: MIT | ||
// ************************************************************* | ||
|
||
namespace GraphQL.AspNet.TestFramework.Tests | ||
{ | ||
using System.Threading.Tasks; | ||
using GraphQL.AspNet.Attributes; | ||
using GraphQL.AspNet.Controllers; | ||
using GraphQL.AspNet.Schemas; | ||
using GraphQL.AspNet.Tests.Framework; | ||
using NUnit.Framework; | ||
|
||
[TestFixture] | ||
public class TestServerBuilderTests | ||
{ | ||
[Test] | ||
public void ParallelBuildSameControllerTest() | ||
{ | ||
Task.WaitAll( | ||
Task.Run(BuildServer<AppController>), | ||
Task.Run(BuildServer<AppController>), | ||
Task.Run(BuildServer<AppController>), | ||
Task.Run(BuildServer<AppController>), | ||
Task.Run(BuildServer<AppController>)); | ||
} | ||
|
||
[GraphRoute("with-param")] | ||
public class AppController : GraphController | ||
{ | ||
[Query("get")] | ||
public string Get(string id) | ||
{ | ||
return id; | ||
} | ||
} | ||
|
||
private void BuildServer<T>() | ||
where T : GraphController | ||
{ | ||
var builder = new TestServerBuilder<GraphSchema>(); | ||
|
||
builder.AddGraphQL(options => | ||
{ | ||
options.AddController<T>(); | ||
}); | ||
|
||
builder.Build(); | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/unit-tests/graphql-aspnet-testframework-tests/graphql-aspnet-testframework-tests.csproj
This file contains hidden or 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,37 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net7.0;net6.0;</TargetFrameworks> | ||
<LangVersion>latest</LangVersion> | ||
<NoWarn>$(NoWarn);1701;1702;1705;1591;NU1603;RCS1021;IDE0060;IDE0052;IDE0044;IDE0059;IDE0052;IDE0017;IDE0039;RCS1090;RCS1118;SA1601;RCS1163</NoWarn> | ||
<RootNamespace>GraphQL.AspNet.TestFramework.Tests</RootNamespace> | ||
<AssemblyName>graphql-aspnet-testframework-tests</AssemblyName> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<IsTestProject>true</IsTestProject> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<CodeAnalysisRuleSet>..\..\styles.ruleset</CodeAnalysisRuleSet> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<AdditionalFiles Include="..\..\stylecop.json" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> | ||
<PackageReference Include="nunit" Version="3.13.3" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\graphql-aspnet\graphql-aspnet.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\graphql-aspnet-testframework\graphql-aspnet-testframework.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.