deprecate net452 + generate model based on v1.20.0 (#536)

* remove most net452 related code

* first net4 remove

* migrate test proj to net5 base

* fix format

* update sta xunit to fix platform not support

* Squashed commit of the following:

commit 16e1f819058ad281e1571b356c10d4d6ce77cf38
Author: Boshi Lian <farmer1992@gmail.com>
Date:   Tue Dec 8 22:42:57 2020 -0800

    temp disable some version converter

commit 7d1a651f4e7d27d1e61c91f46f73ac8d04ea8ab9
Author: Boshi Lian <farmer1992@gmail.com>
Date:   Tue Dec 8 20:55:44 2020 -0800

    add missing watcher generator files

commit 3f3199aad269bf89406ea71d0bc63f1a7ec23245
Author: Boshi Lian <farmer1992@gmail.com>
Date:   Tue Dec 8 22:14:47 2020 +0000

    gen v1.20.0

* bump version to 4.0

* support empty spec

* fix version converter for generator

* add generated header

* fix warning

* rerun generator
This commit is contained in:
Boshi Lian
2020-12-13 19:55:27 -08:00
committed by GitHub
parent a614d9584e
commit c0e96f516b
97 changed files with 31331 additions and 8212 deletions

View File

@@ -2,7 +2,6 @@
<PropertyGroup>
<IsPackable>false</IsPackable>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\src\KubernetesClient\kubernetes-client.snk</AssemblyOriginatorKeyFile>
<RootNamespace>k8s.E2E</RootNamespace>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

View File

@@ -165,7 +165,7 @@ namespace k8s.Tests
}
}
#if NETCOREAPP2_1 // The functionality under test, here, is dependent on managed HTTP / WebSocket in .NET Core 2.1 or newer.
#if NETSTANDARD2_1 // The functionality under test, here, is dependent on managed HTTP / WebSocket in .NET Core 2.1 or newer.
// this test doesn't work on OSX and is inconsistent on windows
[OperatingSystemDependentFact(Exclude = OperatingSystems.OSX | OperatingSystems.Windows)]
public void Cert()
@@ -338,7 +338,7 @@ namespace k8s.Tests
}
}
}
#endif // NETCOREAPP2_1
#endif // NETSTANDARD2_1
[Fact]
public void ExternalToken()

View File

@@ -1,20 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<IsPackable>false</IsPackable>
<LangVersion>8</LangVersion>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\src\KubernetesClient\kubernetes-client.snk</AssemblyOriginatorKeyFile>
<RootNamespace>k8s.Tests</RootNamespace>
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>net5</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.9">
<!-- this is due to aspnet core 2.1 is not compatible with our code -->
<AllowExplicitVersion>true</AllowExplicitVersion>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
<PackageReference Include="System.Reactive" Version="4.3.2" />
<PackageReference Include="Nito.AsyncEx" Version="5.1.0" />
@@ -33,7 +27,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Xunit.StaFact" Version="0.3.18" />
<PackageReference Include="Xunit.StaFact" Version="1.0.37" />
<PackageReference Include="Moq" Version="4.13.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />

View File

