Fix some compilation warnings (#1010)
* Fixe some summary warning * Fixed more warning * Uniformed example projects code * Uniformed test projects code * Fix OperatingSystems enum and GenericType summaries
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
using ICSharpCode.SharpZipLib.Tar;
|
||||
using Json.Patch;
|
||||
using k8s.Autorest;
|
||||
using k8s.LeaderElection;
|
||||
using k8s.LeaderElection.ResourceLock;
|
||||
using k8s.Models;
|
||||
using Nito.AsyncEx;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Json.Patch;
|
||||
using k8s.LeaderElection;
|
||||
using k8s.LeaderElection.ResourceLock;
|
||||
using k8s.Models;
|
||||
using k8s.Autorest;
|
||||
using Nito.AsyncEx;
|
||||
using Xunit;
|
||||
using ICSharpCode.SharpZipLib.Tar;
|
||||
using System.Text;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace k8s.E2E
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using k8s.Models;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using k8s.Models;
|
||||
|
||||
namespace k8s.tests;
|
||||
|
||||
@@ -12,7 +12,7 @@ public class BasicTests
|
||||
// TODO: fail to setup asp.net core 6 on net48
|
||||
private class DummyHttpServer : System.IDisposable
|
||||
{
|
||||
private TcpListener server;
|
||||
private readonly TcpListener server;
|
||||
private readonly Task loop;
|
||||
private volatile bool running = false;
|
||||
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
using k8s.Authentication;
|
||||
using k8s.Autorest;
|
||||
using k8s.Exceptions;
|
||||
using k8s.KubeConfigModels;
|
||||
using k8s.Models;
|
||||
using k8s.Tests.Mock;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Https;
|
||||
using Org.BouncyCastle.Crypto.Parameters;
|
||||
using Org.BouncyCastle.Pkcs;
|
||||
using Org.BouncyCastle.Security;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -9,17 +20,6 @@ using System.Security.Cryptography;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using k8s.Authentication;
|
||||
using k8s.Exceptions;
|
||||
using k8s.KubeConfigModels;
|
||||
using k8s.Models;
|
||||
using k8s.Tests.Mock;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Https;
|
||||
using k8s.Autorest;
|
||||
using Org.BouncyCastle.Crypto.Parameters;
|
||||
using Org.BouncyCastle.Pkcs;
|
||||
using Org.BouncyCastle.Security;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
|
||||
@@ -244,8 +244,7 @@ namespace k8s.Tests
|
||||
/// Tests a call to <see cref="ByteBuffer.Read(byte[], int, int)"/> when no data is available; and makes
|
||||
/// sure the call blocks until data is available.
|
||||
/// </summary>
|
||||
/// <returns><placeholder>A <see cref="Task"/> representing the asynchronous unit test.</placeholder></returns>
|
||||
/// <returns><placeholder>A <see cref="Task"/> representing the asynchronous unit test.</placeholder></returns>
|
||||
/// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
|
||||
[Fact]
|
||||
public async Task ReadBlocksUntilDataAvailableTest()
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using Xunit;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using Xunit;
|
||||
|
||||
namespace k8s.Tests
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using k8s.KubeConfigModels;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json;
|
||||
using k8s.KubeConfigModels;
|
||||
using Xunit;
|
||||
|
||||
namespace k8s.Tests
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using FluentAssertions;
|
||||
using k8s.Authentication;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FluentAssertions;
|
||||
using k8s.Authentication;
|
||||
|
||||
namespace k8s.Tests
|
||||
{
|
||||
|
||||
@@ -33,6 +33,8 @@ namespace k8s.Tests
|
||||
/// <summary>
|
||||
/// Check if host is properly loaded, per context
|
||||
/// </summary>
|
||||
/// <param name="context">Context to retreive the configuration</param>
|
||||
/// <param name="host">Host to check</param>
|
||||
[Theory]
|
||||
[InlineData("federal-context", "https://horse.org:4443")]
|
||||
[InlineData("queen-anne-context", "https://pig.org:443")]
|
||||
@@ -46,6 +48,8 @@ namespace k8s.Tests
|
||||
/// <summary>
|
||||
/// Check if namespace is properly loaded, per context
|
||||
/// </summary>
|
||||
/// <param name="context">Context to retreive the configuration</param>
|
||||
/// <param name="namespace">Namespace to check</param>
|
||||
[Theory]
|
||||
[InlineData("federal-context", "chisel-ns")]
|
||||
[InlineData("queen-anne-context", "saw-ns")]
|
||||
@@ -59,8 +63,8 @@ namespace k8s.Tests
|
||||
/// <summary>
|
||||
/// Checks if user-based token is loaded properly from the config file, per context
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <param name="context">Context to retreive the configuration</param>
|
||||
/// <param name="token">User authentication token</param>
|
||||
[Theory]
|
||||
[InlineData("queen-anne-context", "black-token")]
|
||||
public void ContextUserToken(string context, string token)
|
||||
@@ -92,7 +96,7 @@ namespace k8s.Tests
|
||||
/// <summary>
|
||||
/// Checks for loading of elliptical curve keys
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="context">Context to retreive the configuration</param>
|
||||
[Theory]
|
||||
[InlineData("elliptic-context")]
|
||||
public void ContextEllipticKey(string context)
|
||||
@@ -383,11 +387,10 @@ namespace k8s.Tests
|
||||
[Fact]
|
||||
public void DefaultConfigurationAsStreamLoaded()
|
||||
{
|
||||
using (var stream = File.OpenRead("assets/kubeconfig.yml"))
|
||||
{
|
||||
var cfg = KubernetesClientConfiguration.BuildConfigFromConfigFile(stream);
|
||||
Assert.NotNull(cfg.Host);
|
||||
}
|
||||
using var stream = File.OpenRead("assets/kubeconfig.yml");
|
||||
|
||||
var cfg = KubernetesClientConfiguration.BuildConfigFromConfigFile(stream);
|
||||
Assert.NotNull(cfg.Host);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -408,7 +411,7 @@ namespace k8s.Tests
|
||||
{
|
||||
var path = Path.GetFullPath("assets/kubeconfig.cluster-extensions.yml");
|
||||
|
||||
var cfg = await KubernetesClientConfiguration.BuildConfigFromConfigFileAsync(new FileInfo(path)).ConfigureAwait(false);
|
||||
_ = await KubernetesClientConfiguration.BuildConfigFromConfigFileAsync(new FileInfo(path)).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using k8s.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using k8s.Models;
|
||||
using Xunit;
|
||||
|
||||
namespace k8s.Tests
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using k8s.LeaderElection;
|
||||
using Moq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using k8s.LeaderElection;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
|
||||
@@ -26,11 +26,6 @@ namespace k8s.Tests.Logging
|
||||
/// </param>
|
||||
public TestOutputLogger(ITestOutputHelper testOutput, string loggerCategory, LogLevel minLogLevel)
|
||||
{
|
||||
if (testOutput == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(testOutput));
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(loggerCategory))
|
||||
{
|
||||
throw new ArgumentException(
|
||||
@@ -38,7 +33,7 @@ namespace k8s.Tests.Logging
|
||||
nameof(loggerCategory));
|
||||
}
|
||||
|
||||
TestOutput = testOutput;
|
||||
TestOutput = testOutput ?? throw new ArgumentNullException(nameof(testOutput));
|
||||
LoggerCategory = loggerCategory;
|
||||
MinLogLevel = minLogLevel;
|
||||
}
|
||||
@@ -61,6 +56,7 @@ namespace k8s.Tests.Logging
|
||||
/// <summary>
|
||||
/// Emit a log entry.
|
||||
/// </summary>
|
||||
/// <typeparam name="TState">Type of state to log.</typeparam>
|
||||
/// <param name="level">
|
||||
/// The log entry's level.
|
||||
/// </param>
|
||||
@@ -124,6 +120,7 @@ namespace k8s.Tests.Logging
|
||||
/// <summary>
|
||||
/// Begin a logical operation scope.
|
||||
/// </summary>
|
||||
/// <typeparam name="TState">Type of state to log.</typeparam>
|
||||
/// <param name="state">
|
||||
/// An identifier for the scope.
|
||||
/// </param>
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using k8s.Tests.Logging;
|
||||
using Microsoft.AspNetCore;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
@@ -10,6 +6,10 @@ using Microsoft.AspNetCore.Hosting.Server.Features;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace k8s.Tests.Mock
|
||||
|
||||
@@ -12,9 +12,9 @@ namespace k8s.Tests.Mock
|
||||
private WebSocketCloseStatus? closeStatus;
|
||||
private string closeStatusDescription;
|
||||
private WebSocketState state;
|
||||
private string subProtocol;
|
||||
private ConcurrentQueue<MessageData> receiveBuffers = new ConcurrentQueue<MessageData>();
|
||||
private AsyncAutoResetEvent receiveEvent = new AsyncAutoResetEvent(false);
|
||||
private readonly string subProtocol;
|
||||
private readonly ConcurrentQueue<MessageData> receiveBuffers = new ConcurrentQueue<MessageData>();
|
||||
private readonly AsyncAutoResetEvent receiveEvent = new AsyncAutoResetEvent(false);
|
||||
private bool disposedValue;
|
||||
|
||||
public MockWebSocket(string subProtocol = null)
|
||||
|
||||
@@ -20,12 +20,7 @@ namespace k8s.Tests.Mock.Server.Controllers
|
||||
/// </param>
|
||||
public PodExecController(WebSocketTestAdapter webSocketTestAdapter)
|
||||
{
|
||||
if (webSocketTestAdapter == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(webSocketTestAdapter));
|
||||
}
|
||||
|
||||
WebSocketTestAdapter = webSocketTestAdapter;
|
||||
WebSocketTestAdapter = webSocketTestAdapter ?? throw new ArgumentNullException(nameof(webSocketTestAdapter));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -42,8 +37,7 @@ namespace k8s.Tests.Mock.Server.Controllers
|
||||
/// <param name="podName">
|
||||
/// The target pod's name.
|
||||
/// </param>
|
||||
/// <returns><placeholder>A <see cref="Task"/> representing the asynchronous operation.</placeholder></returns>
|
||||
/// <returns><placeholder>A <see cref="Task"/> representing the asynchronous operation.</placeholder></returns>
|
||||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
||||
[Route("namespaces/{kubeNamespace}/pods/{podName}/exec")]
|
||||
public async Task<IActionResult> Exec(string kubeNamespace, string podName)
|
||||
{
|
||||
|
||||
@@ -21,12 +21,7 @@ namespace k8s.Tests.Mock.Server.Controllers
|
||||
/// </param>
|
||||
public PodPortForwardController(WebSocketTestAdapter webSocketTestAdapter)
|
||||
{
|
||||
if (webSocketTestAdapter == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(webSocketTestAdapter));
|
||||
}
|
||||
|
||||
WebSocketTestAdapter = webSocketTestAdapter;
|
||||
WebSocketTestAdapter = webSocketTestAdapter ?? throw new ArgumentNullException(nameof(webSocketTestAdapter));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -46,8 +41,7 @@ namespace k8s.Tests.Mock.Server.Controllers
|
||||
/// <param name="ports">
|
||||
/// The port(s) to forward to the pod.
|
||||
/// </param>
|
||||
/// <returns><placeholder>A <see cref="Task"/> representing the asynchronous operation.</placeholder></returns>
|
||||
/// <returns><placeholder>A <see cref="Task"/> representing the asynchronous operation.</placeholder></returns>
|
||||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
||||
[Route("namespaces/{kubeNamespace}/pods/{podName}/portforward")]
|
||||
public async Task<IActionResult> Exec(string kubeNamespace, string podName, IEnumerable<string> ports)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using k8s.Models;
|
||||
using System;
|
||||
using Xunit;
|
||||
|
||||
namespace k8s.Tests
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FluentAssertions;
|
||||
using k8s.Authentication;
|
||||
using k8s.Exceptions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace k8s.Tests
|
||||
|
||||
@@ -5,8 +5,13 @@ namespace k8s.Tests
|
||||
[Flags]
|
||||
public enum OperatingSystems
|
||||
{
|
||||
/// <summary>Windows operating system.</summary>
|
||||
Windows = 1,
|
||||
|
||||
/// <summary>Linux operating system.</summary>
|
||||
Linux = 2,
|
||||
|
||||
/// <summary>OSX operating system.</summary>
|
||||
OSX = 4,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
* These tests are for the netcoreapp2.1 version of the client (there are separate tests for netstandard that don't actually connect to a server).
|
||||
*/
|
||||
|
||||
using k8s.Models;
|
||||
using k8s.Autorest;
|
||||
using k8s.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -42,8 +42,7 @@ namespace k8s.Tests
|
||||
/// <summary>
|
||||
/// Verify that the client can request execution of a command in a pod's default container, with only the STDOUT stream enabled.
|
||||
/// </summary>
|
||||
/// <returns><placeholder>A <see cref="Task"/> representing the asynchronous unit test.</placeholder></returns>
|
||||
/// <returns><placeholder>A <see cref="Task"/> representing the asynchronous unit test.</placeholder></returns>
|
||||
/// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
|
||||
[Fact(DisplayName = "Can exec in pod's default container, STDOUT only")]
|
||||
public async Task ExecDefaultContainerStdOut()
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using k8s.Models;
|
||||
using System;
|
||||
using Xunit;
|
||||
using static k8s.Models.ResourceQuantity.SuffixFormat;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using k8s.Tests.Mock;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Net.WebSockets;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using k8s.Tests.Mock;
|
||||
using Xunit;
|
||||
|
||||
namespace k8s.Tests
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using FluentAssertions;
|
||||
using k8s.Authentication;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FluentAssertions;
|
||||
using k8s.Authentication;
|
||||
using Xunit;
|
||||
|
||||
namespace k8s.Tests
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Xunit;
|
||||
using AutoMapper;
|
||||
using FluentAssertions;
|
||||
using k8s.Versioning;
|
||||
using AutoMapper;
|
||||
using Xunit;
|
||||
|
||||
namespace k8s.Tests
|
||||
{
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
using k8s.Models;
|
||||
using k8s.Tests.Mock;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Nito.AsyncEx;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -7,10 +11,6 @@ using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using k8s.Models;
|
||||
using k8s.Tests.Mock;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Nito.AsyncEx;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using k8s.Autorest;
|
||||
using k8s.Tests.Logging;
|
||||
using k8s.Tests.Mock.Server;
|
||||
using Microsoft.AspNetCore;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using k8s.Autorest;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.WebSockets;
|
||||
@@ -107,7 +107,7 @@ namespace k8s.Tests
|
||||
/// <summary>
|
||||
/// Configure logging for the test server.
|
||||
/// </summary>
|
||||
/// <param name="services">
|
||||
/// <param name="logging">
|
||||
/// The logger factory to configure.
|
||||
/// </param>
|
||||
protected virtual void ConfigureTestServerLogging(ILoggingBuilder logging)
|
||||
@@ -276,9 +276,6 @@ namespace k8s.Tests
|
||||
/// <param name="webSocket">
|
||||
/// The target <see cref="WebSocket"/>.
|
||||
/// </param>
|
||||
/// <param name="text">
|
||||
/// The text to send.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A tuple containing the received text, 0-based substream index, and total bytes received.
|
||||
/// </returns>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
|
||||
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
|
||||
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;
|
||||
|
||||
namespace k8s.E2E
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user