fix warnings by xunit (#1352)

This commit is contained in:
Boshi Lian
2023-07-30 08:02:01 -07:00
committed by GitHub
parent c329b119bb
commit 149eea642d
4 changed files with 20 additions and 20 deletions

View File

@@ -49,7 +49,7 @@ namespace k8s.Tests
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 =>
@@ -114,7 +114,7 @@ namespace k8s.Tests
var listTask = ExecuteListPods(client);
Assert.True(listTask.Response.IsSuccessStatusCode);
Assert.Equal(1, listTask.Body.Items.Count);
Assert.Single(listTask.Body.Items);
}
{
@@ -224,7 +224,7 @@ namespace k8s.Tests
Assert.True(clientCertificateValidationCalled);
Assert.True(listTask.Response.IsSuccessStatusCode);
Assert.Equal(1, listTask.Body.Items.Count);
Assert.Single(listTask.Body.Items);
}
{
@@ -241,7 +241,7 @@ namespace k8s.Tests
Assert.True(clientCertificateValidationCalled);
Assert.True(listTask.Response.IsSuccessStatusCode);
Assert.Equal(1, listTask.Body.Items.Count);
Assert.Single(listTask.Body.Items);
}
{
@@ -324,7 +324,7 @@ namespace k8s.Tests
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);
}
{
@@ -368,7 +368,7 @@ namespace k8s.Tests
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);
}
{
@@ -410,7 +410,7 @@ namespace k8s.Tests
var listTask = ExecuteListPods(client);
Assert.True(listTask.Response.IsSuccessStatusCode);
Assert.Equal(1, listTask.Body.Items.Count);
Assert.Single(listTask.Body.Items);
}
{
@@ -478,7 +478,7 @@ namespace k8s.Tests
var listTask = ExecuteListPods(client);
Assert.True(listTask.Response.IsSuccessStatusCode);
Assert.Equal(1, listTask.Body.Items.Count);
Assert.Single(listTask.Body.Items);
}
{
@@ -493,7 +493,7 @@ namespace k8s.Tests
try
{
PeelAggregate(() => ExecuteListPods(client));
Assert.True(false, "should not be here");
Assert.Fail("should not be here");
}
catch (KubernetesClientException e)
{
@@ -513,7 +513,7 @@ namespace k8s.Tests
try
{
PeelAggregate(() => ExecuteListPods(client));
Assert.True(false, "should not be here");
Assert.Fail("should not be here");
}
catch (KubernetesClientException e)
{
@@ -528,7 +528,7 @@ namespace k8s.Tests
try
{
PeelAggregate(() => ExecuteListPods(client));
Assert.True(false, "should not be here");
Assert.Fail("should not be here");
}
catch (HttpOperationException e)
{

View File

@@ -313,7 +313,7 @@ namespace k8s.Tests.LeaderElection
return;
}
Assert.True(false, "exception not thrown");
Assert.Fail("exception not thrown");
}
[Fact]

View File

@@ -82,8 +82,8 @@ namespace k8s.Tests
// 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"));
@@ -91,9 +91,9 @@ namespace k8s.Tests
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"));
@@ -153,7 +153,7 @@ namespace k8s.Tests
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() });
@@ -161,7 +161,7 @@ namespace k8s.Tests
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]

View File

@@ -32,7 +32,7 @@ namespace k8s.Tests
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)
{
@@ -46,7 +46,7 @@ namespace k8s.Tests
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)
{