Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions tests/KubernetesClient.Tests/AuthTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void Anonymous()
var listTask = ExecuteListPods(client);

Assert.True(listTask.Response.IsSuccessStatusCode);
Assert.Equal(1, listTask.Body.Items.Count);
Assert.Single(listTask.Body.Items);
}

using (var server = new MockKubeApiServer(testOutput, cxt =>
Expand Down Expand Up @@ -114,7 +114,7 @@ public void BasicAuth()

var listTask = ExecuteListPods(client);
Assert.True(listTask.Response.IsSuccessStatusCode);
Assert.Equal(1, listTask.Body.Items.Count);
Assert.Single(listTask.Body.Items);
}

{
Expand Down Expand Up @@ -224,7 +224,7 @@ public void Cert()

Assert.True(clientCertificateValidationCalled);
Assert.True(listTask.Response.IsSuccessStatusCode);
Assert.Equal(1, listTask.Body.Items.Count);
Assert.Single(listTask.Body.Items);
}

{
Expand All @@ -241,7 +241,7 @@ public void Cert()

Assert.True(clientCertificateValidationCalled);
Assert.True(listTask.Response.IsSuccessStatusCode);
Assert.Equal(1, listTask.Body.Items.Count);
Assert.Single(listTask.Body.Items);
}

{
Expand Down Expand Up @@ -324,7 +324,7 @@ public void ExternalCertificate()
var client = new Kubernetes(clientConfig);
var listTask = ExecuteListPods(client);
Assert.True(listTask.Response.IsSuccessStatusCode);
Assert.Equal(1, listTask.Body.Items.Count);
Assert.Single(listTask.Body.Items);
}

{
Expand Down Expand Up @@ -368,7 +368,7 @@ public void ExternalToken()
var client = new Kubernetes(clientConfig);
var listTask = ExecuteListPods(client);
Assert.True(listTask.Response.IsSuccessStatusCode);
Assert.Equal(1, listTask.Body.Items.Count);
Assert.Single(listTask.Body.Items);
}

{
Expand Down Expand Up @@ -410,7 +410,7 @@ public void Token()

var listTask = ExecuteListPods(client);
Assert.True(listTask.Response.IsSuccessStatusCode);
Assert.Equal(1, listTask.Body.Items.Count);
Assert.Single(listTask.Body.Items);
}

{
Expand Down Expand Up @@ -478,7 +478,7 @@ public void Oidc()

var listTask = ExecuteListPods(client);
Assert.True(listTask.Response.IsSuccessStatusCode);
Assert.Equal(1, listTask.Body.Items.Count);
Assert.Single(listTask.Body.Items);
}

{
Expand All @@ -493,7 +493,7 @@ public void Oidc()
try
{
PeelAggregate(() => ExecuteListPods(client));
Assert.True(false, "should not be here");
Assert.Fail("should not be here");
}
catch (KubernetesClientException e)
{
Expand All @@ -513,7 +513,7 @@ public void Oidc()
try
{
PeelAggregate(() => ExecuteListPods(client));
Assert.True(false, "should not be here");
Assert.Fail("should not be here");
}
catch (KubernetesClientException e)
{
Expand All @@ -528,7 +528,7 @@ private static void ShouldThrowUnauthorized(Kubernetes client)
try
{
PeelAggregate(() => ExecuteListPods(client));
Assert.True(false, "should not be here");
Assert.Fail("should not be here");
}
catch (HttpOperationException e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public void LeaderElectionThrowException()
return;
}

Assert.True(false, "exception not thrown");
Assert.Fail("exception not thrown");
}

[Fact]
Expand Down
12 changes: 6 additions & 6 deletions tests/KubernetesClient.Tests/ModelExtensionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,18 @@ public void TestMetadata()
// test annotations and labels
pod.SetAnnotation("x", "y");
pod.SetLabel("a", "b");
Assert.Equal(1, pod.Annotations().Count);
Assert.Equal(1, pod.Labels().Count);
Assert.Single(pod.Annotations());
Assert.Single(pod.Labels());
Assert.Equal("y", pod.GetAnnotation("x"));
Assert.Equal("y", pod.Metadata.Annotations["x"]);
Assert.Null(pod.GetAnnotation("a"));
Assert.Equal("b", pod.GetLabel("a"));
Assert.Equal("b", pod.Metadata.Labels["a"]);
Assert.Null(pod.GetLabel("x"));
pod.SetAnnotation("x", null);
Assert.Equal(0, pod.Annotations().Count);
Assert.Empty(pod.Annotations());
pod.SetLabel("a", null);
Assert.Equal(0, pod.Labels().Count);
Assert.Empty(pod.Labels());

// test finalizers
Assert.False(pod.HasFinalizer("abc"));
Expand Down Expand Up @@ -153,15 +153,15 @@ public void TestReferences()
svc.OwnerReferences()[0].Controller = true;
Assert.Same(ownr, svc.GetController());
Assert.Same(ownr, svc.RemoveOwnerReference(pod));
Assert.Equal(0, svc.OwnerReferences().Count);
Assert.Empty(svc.OwnerReferences());
svc.AddOwnerReference(new V1OwnerReference() { ApiVersion = pod.ApiVersion, Kind = pod.Kind, Name = pod.Name(), Uid = pod.Uid(), Controller = true });
svc.AddOwnerReference(new V1OwnerReference() { ApiVersion = pod.ApiVersion, Kind = pod.Kind, Name = pod.Name(), Uid = pod.Uid(), Controller = false });
svc.AddOwnerReference(new V1OwnerReference() { ApiVersion = pod.ApiVersion, Kind = pod.Kind, Name = pod.Name(), Uid = pod.Uid() });
Assert.Equal(3, svc.OwnerReferences().Count);
Assert.NotNull(svc.RemoveOwnerReference(pod));
Assert.Equal(2, svc.OwnerReferences().Count);
Assert.True(svc.RemoveOwnerReferences(pod));
Assert.Equal(0, svc.OwnerReferences().Count);
Assert.Empty(svc.OwnerReferences());
}

[Fact]
Expand Down
4 changes: 2 additions & 2 deletions tests/KubernetesClient.Tests/OidcAuthTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task TestOidcAuth()
result = await auth.GetAuthenticationHeaderAsync(CancellationToken.None).ConfigureAwait(false);
result.Scheme.Should().Be("Bearer");
result.Parameter.Should().Be(expiredIdToken);
Assert.True(false, "should not be here");
Assert.Fail("should not be here");
}
catch (KubernetesClientException e)
{
Expand All @@ -46,7 +46,7 @@ public async Task TestOidcAuth()
result = await auth.GetAuthenticationHeaderAsync(CancellationToken.None).ConfigureAwait(false);
result.Scheme.Should().Be("Bearer");
result.Parameter.Should().Be(expiredIdToken);
Assert.True(false, "should not be here");
Assert.Fail("should not be here");
}
catch (KubernetesClientException e)
{
Expand Down