mirror of
https://github.com/status-im/consul.git
synced 2025-02-16 15:47:21 +00:00
Returns a zero index for a lookup error case.
This commit is contained in:
parent
049da2cef2
commit
533e6fc89e
@ -200,7 +200,7 @@ func (s *StateStore) PreparedQueryLookup(queryIDOrName string) (uint64, *structs
|
||||
// but we check it here to be explicit about it (we'd never want to
|
||||
// return the results from the first query w/o a name).
|
||||
if queryIDOrName == "" {
|
||||
return idx, nil, ErrMissingQueryID
|
||||
return 0, nil, ErrMissingQueryID
|
||||
}
|
||||
|
||||
// Try first by ID if it looks like they gave us an ID. We check the
|
||||
|
@ -376,8 +376,15 @@ func TestStateStore_PreparedQueryLookup(t *testing.T) {
|
||||
|
||||
// Make sure an empty lookup is well-behaved if there are actual queries
|
||||
// in the state store.
|
||||
if _, _, err = s.PreparedQueryLookup(""); err != ErrMissingQueryID {
|
||||
t.Fatalf("bad: %v", err)
|
||||
idx, actual, err = s.PreparedQueryLookup("")
|
||||
if err != ErrMissingQueryID {
|
||||
t.Fatalf("bad: %v ", err)
|
||||
}
|
||||
if idx != 0 {
|
||||
t.Fatalf("bad index: %d", idx)
|
||||
}
|
||||
if actual != nil {
|
||||
t.Fatalf("bad: %v", actual)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user