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
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
<PackageVersion Include="MartinCostello.Logging.XUnit" Version="0.7.1" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.7" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.9" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.6.0" />
Comment thread
brendandburns marked this conversation as resolved.
<PackageVersion Include="Microsoft.TestPlatform.ObjectModel" Version="18.6.0" />
<PackageVersion Include="Moq" Version="4.20.72" />
<PackageVersion Include="Nito.AsyncEx" Version="5.1.2" />
<PackageVersion Include="Nito.AsyncEx.Coordination" Version="5.1.2" />
<PackageVersion Include="OpenTelemetry.Exporter.Console" Version="1.16.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.12.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.15.1" />
<PackageVersion Include="Portable.BouncyCastle" Version="1.9.0" />
<PackageVersion Include="SharpZipLib" Version="1.4.2" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="10.2.1" />
Expand All @@ -26,7 +26,7 @@
<PackageVersion Include="System.Reactive" Version="6.1.0" />
<PackageVersion Include="System.Text.Json" Version="10.0.9" />
<PackageVersion Include="Vecc.YamlDotNet.Analyzers.StaticGenerator" Version="18.0.0" />
<PackageVersion Include="Wiremock.Net" Version="1.12.0" />
<PackageVersion Include="Wiremock.Net" Version="2.6.0" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
<PackageVersion Include="Xunit.StaFact" Version="1.2.69" />
Expand Down
9 changes: 4 additions & 5 deletions examples/openTelemetryConsole/openTelemetryConsole.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="OpenTelemetry.Exporter.Console" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" VersionOverride="10.0.7" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="OpenTelemetry.Exporter.Console" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" />
</ItemGroup>

</Project>
11 changes: 5 additions & 6 deletions tests/E2E.Tests/MinikubeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -752,19 +752,18 @@ await clientSet.CoreV1.Pod

// replace + get (retry on conflict due to Kubernetes optimistic concurrency)
{
var retries = 5;
while (retries-- > 0)
const int maxAttempts = 5;
for (var attempt = 1; attempt <= maxAttempts; attempt++)
Comment thread
brendandburns marked this conversation as resolved.
{
var pod = await clientSet.CoreV1.Pod.GetAsync(podName, namespaceParameter).ConfigureAwait(false);
Comment thread
brendandburns marked this conversation as resolved.
Comment thread
brendandburns marked this conversation as resolved.
pod.Spec.Containers[0].Image = "httpd";
try
{
var pod = await clientSet.CoreV1.Pod.GetAsync(podName, namespaceParameter).ConfigureAwait(false);
pod.Spec.Containers[0].Image = "httpd";
await clientSet.CoreV1.Pod.UpdateAsync(pod, podName, namespaceParameter).ConfigureAwait(false);
break;
}
catch (HttpOperationException e) when (e.Response.StatusCode == System.Net.HttpStatusCode.Conflict)
catch (HttpOperationException e) when (e.Response.StatusCode == System.Net.HttpStatusCode.Conflict && attempt < maxAttempts)
{
if (retries == 0) throw;
await Task.Delay(TimeSpan.FromSeconds(1)).ConfigureAwait(false);
}
}
Expand Down
29 changes: 15 additions & 14 deletions tests/KubernetesClient.Tests/LeaderElection/LeaderElectionTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using k8s.LeaderElection;
using Moq;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
Expand Down Expand Up @@ -84,8 +85,8 @@ public void SimpleLeaderElection()
[Fact]
public void LeaderElection()
{
var electionHistory = new List<string>();
var leadershipHistory = new List<string>();
var electionHistory = new ConcurrentQueue<string>();
var leadershipHistory = new ConcurrentQueue<string>();
var electionHistoryCountdown = new CountdownEvent(7);

var renewCountA = 3;
Expand All @@ -95,19 +96,19 @@ public void LeaderElection()
{
renewCountA--;

electionHistory.Add("A creates record");
leadershipHistory.Add("A gets leadership");
electionHistory.Enqueue("A creates record");
leadershipHistory.Enqueue("A gets leadership");
electionHistoryCountdown.Signal();
};

mockLockA.OnUpdate += (_) =>
{
renewCountA--;
electionHistory.Add("A updates record");
electionHistory.Enqueue("A updates record");
electionHistoryCountdown.Signal();
};

mockLockA.OnChange += (_) => { leadershipHistory.Add("A gets leadership"); };
mockLockA.OnChange += (_) => { leadershipHistory.Enqueue("A gets leadership"); };

var leaderElectionConfigA = new LeaderElectionConfig(mockLockA)
{
Expand All @@ -123,19 +124,19 @@ public void LeaderElection()
{
renewCountB--;

electionHistory.Add("B creates record");
electionHistory.Enqueue("B creates record");
electionHistoryCountdown.Signal();
leadershipHistory.Add("B gets leadership");
leadershipHistory.Enqueue("B gets leadership");
};

mockLockB.OnUpdate += (_) =>
{
renewCountB--;
electionHistory.Add("B updates record");
electionHistory.Enqueue("B updates record");
electionHistoryCountdown.Signal();
};

mockLockB.OnChange += (_) => { leadershipHistory.Add("B gets leadership"); };
mockLockB.OnChange += (_) => { leadershipHistory.Enqueue("B gets leadership"); };

var leaderElectionConfigB = new LeaderElectionConfig(mockLockB)
{
Expand All @@ -153,13 +154,13 @@ public void LeaderElection()

leaderElector.OnStartedLeading += () =>
{
leadershipHistory.Add("A starts leading");
leadershipHistory.Enqueue("A starts leading");
testLeaderElectionLatch.Signal();
};

leaderElector.OnStoppedLeading += () =>
{
leadershipHistory.Add("A stops leading");
leadershipHistory.Enqueue("A stops leading");
testLeaderElectionLatch.Signal();
lockAStopLeading.Set();
};
Expand All @@ -176,13 +177,13 @@ public void LeaderElection()

leaderElector.OnStartedLeading += () =>
{
leadershipHistory.Add("B starts leading");
leadershipHistory.Enqueue("B starts leading");
testLeaderElectionLatch.Signal();
};

leaderElector.OnStoppedLeading += () =>
{
leadershipHistory.Add("B stops leading");
leadershipHistory.Enqueue("B stops leading");
testLeaderElectionLatch.Signal();
};

Expand Down
Loading