@@ -1,4 +1,4 @@
#if !NETCOREAPP2_1
#if !NETSTANDARD2_1
/*
* These tests are only for the netstandard version of the client (there are separate tests for netcoreapp that connect to a local test-hosted server).
*/
@@ -48,17 +48,18 @@ namespace k8s.Tests
tty: true,
customHeaders: new Dictionary<string, List<string>>()
{
{"X-My-Header", new List<string>() {"myHeaderValue", "myHeaderValue2" } },
{ "X-My-Header", new List<string>() { "myHeaderValue", "myHeaderValue2" } },
},
cancellationToken: CancellationToken.None).ConfigureAwait(false);
var expectedHeaders = new Dictionary<string, string>()
{
{"X-My-Header", "myHeaderValue myHeaderValue2" },
{"Authorization", "Basic bXktdXNlcjpteS1zZWNyZXQtcGFzc3dvcmQ=" },
{ "X-My-Header", "myHeaderValue myHeaderValue2" },
{ "Authorization", "Basic bXktdXNlcjpteS1zZWNyZXQtcGFzc3dvcmQ=" },
};
Assert.Equal(mockWebSocketBuilder.PublicWebSocket,
Assert.Equal(
mockWebSocketBuilder.PublicWebSocket,
webSocket); // Did the method return the correct web socket?
Assert.Equal(
new Uri(
@@ -89,17 +90,18 @@ namespace k8s.Tests
ports: new int[] { 80, 8080 },
customHeaders: new Dictionary<string, List<string>>()
{
{"X-My-Header", new List<string>() {"myHeaderValue", "myHeaderValue2" } },
{ "X-My-Header", new List<string>() { "myHeaderValue", "myHeaderValue2" } },
},
cancellationToken: CancellationToken.None).ConfigureAwait(false);
var expectedHeaders = new Dictionary<string, string>()
{
{"X-My-Header", "myHeaderValue myHeaderValue2" },
{"Authorization", "Basic bXktdXNlcjpteS1zZWNyZXQtcGFzc3dvcmQ=" },
{ "X-My-Header", "myHeaderValue myHeaderValue2" },
{ "Authorization", "Basic bXktdXNlcjpteS1zZWNyZXQtcGFzc3dvcmQ=" },
};
Assert.Equal(mockWebSocketBuilder.PublicWebSocket,
Assert.Equal(
mockWebSocketBuilder.PublicWebSocket,
webSocket); // Did the method return the correct web socket?
Assert.Equal(
new Uri("ws://localhost/api/v1/namespaces/mynamespace/pods/mypod/portforward?ports=80&ports=8080"),
@@ -133,17 +135,18 @@ namespace k8s.Tests
tty: true,
customHeaders: new Dictionary<string, List<string>>()
{
{"X-My-Header", new List<string>() {"myHeaderValue", "myHeaderValue2" } },
{ "X-My-Header", new List<string>() { "myHeaderValue", "myHeaderValue2" } },
},
cancellationToken: CancellationToken.None).ConfigureAwait(false);
var expectedHeaders = new Dictionary<string, string>()
{
{"X-My-Header", "myHeaderValue myHeaderValue2" },
{"Authorization", "Basic bXktdXNlcjpteS1zZWNyZXQtcGFzc3dvcmQ=" },
{ "X-My-Header", "myHeaderValue myHeaderValue2" },
{ "Authorization", "Basic bXktdXNlcjpteS1zZWNyZXQtcGFzc3dvcmQ=" },
};
Assert.Equal(mockWebSocketBuilder.PublicWebSocket,
Assert.Equal(
mockWebSocketBuilder.PublicWebSocket,
webSocket); // Did the method return the correct web socket?
Assert.Equal(
new Uri(

View File

@@ -1,4 +1,4 @@
#if !NETCOREAPP2_1
#if !NETSTANDARD2_1
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -43,4 +43,4 @@ namespace k8s.Tests.Mock
}
}
#endif // !NETCOREAPP2_1
#endif // !NETSTANDARD2_1

View File

@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;
using Microsoft.AspNetCore.Mvc;
namespace k8s.Tests.Mock.Server
{
@@ -35,7 +36,7 @@ namespace k8s.Tests.Mock.Server
{
logging.ClearProviders(); // Logger provider will be added by the calling test.
});
services.AddMvc();
services.AddMvc(opt => opt.EnableEndpointRouting = false);
}
/// <summary>
@@ -49,7 +50,6 @@ namespace k8s.Tests.Mock.Server
app.UseWebSockets(new WebSocketOptions
{
KeepAliveInterval = TimeSpan.FromSeconds(5),
ReceiveBufferSize = 2048,
});
app.UseMvc();
}

View File

@@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="16.7.1" />
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="16.8.0" />
</ItemGroup>
</Project>