xiaobaicai66695 commented on code in PR #3601:
URL: https://github.com/apache/dubbo-go/pull/3601#discussion_r3734368530


##########
registry/servicediscovery/store/cache_manager_test.go:
##########
@@ -150,3 +154,125 @@ func TestMetaInfoCacheManager(t *testing.T) {
        cm2.destroy()
        cm.destroy() // clear cache file
 }
+
+func TestCacheManagerConcurrentAccess(t *testing.T) {
+       cacheFile := filepath.Join(t.TempDir(), "race_cache")
+       cm, err := NewCacheManager("raceTest", cacheFile, time.Millisecond, 32, 
true)
+       if err != nil {
+               t.Fatalf("failed to create cache manager: %v", err)
+       }
+       defer cm.destroy()
+
+       runConcurrentCacheAccess(cm)

Review Comment:
   我理解了你的意思,经过review,现在测试代码中的问题是assertCacheEntries方法中的检查逻辑有点偷懒
   ```go
   if value == nil {
       t.Fatalf("reloaded cache entry %q contained a nil value", key)
   }
   if _, ok := value.(string); !ok {
       t.Fatalf("reloaded cache entry %q had unexpected type %T", key, value)
   }
   ```
   只对值和类型做了检验
   我新增测试补齐原来测试覆盖盲区
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to