mirror of
https://github.com/safing/portbase
synced 2025-09-01 18:19:57 +00:00
Fix runtime registry error condition
This commit is contained in:
parent
ab21e88ae9
commit
fa7410375c
2 changed files with 3 additions and 3 deletions
|
@ -147,7 +147,7 @@ func (r *Registry) Register(keyOrPrefix string, p ValueProvider) (PushFunc, erro
|
||||||
func (r *Registry) Get(key string) (record.Record, error) {
|
func (r *Registry) Get(key string) (record.Record, error) {
|
||||||
provider := r.getMatchingProvider(key)
|
provider := r.getMatchingProvider(key)
|
||||||
if provider == nil {
|
if provider == nil {
|
||||||
return nil, nil
|
return nil, database.ErrNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
records, err := provider.Get(key)
|
records, err := provider.Get(key)
|
||||||
|
|
|
@ -89,11 +89,11 @@ func TestRegistryGet(t *testing.T) {
|
||||||
assert.Equal(t, "p1.3", r.(*testRecord).Value)
|
assert.Equal(t, "p1.3", r.(*testRecord).Value)
|
||||||
|
|
||||||
r, err = reg.Get("p1/v4")
|
r, err = reg.Get("p1/v4")
|
||||||
require.NoError(t, err)
|
require.Error(t, err)
|
||||||
assert.Nil(t, r)
|
assert.Nil(t, r)
|
||||||
|
|
||||||
r, err = reg.Get("no-provider/foo")
|
r, err = reg.Get("no-provider/foo")
|
||||||
require.NoError(t, err)
|
require.Error(t, err)
|
||||||
assert.Nil(t, r)
|
assert.Nil(t, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue