state: fix eval list by prefix with * namespace (#13551)
This commit is contained in:
parent
03433dd8af
commit
85908415f9
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
state: Fix listing evaluations from all namespaces
|
||||
```
|
|
@ -3294,7 +3294,8 @@ func evalNamespaceFilter(namespace string) func(interface{}) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
return eval.Namespace != namespace
|
||||
return namespace != structs.AllNamespacesSentinel &&
|
||||
eval.Namespace != namespace
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4636,11 +4636,15 @@ func TestStateStore_EvalsByIDPrefix_Namespaces(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
iter2, err := state.EvalsByIDPrefix(ws, ns2.Name, sharedPrefix, SortDefault)
|
||||
require.NoError(t, err)
|
||||
iter3, err := state.EvalsByIDPrefix(ws, structs.AllNamespacesSentinel, sharedPrefix, SortDefault)
|
||||
require.NoError(t, err)
|
||||
|
||||
evalsNs1 := gatherEvals(iter1)
|
||||
evalsNs2 := gatherEvals(iter2)
|
||||
evalsNs3 := gatherEvals(iter3)
|
||||
require.Len(t, evalsNs1, 1)
|
||||
require.Len(t, evalsNs2, 1)
|
||||
require.Len(t, evalsNs3, 2)
|
||||
|
||||
iter1, err = state.EvalsByIDPrefix(ws, ns1.Name, eval1.ID[:8], SortDefault)
|
||||
require.NoError(t, err)
|
||||
|
|
Loading…
Reference in New Issue