Move projects to subdirectories of /src and /tests (#134)
kubernetes-client/csharp#127
This commit is contained in:
committed by
Brendan Burns
parent
dc97164332
commit
ea62ca00e0
43
tests/KubernetesClient.Tests/CertUtilsTests.cs
Normal file
43
tests/KubernetesClient.Tests/CertUtilsTests.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using Xunit;
|
||||
using k8s;
|
||||
using System.IO;
|
||||
|
||||
namespace k8s.Tests
|
||||
{
|
||||
public class CertUtilsTests
|
||||
{
|
||||
/// <summary>
|
||||
/// This file contains a sample kubeconfig file
|
||||
/// </summary>
|
||||
private static readonly string kubeConfigFileName = "assets/kubeconfig.yml";
|
||||
|
||||
/// <summary>
|
||||
/// Checks that a certificate can be loaded from files.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void LoadFromFiles()
|
||||
{
|
||||
var fi = new FileInfo(kubeConfigFileName);
|
||||
var cfg = KubernetesClientConfiguration.BuildConfigFromConfigFile(fi, "federal-context");
|
||||
|
||||
// Just validate that this doesn't throw and private key is non-null
|
||||
var cert = CertUtils.GeneratePfx(cfg);
|
||||
Assert.NotNull(cert.PrivateKey);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks that a certificate can be loaded from inline.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void LoadFromInlineData()
|
||||
{
|
||||
var fi = new FileInfo(kubeConfigFileName);
|
||||
var cfg = KubernetesClientConfiguration.BuildConfigFromConfigFile(fi, "victorian-context");
|
||||
|
||||
// Just validate that this doesn't throw and private key is non-null
|
||||
var cert = CertUtils.GeneratePfx(cfg);
|
||||
Assert.NotNull(cert.PrivateKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user