7.1 remove old autorest (#785)
* init removal * clean up warning * bump ver to 7.1 * fix build * custom http client no long supported * cleanup unused types * fix npe * remove service client * modern ssl settings * fix test * fix client cert null * fix ctor * cleanup
This commit is contained in:
@@ -11,7 +11,7 @@ using Json.Patch;
|
||||
using k8s.LeaderElection;
|
||||
using k8s.LeaderElection.ResourceLock;
|
||||
using k8s.Models;
|
||||
using Microsoft.Rest;
|
||||
using k8s.Autorest;
|
||||
using Nito.AsyncEx;
|
||||
using Xunit;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ using k8s.Models;
|
||||
using k8s.Tests.Mock;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Https;
|
||||
using Microsoft.Rest;
|
||||
using k8s.Autorest;
|
||||
using Org.BouncyCastle.Crypto.Parameters;
|
||||
using Org.BouncyCastle.Pkcs;
|
||||
using Org.BouncyCastle.Security;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
using k8s.Tests.Mock;
|
||||
using Microsoft.Rest;
|
||||
using k8s.Autorest;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
@@ -24,13 +24,12 @@ namespace k8s.Tests
|
||||
[Fact]
|
||||
public async Task WebSocketNamespacedPodExecAsync()
|
||||
{
|
||||
var credentials = new BasicAuthenticationCredentials()
|
||||
Kubernetes client = new Kubernetes(new KubernetesClientConfiguration()
|
||||
{
|
||||
UserName = "my-user",
|
||||
Host = "http://localhost",
|
||||
Username = "my-user",
|
||||
Password = "my-secret-password",
|
||||
};
|
||||
|
||||
Kubernetes client = new Kubernetes(credentials);
|
||||
});
|
||||
client.BaseUri = new Uri("http://localhost");
|
||||
|
||||
MockWebSocketBuilder mockWebSocketBuilder = new MockWebSocketBuilder();
|
||||
@@ -71,14 +70,12 @@ namespace k8s.Tests
|
||||
[Fact]
|
||||
public async Task WebSocketNamespacedPodPortForwardAsync()
|
||||
{
|
||||
var credentials = new BasicAuthenticationCredentials()
|
||||
Kubernetes client = new Kubernetes(new KubernetesClientConfiguration()
|
||||
{
|
||||
UserName = "my-user",
|
||||
Host = "http://localhost",
|
||||
Username = "my-user",
|
||||
Password = "my-secret-password",
|
||||
};
|
||||
|
||||
Kubernetes client = new Kubernetes(credentials);
|
||||
client.BaseUri = new Uri("http://localhost");
|
||||
});
|
||||
|
||||
MockWebSocketBuilder mockWebSocketBuilder = new MockWebSocketBuilder();
|
||||
client.CreateWebSocketBuilder = () => mockWebSocketBuilder;
|
||||
@@ -112,13 +109,12 @@ namespace k8s.Tests
|
||||
[Fact]
|
||||
public async Task WebSocketNamespacedPodAttachAsync()
|
||||
{
|
||||
var credentials = new BasicAuthenticationCredentials()
|
||||
Kubernetes client = new Kubernetes(new KubernetesClientConfiguration()
|
||||
{
|
||||
UserName = "my-user",
|
||||
Host = "http://localhost",
|
||||
Username = "my-user",
|
||||
Password = "my-secret-password",
|
||||
};
|
||||
|
||||
Kubernetes client = new Kubernetes(credentials);
|
||||
});
|
||||
client.BaseUri = new Uri("http://localhost");
|
||||
|
||||
MockWebSocketBuilder mockWebSocketBuilder = new MockWebSocketBuilder();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
using k8s.Models;
|
||||
using Microsoft.Rest;
|
||||
using k8s.Autorest;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -193,7 +193,7 @@ namespace k8s.Tests
|
||||
muxedStream.Setup(m => m.GetStream(ChannelIndex.Error, null)).Returns(errorStream);
|
||||
|
||||
var kubernetesMock = new Moq.Mock<Kubernetes>(
|
||||
new object[] { Moq.Mock.Of<ServiceClientCredentials>(), new DelegatingHandler[] { } })
|
||||
new object[] { new KubernetesClientConfiguration() { Host = "http://localhost" }, new DelegatingHandler[] { } })
|
||||
{ CallBase = true };
|
||||
var command = new string[] { "/bin/bash", "-c", "echo Hello, World!" };
|
||||
|
||||
@@ -216,7 +216,7 @@ namespace k8s.Tests
|
||||
public async Task NamespacedPodExecAsyncHttpExceptionWithStatus()
|
||||
{
|
||||
var kubernetesMock = new Moq.Mock<Kubernetes>(
|
||||
new object[] { Moq.Mock.Of<ServiceClientCredentials>(), new DelegatingHandler[] { } })
|
||||
new object[] { new KubernetesClientConfiguration() { Host = "http://localhost" }, new DelegatingHandler[] { } })
|
||||
{ CallBase = true };
|
||||
var command = new string[] { "/bin/bash", "-c", "echo Hello, World!" };
|
||||
var handler = new ExecAsyncCallback((stdIn, stdOut, stdError) => Task.CompletedTask);
|
||||
@@ -241,7 +241,7 @@ namespace k8s.Tests
|
||||
public async Task NamespacedPodExecAsyncHttpExceptionNoStatus()
|
||||
{
|
||||
var kubernetesMock = new Moq.Mock<Kubernetes>(
|
||||
new object[] { Moq.Mock.Of<ServiceClientCredentials>(), new DelegatingHandler[] { } })
|
||||
new object[] { new KubernetesClientConfiguration() { Host = "http://localhost" }, new DelegatingHandler[] { } })
|
||||
{ CallBase = true };
|
||||
var command = new string[] { "/bin/bash", "-c", "echo Hello, World!" };
|
||||
var handler = new ExecAsyncCallback((stdIn, stdOut, stdError) => Task.CompletedTask);
|
||||
@@ -265,7 +265,7 @@ namespace k8s.Tests
|
||||
public async Task NamespacedPodExecAsyncGenericException()
|
||||
{
|
||||
var kubernetesMock = new Moq.Mock<Kubernetes>(
|
||||
new object[] { Moq.Mock.Of<ServiceClientCredentials>(), new DelegatingHandler[] { } })
|
||||
new object[] { new KubernetesClientConfiguration() { Host = "http://localhost" }, new DelegatingHandler[] { } })
|
||||
{ CallBase = true };
|
||||
var command = new string[] { "/bin/bash", "-c", "echo Hello, World!" };
|
||||
var handler = new ExecAsyncCallback((stdIn, stdOut, stdError) => Task.CompletedTask);
|
||||
@@ -319,7 +319,7 @@ namespace k8s.Tests
|
||||
muxedStream.Setup(m => m.GetStream(ChannelIndex.Error, null)).Returns(errorStream);
|
||||
|
||||
var kubernetesMock = new Moq.Mock<Kubernetes>(
|
||||
new object[] { Moq.Mock.Of<ServiceClientCredentials>(), new DelegatingHandler[] { } })
|
||||
new object[] { new KubernetesClientConfiguration() { Host = "http://localhost" }, new DelegatingHandler[] { } })
|
||||
{ CallBase = true };
|
||||
var command = new string[] { "/bin/bash", "-c", "echo Hello, World!" };
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Rest;
|
||||
using k8s.Autorest;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.WebSockets;
|
||||
@@ -132,7 +132,10 @@ namespace k8s.Tests
|
||||
/// </returns>
|
||||
protected virtual Kubernetes CreateTestClient(ServiceClientCredentials credentials = null)
|
||||
{
|
||||
return new Kubernetes(credentials ?? AnonymousClientCredentials.Instance) { BaseUri = ServerBaseAddress };
|
||||
return new Kubernetes(new KubernetesClientConfiguration()
|
||||
{
|
||||
Host = ServerBaseAddress.ToString(),
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user