File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
veinmind-common/go/service/conf Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -5,10 +5,23 @@ import (
55 "testing"
66)
77
8- func TestDefaultClient (t * testing.T ) {
8+ func TestDefaultClient (t * testing.T ) {
99 c := DefaultConfClient ()
10- _ , err := c .Pull (Sensitive )
10+ _ , err := c .Pull (Sensitive )
1111 assert .Error (t , err )
1212}
1313
14+ func TestNewConfService (t * testing.T ) {
15+ s , err := NewConfService ()
16+ if err != nil {
17+ t .Error (err )
18+ }
1419
20+ s .Store (Sensitive , []byte {0x01 })
21+ b , err := s .Pull (Sensitive )
22+ if err != nil {
23+ t .Error (err )
24+ }
25+
26+ assert .Equal (t , b , []byte {0x01 })
27+ }
Original file line number Diff line number Diff line change @@ -19,6 +19,12 @@ type confClient struct {
1919 Pull func (ns PluginConfNS ) ([]byte , error )
2020}
2121
22+ func NewConfService () (* ConfService , error ) {
23+ c := new (ConfService )
24+ c .store = make (map [PluginConfNS ][]byte )
25+ return c , nil
26+ }
27+
2228func (c * ConfService ) Pull (ns PluginConfNS ) ([]byte , error ) {
2329 if b , ok := c .store [ns ]; ok {
2430 return b , nil
You can’t perform that action at this time.
0 commit comments