Skip to content

Commit e869a20

Browse files
committed
Update tests
1 parent 7cd01f1 commit e869a20

File tree

4 files changed

+17
-22
lines changed

4 files changed

+17
-22
lines changed

tests/E2E.Tests/MinikubeTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void SimpleTest()
2828
var namespaceParameter = "default";
2929
var podName = "k8scsharp-e2e-pod";
3030

31-
var client = CreateClient();
31+
using var client = CreateClient();
3232

3333
void Cleanup()
3434
{
@@ -79,7 +79,7 @@ public void PatchTest()
7979
var namespaceParameter = "default";
8080
var podName = "k8scsharp-e2e-patch-pod";
8181

82-
var client = CreateClient();
82+
using var client = CreateClient();
8383

8484
void Cleanup()
8585
{
@@ -183,7 +183,7 @@ void Cleanup()
183183
[MinikubeFact]
184184
public async Task WatcherIntegrationTest()
185185
{
186-
var kubernetes = CreateClient();
186+
using var kubernetes = CreateClient();
187187

188188
var job = await kubernetes.BatchV1.CreateNamespacedJobAsync(
189189
new V1Job()
@@ -251,7 +251,7 @@ public async Task WatcherIntegrationTest()
251251
[MinikubeFact]
252252
public void LeaderIntegrationTest()
253253
{
254-
var client = CreateClient();
254+
using var client = CreateClient();
255255
var namespaceParameter = "default";
256256

257257
void Cleanup()
@@ -350,7 +350,7 @@ public async Task LogStreamTestAsync()
350350
var namespaceParameter = "default";
351351
var podName = "k8scsharp-e2e-logstream-pod";
352352

353-
var client = CreateClient();
353+
using var client = CreateClient();
354354

355355
void Cleanup()
356356
{
@@ -446,7 +446,7 @@ async Task<V1Pod> Pod()
446446
[MinikubeFact]
447447
public async Task DatetimeFieldTest()
448448
{
449-
var kubernetes = CreateClient();
449+
using var kubernetes = CreateClient();
450450

451451
await kubernetes.CoreV1.CreateNamespacedEventAsync(
452452
new Corev1Event(
@@ -478,7 +478,7 @@ public async void GenericTest()
478478
var namespaceParameter = "default";
479479
var podName = "k8scsharp-e2e-generic-pod";
480480

481-
var client = CreateClient();
481+
using var client = CreateClient();
482482
var genericPods = new GenericClient(client, "", "v1", "pods");
483483

484484
void Cleanup()
@@ -590,7 +590,7 @@ public async Task CopyToPodTestAsync()
590590
var namespaceParameter = "default";
591591
var podName = "k8scsharp-e2e-cp-pod";
592592

593-
var client = CreateClient();
593+
using var client = CreateClient();
594594

595595
async Task<int> CopyFileToPodAsync(string name, string @namespace, string container, Stream inputFileStream, string destinationFilePath, CancellationToken cancellationToken = default(CancellationToken))
596596
{

tests/Kubectl.Tests/KubectlTests.Version.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using k8s.E2E;
2+
using k8s.kubectl.beta;
23
using System.Text.Json;
34
using Xunit;
45

@@ -9,7 +10,8 @@ public partial class KubectlTests
910
[MinikubeFact]
1011
public void Version()
1112
{
12-
var client = CreateClient();
13+
using var kubernetes = MinikubeTests.CreateClient();
14+
var client = new Kubectl(kubernetes);
1315
var version = client.Version();
1416
var serverobj = version.ServerVersion;
1517

tests/Kubectl.Tests/KubectlTests.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
1-
using k8s.E2E;
2-
using k8s.kubectl.beta;
31
using System.Diagnostics;
42

53
namespace k8s.kubectl.Tests;
64

75
public partial class KubectlTests
86
{
9-
private Kubectl CreateClient()
10-
{
11-
return new Kubectl(MinikubeTests.CreateClient());
12-
}
13-
147
private string RunKubectl(string args)
158
{
169
var p = new Process

tests/KubernetesClient.Tests/CertUtilsTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void LoadFromFiles()
2929
useRelativePaths: false);
3030

3131
// Just validate that this doesn't throw and private key is non-null
32-
var cert = CertUtils.GeneratePfx(cfg);
32+
using var cert = CertUtils.GeneratePfx(cfg);
3333
Assert.NotNull(cert.GetRSAPrivateKey());
3434
}
3535

@@ -44,7 +44,7 @@ public void LoadFromFilesRelativePath()
4444
"federal-context");
4545

4646
// Just validate that this doesn't throw and private key is non-null
47-
var cert = CertUtils.GeneratePfx(cfg);
47+
using var cert = CertUtils.GeneratePfx(cfg);
4848
Assert.NotNull(cert.GetRSAPrivateKey());
4949
}
5050

@@ -58,7 +58,7 @@ public void LoadFromInlineData()
5858
useRelativePaths: false);
5959

6060
// Just validate that this doesn't throw and private key is non-null
61-
var cert = CertUtils.GeneratePfx(cfg);
61+
using var cert = CertUtils.GeneratePfx(cfg);
6262
Assert.NotNull(cert.GetRSAPrivateKey());
6363
}
6464

@@ -73,7 +73,7 @@ public void LoadFromInlineDataRelativePath()
7373
"victorian-context");
7474

7575
// Just validate that this doesn't throw and private key is non-null
76-
var cert = CertUtils.GeneratePfx(cfg);
76+
using var cert = CertUtils.GeneratePfx(cfg);
7777
Assert.NotNull(cert.GetRSAPrivateKey());
7878
}
7979

@@ -85,8 +85,8 @@ public void LoadPemWithMultiCert()
8585
{
8686
var certCollection = CertUtils.LoadPemFileCert("assets/ca-bundle.crt");
8787

88-
var intermediateCert = new X509Certificate2("assets/ca-bundle-intermediate.crt");
89-
var rootCert = new X509Certificate2("assets/ca-bundle-root.crt");
88+
using var intermediateCert = new X509Certificate2("assets/ca-bundle-intermediate.crt");
89+
using var rootCert = new X509Certificate2("assets/ca-bundle-root.crt");
9090

9191
Assert.Equal(2, certCollection.Count);
9292

0 commit comments

Comments
 (0)