feat: add scoped workflow instance queries and SDK pagination
This commit is contained in:
27
weave/instance/query_test.go
Normal file
27
weave/instance/query_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package instance
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"git.yuntuo.hk/k2safe/orbit/platform/auth"
|
||||
)
|
||||
|
||||
func TestListBoundary(t *testing.T) {
|
||||
store := &captureStore{}
|
||||
api := New(store)
|
||||
if _, err := api.List(context.Background(), auth.Token{}, ListInput{}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
now := time.Now().UTC().Truncate(time.Microsecond)
|
||||
for _, in := range []ListInput{{Limit: -1}, {Limit: 101}, {Cursor: strings.Repeat("x", 1025)}, {DefinitionID: "bad"}, {Version: "v1"}, {DefinitionID: "11111111111111111111111111111111", Version: "../v1"}, {State: "STOPPED"}, {BusinessKey: "\xff"}, {BusinessKey: "nul\x00"}, {BusinessKey: strings.Repeat("中", 192)}, {CreatedFrom: &now, CreatedBefore: &now}} {
|
||||
if _, err := api.List(context.Background(), auth.Token{}, in); err == nil {
|
||||
t.Fatal("invalid query accepted", in)
|
||||
}
|
||||
}
|
||||
if store.calls != 1 {
|
||||
t.Fatal("invalid query reached store")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user