Skip to content
Draft
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
4 changes: 4 additions & 0 deletions src/KubernetesClient/WebSocketBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Net;

Check failure on line 1 in src/KubernetesClient/WebSocketBuilder.cs

View workflow job for this annotation

GitHub Actions / Dotnet build (ubuntu-latest)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 1 in src/KubernetesClient/WebSocketBuilder.cs

View workflow job for this annotation

GitHub Actions / Dotnet build (ubuntu-latest)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 1 in src/KubernetesClient/WebSocketBuilder.cs

View workflow job for this annotation

GitHub Actions / Dotnet build (ubuntu-latest)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 1 in src/KubernetesClient/WebSocketBuilder.cs

View workflow job for this annotation

GitHub Actions / Dotnet build (ubuntu-latest)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 1 in src/KubernetesClient/WebSocketBuilder.cs

View workflow job for this annotation

GitHub Actions / Dotnet build (windows-latest)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 1 in src/KubernetesClient/WebSocketBuilder.cs

View workflow job for this annotation

GitHub Actions / Dotnet build (windows-latest)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 1 in src/KubernetesClient/WebSocketBuilder.cs

View workflow job for this annotation

GitHub Actions / Dotnet build (macOS-latest)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 1 in src/KubernetesClient/WebSocketBuilder.cs

View workflow job for this annotation

GitHub Actions / Dotnet build (macOS-latest)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 1 in src/KubernetesClient/WebSocketBuilder.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 1 in src/KubernetesClient/WebSocketBuilder.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 1 in src/KubernetesClient/WebSocketBuilder.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 1 in src/KubernetesClient/WebSocketBuilder.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)
using System.Net.WebSockets;
using System.Security.Cryptography.X509Certificates;

Expand All @@ -16,6 +17,9 @@

public WebSocketBuilder()
{
#if NET5_0_OR_GREATER
Options.HttpVersion = HttpVersion.Version20;
#endif
}

public ClientWebSocketOptions Options => WebSocket.Options;
Expand Down
10 changes: 10 additions & 0 deletions tests/KubernetesClient.Tests/KubernetesExecTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using k8s.Tests.Mock;
using System;
using System.Collections.Generic;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
Expand All @@ -13,6 +14,15 @@ namespace k8s.Tests
{
public class KubernetesExecTests
{
#if NET5_0_OR_GREATER
[Fact]
public void WebSocketBuilderUsesHttp2ByDefault()
{
var builder = new WebSocketBuilder();
Assert.Equal(HttpVersion.Version20, builder.Options.HttpVersion);
}
#endif

/// <summary>
/// Tests the <see cref="Kubernetes.WebSocketNamespacedPodExecWithHttpMessagesAsync(string, string, string, string, bool, bool, bool, bool, Dictionary{string, List{string}}, CancellationToken)"/>
/// method. Changes the <see cref="WebSocketBuilder"/> used by the client with a mock builder, so this test never hits the network.
Expand Down
Loading