Skip to content

Commit b50dbef

Browse files
author
Tim Hess
authored
Changes to help test steps pass in CI (#88)
Changes to help test steps pass in CI
1 parent 1f90969 commit b50dbef

41 files changed

Lines changed: 797 additions & 1261 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

azure-pipelines.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ jobs:
2828
inputs:
2929
filePath: src/Connectors/EnableGemFire.ps1
3030
arguments: $(PivNetAPIToken)
31+
- task: UseDotNet@2
32+
displayName: 'Use .NET Core sdk'
33+
inputs:
34+
packageType: sdk
35+
version: 2.2.300
36+
installationPath: $(Agent.ToolsDirectory)/dotnet
3137
- task: DotNetCoreCLI@2
3238
inputs:
3339
command: restore
@@ -51,6 +57,12 @@ jobs:
5157
inputs:
5258
filePath: src/Connectors/EnableGemFire.ps1
5359
arguments: $(PivNetAPIToken)
60+
- task: UseDotNet@2
61+
displayName: 'Use .NET Core sdk'
62+
inputs:
63+
packageType: sdk
64+
version: 2.2.300
65+
installationPath: $(Agent.ToolsDirectory)/dotnet
5466
- task: DotNetCoreCLI@2
5567
inputs:
5668
command: restore
@@ -83,13 +95,16 @@ jobs:
8395
inputs:
8496
filePath: src/Connectors/EnableGemFire.ps1
8597
arguments: $(PivNetAPIToken)
98+
- task: UseDotNet@2
99+
displayName: 'Use .NET Core sdk'
100+
inputs:
101+
packageType: sdk
102+
version: 2.2.300
103+
installationPath: $(Agent.ToolsDirectory)/dotnet
86104
- task: DotNetCoreCLI@2
87105
inputs:
88106
command: 'restore'
89-
feedsToUse: 'config'
90-
nugetConfigPath: NuGet.config
91107
projects: 'src/Steeltoe.All.sln'
92-
verbosityRestore: normal
93108
- task: SonarSource.sonarcloud.14d9cde6-c1da-4d55-aa01-2965cd301255.SonarCloudPrepare@1
94109
displayName: 'Prepare analysis on SonarCloud'
95110
inputs:

src/CircuitBreaker/src/HystrixBase/HystrixCommand.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,9 @@ public HystrixCommand(
107107
return base.ExecuteAsync();
108108
}
109109

110-
protected new virtual void Run()
111-
{
112-
_ = RunAsync().GetAwaiter().GetResult();
113-
}
110+
protected new virtual void Run() => RunAsync().GetAwaiter().GetResult();
114111

115-
protected new virtual void RunFallback()
116-
{
117-
_ = RunFallbackAsync().GetAwaiter().GetResult();
118-
}
112+
protected new virtual void RunFallback() => RunFallbackAsync().GetAwaiter().GetResult();
119113

120114
protected override Unit DoRun()
121115
{

src/CircuitBreaker/src/HystrixBase/HystrixRequestLog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public string GetExecutedCommandsAsString()
210210
}
211211
catch (Exception)
212212
{
213-
// logger.error("Failed to create HystrixRequestLog response header string.", e);
213+
// logger.error("Failed to create HystrixRequestLog response header string.", e)
214214
// don't let this cause the entire app to fail so just return "Unknown"
215215
return "Unknown";
216216
}

src/CircuitBreaker/src/HystrixBase/Strategy/Concurrency/HystrixTaskScheduler.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,13 @@ public void Dispose()
108108

109109
public bool IsShutdown => shutdown;
110110

111-
private bool disposed;
112-
113111
protected virtual void Dispose(bool disposing)
114112
{
115-
if (!disposed)
113+
if (disposing)
116114
{
117-
if (disposing)
118-
{
119-
shutdown = true;
120-
121-
Time.WaitUntil(() => { return runningThreads <= 0; }, 500);
122-
}
115+
shutdown = true;
123116

124-
disposed = true;
117+
Time.WaitUntil(() => { return runningThreads <= 0; }, 500);
125118
}
126119
}
127120

src/CircuitBreaker/src/HystrixBase/Util/SemaphoreSlimExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static bool TryAcquire(this SemaphoreSlim sema)
2525
return true;
2626
}
2727

28-
return sema.Wait(1);
28+
return sema.Wait(0);
2929
}
3030
}
3131
}

src/CircuitBreaker/src/HystrixBase/Util/TimerReference.cs

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ public void Run(CancellationToken token)
5151
}
5252
}
5353

54-
private bool disposed = false;
55-
5654
public void Dispose()
5755
{
5856
Dispose(true);
@@ -61,26 +59,16 @@ public void Dispose()
6159

6260
protected virtual void Dispose(bool disposing)
6361
{
64-
if (!disposed)
62+
if (disposing)
6563
{
66-
if (disposing)
64+
if (!_tokenSource.IsCancellationRequested)
6765
{
68-
if (!_tokenSource.IsCancellationRequested)
69-
{
70-
_tokenSource.Cancel();
71-
}
72-
73-
_listener = null;
74-
_timerTask = null;
66+
_tokenSource.Cancel();
7567
}
7668

77-
disposed = true;
69+
_listener = null;
70+
_timerTask = null;
7871
}
7972
}
80-
81-
~TimerReference()
82-
{
83-
Dispose(false);
84-
}
8573
}
8674
}

src/CircuitBreaker/test/HystrixBase.Test/Config/HystrixConfigurationStreamTest.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public HystrixConfigurationStreamTest(ITestOutputHelper output)
4242
}
4343

4444
[Fact]
45+
[Trait("Category", "FlakyOnHostedAgents")]
4546
public void TestStreamHasData()
4647
{
4748
AtomicBoolean commandShowsUp = new AtomicBoolean(false);
@@ -79,12 +80,13 @@ public void TestStreamHasData()
7980
latch.SignalEx();
8081
});
8182

82-
Assert.True(latch.Wait(10000));
83+
Assert.True(latch.Wait(10000), "CountdownEvent was not set!");
8384
Assert.True(commandShowsUp.Value);
8485
Assert.True(threadPoolShowsUp.Value);
8586
}
8687

8788
[Fact]
89+
[Trait("Category", "FlakyOnHostedAgents")]
8890
public void TestTwoSubscribersOneUnsubscribes()
8991
{
9092
CountdownEvent latch1 = new CountdownEvent(1);
@@ -160,6 +162,7 @@ public void TestTwoSubscribersOneUnsubscribes()
160162
}
161163

162164
[Fact]
165+
[Trait("Category", "FlakyOnHostedAgents")]
163166
public void TestTwoSubscribersBothUnsubscribe()
164167
{
165168
CountdownEvent latch1 = new CountdownEvent(1);
@@ -236,6 +239,7 @@ public void TestTwoSubscribersBothUnsubscribe()
236239
}
237240

238241
[Fact]
242+
[Trait("Category", "FlakyOnHostedAgents")]
239243
public void TestTwoSubscribersOneSlowOneFast()
240244
{
241245
CountdownEvent latch = new CountdownEvent(1);

0 commit comments

Comments
 (0)