From 206f8f0a2b868f480789e5166f0e96b500906b10 Mon Sep 17 00:00:00 2001
From: cvictory <shenglicao2@gmail.com>
Date: Wed, 16 Sep 2020 15:21:21 +0800
Subject: [PATCH] add test for clear all address

---
 registry/directory/directory_test.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/registry/directory/directory_test.go b/registry/directory/directory_test.go
index 6c85ea08f..e02cff64a 100644
--- a/registry/directory/directory_test.go
+++ b/registry/directory/directory_test.go
@@ -214,6 +214,10 @@ func Test_RefreshUrl(t *testing.T) {
 		&registry.ServiceEvent{Action: remoting.EventTypeAdd, Service: providerUrl2}})
 	time.Sleep(1e9)
 	assert.Len(t, registryDirectory.cacheInvokers, 2)
+	// clear all address
+	mockRegistry.MockEvents([]*registry.ServiceEvent{})
+	time.Sleep(1e9)
+	assert.Len(t, registryDirectory.cacheInvokers, 0)
 }
 
 func normalRegistryDir(noMockEvent ...bool) (*RegistryDirectory, *registry.MockRegistry) {
-- 
GitLab