Skip to content
Snippets Groups Projects
Commit 72c11d42 authored by scott's avatar scott
Browse files

Fix latest alex comment

parent 2508994f
No related branches found
No related tags found
No related merge requests found
......@@ -237,6 +237,7 @@ func (s *KubernetesRegistryTestSuite) SetupSuite() {
if err := os.Setenv(nameSpaceKey, s.currentPod.GetNamespace()); err != nil {
t.Fatal(err)
}
}
func (s *KubernetesRegistryTestSuite) TestDataChange() {
......
......@@ -33,7 +33,7 @@ import (
type EventListener struct {
client *Client
keyMapLock sync.Mutex
keyMapLock sync.RWMutex
keyMap map[string]struct{}
wg sync.WaitGroup
}
......@@ -157,9 +157,9 @@ func timeSecondDuration(sec int) time.Duration {
// --------> ListenServiceNodeEvent
func (l *EventListener) ListenServiceEvent(key string, listener remoting.DataListener) {
l.keyMapLock.Lock()
l.keyMapLock.RLock()
_, ok := l.keyMap[key]
l.keyMapLock.Unlock()
l.keyMapLock.RUnlock()
if ok {
logger.Warnf("kubernetes-store key %s has already been listened.", key)
return
......
......@@ -19,7 +19,6 @@ package kubernetes
import (
"context"
"fmt"
"strconv"
"sync"
"testing"
......@@ -43,11 +42,10 @@ func TestStore(t *testing.T) {
defer wg.Done()
w, err := s.Watch("key-1", false)
if err != nil {
fmt.Println("watch spec result", err)
return
t.Fatal(err)
}
for e := range w.ResultChan() {
fmt.Printf("consumer %s got %s\n", w.ID(), e.Key)
t.Logf("consumer %s got %s\n", w.ID(), e.Key)
}
}()
}
......@@ -59,11 +57,10 @@ func TestStore(t *testing.T) {
defer wg.Done()
w, err := s.Watch("key", true)
if err != nil {
fmt.Println("watch prefix result", err)
return
t.Fatal(err)
}
for e := range w.ResultChan() {
fmt.Printf("prefix consumer %s got %s\n", w.ID(), e.Key)
t.Logf("prefix consumer %s got %s\n", w.ID(), e.Key)
}
}()
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment