Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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 4 commits into from
Nov 21, 2023
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
7 changes: 7 additions & 0 deletions 7 src/graphql-aspnet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "starwars-api70", "ancillary
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "graphql-aspnet-tests-common", "unit-tests\graphql-aspnet-tests-common\graphql-aspnet-tests-common.csproj", "{3CB086E3-5E7B-438B-9A95-AEA264009521}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "graphql-aspnet-testframework-tests", "unit-tests\graphql-aspnet-testframework-tests\graphql-aspnet-testframework-tests.csproj", "{E67D4FB2-73FF-4EC1-80F8-5D4DEC57F5AA}"
Fgruntjes marked this conversation as resolved.
Show resolved Hide resolved
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -79,6 +81,10 @@ Global
{3CB086E3-5E7B-438B-9A95-AEA264009521}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3CB086E3-5E7B-438B-9A95-AEA264009521}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3CB086E3-5E7B-438B-9A95-AEA264009521}.Release|Any CPU.Build.0 = Release|Any CPU
{E67D4FB2-73FF-4EC1-80F8-5D4DEC57F5AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E67D4FB2-73FF-4EC1-80F8-5D4DEC57F5AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E67D4FB2-73FF-4EC1-80F8-5D4DEC57F5AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E67D4FB2-73FF-4EC1-80F8-5D4DEC57F5AA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -92,6 +98,7 @@ Global
{6E4A16F5-1B98-412E-9A88-F56301F5D0E4} = {350D3594-5D97-4D9B-A01D-D3A5C036318C}
{B92A5C91-F88D-4F26-8775-20C72692BD43} = {22C7BC5B-EC8E-4A07-9968-961E86AB44E2}
{3CB086E3-5E7B-438B-9A95-AEA264009521} = {350D3594-5D97-4D9B-A01D-D3A5C036318C}
{E67D4FB2-73FF-4EC1-80F8-5D4DEC57F5AA} = {350D3594-5D97-4D9B-A01D-D3A5C036318C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DD2C38B8-B029-4DE1-877E-B1A661AC412F}
Expand Down
8 changes: 4 additions & 4 deletions 8 src/graphql-aspnet/Schemas/Structural/SchemaItemPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ private void EnsurePathInitialized()
if (_pathInitialized)
return;

_pathInitialized = true;
var workingPath = SchemaItemPath.NormalizeFragment(this.Raw);

// split the path into its fragments
Expand Down Expand Up @@ -137,7 +136,7 @@ private void EnsurePathInitialized()
}

// ensure each fragment matches the naming specification
foreach (var fragment in pathFragments.Skip(this.RootCollection == SchemaItemCollections.Unknown ? 0 : 1))
foreach (var fragment in pathFragments.Skip(_rootCollection == SchemaItemCollections.Unknown ? 0 : 1))
{
if (!this.ValidateFragment(fragment))
return;
Expand All @@ -147,9 +146,10 @@ private void EnsurePathInitialized()
if (pathFragments.Count > 1)
_parentField = new SchemaItemPath(string.Join(RouteConstants.PATH_SEPERATOR, pathFragments.Take(pathFragments.Count - 1)));

_isTopLevelField = pathFragments.Count == 1 || (pathFragments.Count == 2 && this.RootCollection > SchemaItemCollections.Unknown); // e.g. "[query]/name"
_isValid = this.Name.Length > 0;
_isTopLevelField = pathFragments.Count == 1 || (pathFragments.Count == 2 && _rootCollection > SchemaItemCollections.Unknown); // e.g. "[query]/name"
_isValid = _name.Length > 0;
_path = this.GeneratePathString(pathFragments);
_pathInitialized = true;
}
}

Expand Down
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")]
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();
}
}
}
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>
Morty Proxy This is a proxified and sanitized view of the page, visit original site.