forked from rosa/hakurei
internal/kobject: pass action kind for range
Useful for handling most uevents. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -388,7 +388,9 @@ func TestIter(t *testing.T) {
|
||||
"SEQNUM=1",
|
||||
}}
|
||||
synctest.Wait()
|
||||
s.Range(t.Context(), func(o *Object) bool { return false })
|
||||
s.Range(t.Context(), func(*Object, uevent.KobjectAction) bool {
|
||||
return false
|
||||
})
|
||||
|
||||
var got []*Object
|
||||
check := func(want []*Object) {
|
||||
@@ -405,7 +407,7 @@ func TestIter(t *testing.T) {
|
||||
defer cancel()
|
||||
var done bool
|
||||
wg.Go(func() {
|
||||
s.Range(ctx, func(o *Object) bool {
|
||||
s.Range(ctx, func(o *Object, _ uevent.KobjectAction) bool {
|
||||
got = append(got, o.Clone())
|
||||
return !done
|
||||
})
|
||||
@@ -437,7 +439,11 @@ func TestIter(t *testing.T) {
|
||||
},
|
||||
})
|
||||
|
||||
wg.Go(func() { s.Range(ctx, func(*Object) bool { return true }) })
|
||||
wg.Go(func() {
|
||||
s.Range(ctx, func(*Object, uevent.KobjectAction) bool {
|
||||
return true
|
||||
})
|
||||
})
|
||||
synctest.Wait()
|
||||
|
||||
iter := reflect.ValueOf(s).Elem().FieldByName("iter")
|
||||
|
||||
Reference in New Issue
Block a user