File tree Expand file tree Collapse file tree 2 files changed +2
-65
lines changed
src/Common/test/Common.Test Expand file tree Collapse file tree 2 files changed +2
-65
lines changed Original file line number Diff line number Diff line change @@ -103,22 +103,7 @@ jobs:
103103# - name: Test (net9.0) (memory dumps)
104104# run: dotnet test ${{ env.SOLUTION_FILE }} --filter "Category=MemoryDumps" --framework net9.0 ${{ env.COMMON_TEST_ARGS }}
105105
106- - name : List recorded dumps (1)
107- if : ${{ failure() }}
108- shell : bash
109- run : ls -alR ${{ github.workspace }}/dumps
110-
111- - name : List recorded dumps (2)
112- if : ${{ failure() }}
113- shell : bash
114- run : ls -lR ${{ github.workspace }}/dumps
115-
116- - name : List recorded dumps (3)
117- if : ${{ failure() }}
118- shell : bash
119- run : tree -if ${{ github.workspace }}/dumps
120-
121- - name : List recorded dumps (4)
106+ - name : List directory with recorded dumps (on failure)
122107 if : ${{ failure() }}
123108 shell : bash
124109 run : find ${{ github.workspace }}/dumps -type f
Original file line number Diff line number Diff line change 66
77namespace Steeltoe . Common . Test ;
88
9- public sealed class TestHostCrashTest : IDisposable
9+ public sealed class TestHostCrashTest
1010{
11- private readonly List < byte [ ] > _memory = [ ] ;
12-
1311 [ Fact ]
1412 public void CrashWithStackOverflow ( )
1513 {
@@ -20,50 +18,4 @@ public void CrashWithStackOverflow()
2018
2119 true . Should ( ) . BeTrue ( ) ;
2220 }
23-
24- [ Fact ]
25- public void CrashWithOutOfMemory ( )
26- {
27- var thread = new Thread ( AllocateMemory )
28- {
29- IsBackground = false
30- } ;
31-
32- thread . Start ( ) ;
33-
34- while ( DateTime . UtcNow . Year < 2099 )
35- {
36- Thread . Sleep ( 250 ) ;
37- }
38-
39- GC . KeepAlive ( thread ) ;
40- }
41-
42- private void AllocateMemory ( )
43- {
44- while ( DateTime . UtcNow . Year < 2099 )
45- {
46- byte [ ] buffer = new byte [ 2147483591 ] ;
47- _memory . Add ( buffer ) ;
48- }
49-
50- GC . KeepAlive ( _memory ) ;
51- }
52-
53- public async void Dispose ( )
54- {
55- var thread = new Thread ( AllocateMemory )
56- {
57- IsBackground = false
58- } ;
59-
60- thread . Start ( ) ;
61-
62- while ( DateTime . UtcNow . Year < 2099 )
63- {
64- Thread . Sleep ( 250 ) ;
65- }
66-
67- GC . KeepAlive ( thread ) ;
68- }
6921}
You can’t perform that action at this time.
0 commit comments