Fix - Not applied patch if path contains Uppercase (#330)

* Add JsonPatchTests

* Upgrade JsonPatch and Json.net, if netstandard2.0 or netcoreapp2.1
This commit is contained in:
idubnori
2019-12-06 10:42:49 +09:00
committed by Kubernetes Prow Robot
parent 8a615c275a
commit f67aaec566
2 changed files with 23 additions and 2 deletions

View File

@@ -27,13 +27,15 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="1.1.2" Condition="'$(TargetFramework)' != 'netstandard2.0' and '$(TargetFramework)' != 'netcoreapp2.1'" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="3.0.0" Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netcoreapp2.1'" />
<PackageReference Include="Nerdbank.GitVersioning" Version="2.3.138" PrivateAssets="all" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.1.3" />
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="1.1.2" />
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.10" />
<PackageReference Include="MSBuild.Sdk.Extras" Version="1.6.68" PrivateAssets="all" Condition="'$(MSBuildRuntimeType)' != 'Core'" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" Condition="'$(TargetFramework)' != 'netstandard2.0' and '$(TargetFramework)' != 'netcoreapp2.1'" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netcoreapp2.1'" />
<PackageReference Include="YamlDotNet" Version="6.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" />
</ItemGroup>

View File

@@ -0,0 +1,19 @@
using System.Linq;
using k8s.Models;
using Microsoft.AspNetCore.JsonPatch;
using Xunit;
namespace k8s.Tests
{
public class JsonPatchTests
{
[Fact]
public void PathContainsUpperCase()
{
var patch = new JsonPatchDocument<V1HorizontalPodAutoscaler>();
patch.Replace(h => h.Spec.MinReplicas, 1);
Assert.Equal("/spec/minReplicas", patch.Operations.Single().path);
}
}
}