fix warnings for net8 (#1481)

* fix ca2007

* xUnit1031

* fix ca2007

* fix ca2007

* remove deprecated ctor

* fix xUnit1031

* fix missing doc

* fix missing dispose

* fix ex
This commit is contained in:
Boshi Lian
2024-01-09 09:05:26 -08:00
committed by GitHub
parent f75c4aa484
commit f32cf9eab3
18 changed files with 180 additions and 206 deletions

View File

@@ -136,9 +136,9 @@ metadata:
var tempFileName = Path.GetTempFileName();
try
{
await File.WriteAllTextAsync(tempFileName, content).ConfigureAwait(false);
await File.WriteAllTextAsync(tempFileName, content).ConfigureAwait(true);
var objs = await KubernetesYaml.LoadAllFromFileAsync(tempFileName).ConfigureAwait(false);
var objs = await KubernetesYaml.LoadAllFromFileAsync(tempFileName).ConfigureAwait(true);
Assert.Equal(2, objs.Count);
Assert.IsType<V1Pod>(objs[0]);
Assert.IsType<V1Namespace>(objs[1]);
@@ -175,9 +175,9 @@ metadata:
var tempFileName = Path.GetTempFileName();
try
{
await File.WriteAllTextAsync(tempFileName, content).ConfigureAwait(false);
await File.WriteAllTextAsync(tempFileName, content).ConfigureAwait(true);
var objs = await KubernetesYaml.LoadAllFromFileAsync(tempFileName, types).ConfigureAwait(false);
var objs = await KubernetesYaml.LoadAllFromFileAsync(tempFileName, types).ConfigureAwait(true);
Assert.Equal(2, objs.Count);
Assert.IsType<MyPod>(objs[0]);
Assert.IsType<V1Namespace>(objs[1]);
@@ -282,7 +282,7 @@ spec:
}
[Fact]
public void LoadFromStream()
public async Task LoadFromStream()
{
var content = @"apiVersion: v1
kind: Pod
@@ -292,7 +292,7 @@ metadata:
using var stream = new MemoryStream(Encoding.UTF8.GetBytes(content));
var obj = KubernetesYaml.LoadFromStreamAsync<V1Pod>(stream).Result;
var obj = await KubernetesYaml.LoadFromStreamAsync<V1Pod>(stream).ConfigureAwait(true);
Assert.Equal("foo", obj.Metadata.Name);
}
@@ -309,9 +309,9 @@ metadata:
var tempFileName = Path.GetTempFileName();
try
{
await File.WriteAllTextAsync(tempFileName, content).ConfigureAwait(false);
await File.WriteAllTextAsync(tempFileName, content).ConfigureAwait(true);
var obj = await KubernetesYaml.LoadFromFileAsync<V1Pod>(tempFileName).ConfigureAwait(false);
var obj = await KubernetesYaml.LoadFromFileAsync<V1Pod>(tempFileName).ConfigureAwait(true);
Assert.Equal("foo", obj.Metadata.Name);
}
finally