@@ -32,7 +32,8 @@ public async Task GetSetResponseEntry()
3232 {
3333 //注意:redis所在系统时间与运行测试所在系统时间有误差时,会导致测试无法通过
3434 var duration = 2 ;
35- var key = "ResponseCacheTestKey" ;
35+ var testId = Guid . NewGuid ( ) ;
36+ var key = $ "ResponseCacheTestKey-{ testId } ";
3637 var contentType = "application/json; charset=utf-8" ;
3738 var body = Encoding . UTF8 . GetBytes ( SimResponseContent ) ;
3839 var entry = new ResponseCacheEntry ( contentType , body , duration ) ;
@@ -62,11 +63,12 @@ public virtual async Task InitAsync()
6263 public async Task ParallelGetSetResponseEntry ( )
6364 {
6465 //注意:redis所在系统时间与运行测试所在系统时间有误差时,会导致测试无法通过
65- var duration = 1 ;
66+ var duration = 2 ;
67+ var testId = Guid . NewGuid ( ) ;
6668
6769 var tasks = Enumerable . Range ( 0 , 500 ) . Select ( async index =>
6870 {
69- var key = $ "ResponseCacheTestKey_ { index } ";
71+ var key = $ "ResponseCacheTestKey- { testId } _ { index } ";
7072 var contentType = $ "application/json; charset=utf-8; idx={ index } ";
7173 var body = Encoding . UTF8 . GetBytes ( $ "{ SimResponseContent } _{ index } ") ;
7274 var entry = new ResponseCacheEntry ( contentType , body , duration ) ;
@@ -77,7 +79,7 @@ public async Task ParallelGetSetResponseEntry()
7779
7880 TestUtil . EntryEquals ( entry , cachedEntry ) ;
7981
80- await Task . Delay ( TimeSpan . FromSeconds ( duration + 1 ) ) ;
82+ await Task . Delay ( TimeSpan . FromSeconds ( duration + 2 ) ) ;
8183
8284 cachedEntry = await ResponseCache . GetAsync ( key , CancellationToken . None ) ;
8385
0 commit comments