remove BOM from UTF-8 files
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
namespace simple
|
namespace simple
|
||||||
{
|
{
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="3.0.3" />
|
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="3.0.3" />
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.26430.16
|
VisualStudioVersion = 15.0.26430.16
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace k8s.Exceptions
|
namespace k8s.Exceptions
|
||||||
{
|
{
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace k8s.Exceptions
|
namespace k8s.Exceptions
|
||||||
{
|
{
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace k8s
|
namespace k8s
|
||||||
{
|
{
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using k8s.Exceptions;
|
using k8s.Exceptions;
|
||||||
using Microsoft.Rest;
|
using Microsoft.Rest;
|
||||||
|
|
||||||
public partial class Kubernetes : ServiceClient<Kubernetes>, IKubernetes
|
public partial class Kubernetes : ServiceClient<Kubernetes>, IKubernetes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace k8s
|
namespace k8s
|
||||||
{
|
{
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace k8s
|
namespace k8s
|
||||||
{
|
{
|
||||||
using k8s.Exceptions;
|
using k8s.Exceptions;
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Xunit;
|
using Xunit;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace k8s.Tests
|
namespace k8s.Tests
|
||||||
@@ -6,8 +6,9 @@ namespace k8s.Tests
|
|||||||
public class KubernetesClientConfigurationTests
|
public class KubernetesClientConfigurationTests
|
||||||
{
|
{
|
||||||
|
|
||||||
public static string readLine(string fileName) {
|
public static string readLine(string fileName)
|
||||||
StreamReader reader = new StreamReader(new FileStream(fileName, FileMode.Open, FileAccess.Read));
|
{
|
||||||
|
StreamReader reader = new StreamReader(new FileStream(fileName, FileMode.Open, FileAccess.Read));
|
||||||
return reader.ReadLine();
|
return reader.ReadLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +64,7 @@ namespace k8s.Tests
|
|||||||
public void ConfigurationFileNotFound()
|
public void ConfigurationFileNotFound()
|
||||||
{
|
{
|
||||||
var fi = new FileInfo("/path/to/nowhere");
|
var fi = new FileInfo("/path/to/nowhere");
|
||||||
Assert.Throws<k8s.Exceptions.KubeConfigException>(() => new KubernetesClientConfiguration(fi));
|
Assert.Throws<k8s.Exceptions.KubeConfigException>(() => new KubernetesClientConfiguration(fi));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -74,8 +75,8 @@ namespace k8s.Tests
|
|||||||
{
|
{
|
||||||
var cfg = new KubernetesClientConfiguration(new FileInfo(kubeConfigFileName));
|
var cfg = new KubernetesClientConfiguration(new FileInfo(kubeConfigFileName));
|
||||||
Assert.NotNull(cfg.Host);
|
Assert.NotNull(cfg.Host);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if host is properly loaded, per context
|
/// Check if host is properly loaded, per context
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -83,8 +84,8 @@ namespace k8s.Tests
|
|||||||
[InlineData("federal-context", "https://horse.org:4443")]
|
[InlineData("federal-context", "https://horse.org:4443")]
|
||||||
[InlineData("queen-anne-context", "https://pig.org:443")]
|
[InlineData("queen-anne-context", "https://pig.org:443")]
|
||||||
public void ContextHostTest(string context, string host)
|
public void ContextHostTest(string context, string host)
|
||||||
{
|
{
|
||||||
var fi = new FileInfo(kubeConfigFileName);
|
var fi = new FileInfo(kubeConfigFileName);
|
||||||
var cfg = new KubernetesClientConfiguration(fi, context);
|
var cfg = new KubernetesClientConfiguration(fi, context);
|
||||||
Assert.Equal(host, cfg.Host);
|
Assert.Equal(host, cfg.Host);
|
||||||
}
|
}
|
||||||
@@ -99,11 +100,11 @@ namespace k8s.Tests
|
|||||||
[InlineData("queen-anne-context", "black-token")]
|
[InlineData("queen-anne-context", "black-token")]
|
||||||
public void ContextUserTokenTest(string context, string token)
|
public void ContextUserTokenTest(string context, string token)
|
||||||
{
|
{
|
||||||
var fi = new FileInfo(kubeConfigFileName);
|
var fi = new FileInfo(kubeConfigFileName);
|
||||||
var cfg = new KubernetesClientConfiguration(fi, context);
|
var cfg = new KubernetesClientConfiguration(fi, context);
|
||||||
Assert.Equal(context, cfg.CurrentContext);
|
Assert.Equal(context, cfg.CurrentContext);
|
||||||
Assert.Null(cfg.Username);
|
Assert.Null(cfg.Username);
|
||||||
Assert.Equal(token, cfg.AccessToken);
|
Assert.Equal(token, cfg.AccessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -113,7 +114,7 @@ namespace k8s.Tests
|
|||||||
/// <param name="clientCertData">'client-certificate-data' node content</param>
|
/// <param name="clientCertData">'client-certificate-data' node content</param>
|
||||||
/// <param name="clientCertKey">'client-key-data' content</param>
|
/// <param name="clientCertKey">'client-key-data' content</param>
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("federal-context", "assets/client.crt" ,"assets/client.key")]
|
[InlineData("federal-context", "assets/client.crt", "assets/client.key")]
|
||||||
public void ContextCertificateTest(string context, string clientCert, string clientCertKey)
|
public void ContextCertificateTest(string context, string clientCert, string clientCertKey)
|
||||||
{
|
{
|
||||||
var fi = new FileInfo(kubeConfigFileName);
|
var fi = new FileInfo(kubeConfigFileName);
|
||||||
@@ -147,7 +148,7 @@ namespace k8s.Tests
|
|||||||
public void ContextNotFoundTest()
|
public void ContextNotFoundTest()
|
||||||
{
|
{
|
||||||
var fi = new FileInfo(kubeConfigFileName);
|
var fi = new FileInfo(kubeConfigFileName);
|
||||||
Assert.Throws<k8s.Exceptions.KubeConfigException>(() => new KubernetesClientConfiguration(fi, "context-not-found"));
|
Assert.Throws<k8s.Exceptions.KubeConfigException>(() => new KubernetesClientConfiguration(fi, "context-not-found"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -157,8 +158,8 @@ namespace k8s.Tests
|
|||||||
public void NoContexts()
|
public void NoContexts()
|
||||||
{
|
{
|
||||||
var fi = new FileInfo(kubeConfigNoContexts);
|
var fi = new FileInfo(kubeConfigNoContexts);
|
||||||
Assert.Throws<k8s.Exceptions.KubeConfigException>(() => new KubernetesClientConfiguration(fi));
|
Assert.Throws<k8s.Exceptions.KubeConfigException>(() => new KubernetesClientConfiguration(fi));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test if KubeConfigException is thrown when no Contexts are set and we specify a concrete context name
|
/// Test if KubeConfigException is thrown when no Contexts are set and we specify a concrete context name
|
||||||
@@ -167,7 +168,7 @@ namespace k8s.Tests
|
|||||||
public void NoContextsExplicit()
|
public void NoContextsExplicit()
|
||||||
{
|
{
|
||||||
var fi = new FileInfo(kubeConfigNoContexts);
|
var fi = new FileInfo(kubeConfigNoContexts);
|
||||||
Assert.Throws<k8s.Exceptions.KubeConfigException>(() => new KubernetesClientConfiguration(fi, "context"));
|
Assert.Throws<k8s.Exceptions.KubeConfigException>(() => new KubernetesClientConfiguration(fi, "context"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -189,7 +190,7 @@ namespace k8s.Tests
|
|||||||
public void IncompleteUserCredentials()
|
public void IncompleteUserCredentials()
|
||||||
{
|
{
|
||||||
var fi = new FileInfo(kubeConfigNoCredentials);
|
var fi = new FileInfo(kubeConfigNoCredentials);
|
||||||
Assert.Throws<k8s.Exceptions.KubeConfigException>(() => new KubernetesClientConfiguration(fi));
|
Assert.Throws<k8s.Exceptions.KubeConfigException>(() => new KubernetesClientConfiguration(fi));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -199,7 +200,7 @@ namespace k8s.Tests
|
|||||||
public void ServerNotFound()
|
public void ServerNotFound()
|
||||||
{
|
{
|
||||||
var fi = new FileInfo(kubeConfigNoServer);
|
var fi = new FileInfo(kubeConfigNoServer);
|
||||||
Assert.Throws<k8s.Exceptions.KubeConfigException>(() => new KubernetesClientConfiguration(fi));
|
Assert.Throws<k8s.Exceptions.KubeConfigException>(() => new KubernetesClientConfiguration(fi));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -209,9 +210,9 @@ namespace k8s.Tests
|
|||||||
public void ClusterNotFound()
|
public void ClusterNotFound()
|
||||||
{
|
{
|
||||||
var fi = new FileInfo(kubeConfigNoCluster);
|
var fi = new FileInfo(kubeConfigNoCluster);
|
||||||
Assert.Throws<k8s.Exceptions.KubeConfigException>(() => new KubernetesClientConfiguration(fi));
|
Assert.Throws<k8s.Exceptions.KubeConfigException>(() => new KubernetesClientConfiguration(fi));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks that a KubeConfigException is thrown when the cluster defined in clusters and contexts do not match
|
/// Checks that a KubeConfigException is thrown when the cluster defined in clusters and contexts do not match
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -219,7 +220,7 @@ namespace k8s.Tests
|
|||||||
public void ClusterNameMissmatch()
|
public void ClusterNameMissmatch()
|
||||||
{
|
{
|
||||||
var fi = new FileInfo(kubeConfigClusterMissmatch);
|
var fi = new FileInfo(kubeConfigClusterMissmatch);
|
||||||
Assert.Throws<k8s.Exceptions.KubeConfigException>(() => new KubernetesClientConfiguration(fi));
|
Assert.Throws<k8s.Exceptions.KubeConfigException>(() => new KubernetesClientConfiguration(fi));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -229,7 +230,7 @@ namespace k8s.Tests
|
|||||||
public void CheckClusterTlsCorrectness()
|
public void CheckClusterTlsCorrectness()
|
||||||
{
|
{
|
||||||
var fi = new FileInfo(kubeConfigTlsNoSkipError);
|
var fi = new FileInfo(kubeConfigTlsNoSkipError);
|
||||||
Assert.Throws<k8s.Exceptions.KubeConfigException>(() => new KubernetesClientConfiguration(fi));
|
Assert.Throws<k8s.Exceptions.KubeConfigException>(() => new KubernetesClientConfiguration(fi));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -239,11 +240,11 @@ namespace k8s.Tests
|
|||||||
public void CheckClusterTlsSkipCorrectness()
|
public void CheckClusterTlsSkipCorrectness()
|
||||||
{
|
{
|
||||||
var fi = new FileInfo(kubeConfigTlsSkip);
|
var fi = new FileInfo(kubeConfigTlsSkip);
|
||||||
var cfg = new KubernetesClientConfiguration(fi);
|
var cfg = new KubernetesClientConfiguration(fi);
|
||||||
Assert.NotNull(cfg.Host);
|
Assert.NotNull(cfg.Host);
|
||||||
Assert.Null(cfg.SslCaCert);
|
Assert.Null(cfg.SslCaCert);
|
||||||
Assert.True(cfg.SkipTlsVerify);
|
Assert.True(cfg.SkipTlsVerify);
|
||||||
}
|
}
|
||||||
|
|
||||||
// /// <summary>
|
// /// <summary>
|
||||||
// /// Checks if the are pods
|
// /// Checks if the are pods
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
|||||||
Reference in New Issue
Block a user