Skip to content

Commit a7b81d5

Browse files
committed
fix
1 parent c5b4775 commit a7b81d5

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

operation/example_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func Example_listOperations() {
1717
defer db.Close(ctx) // cleanup resources
1818
var nextToken string
1919
for i := 0; ; i++ {
20-
operations, err := db.Operation().List(ctx, "scriptexec",
20+
operations, err := db.Operation().List(ctx, "buildindex",
2121
operation.WithPageSize(10),
2222
operation.WithPageToken(nextToken),
2323
)
@@ -29,7 +29,7 @@ func Example_listOperations() {
2929
for _, op := range operations.Operations {
3030
fmt.Println(" -", op)
3131
}
32-
if operations.NextToken == "" {
32+
if len(operations.Operations) == 0 {
3333
break
3434
}
3535
}

tests/integration/operation_test.go

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/ydb-platform/ydb-go-sdk/v3"
1414
"github.com/ydb-platform/ydb-go-sdk/v3/internal/xtest"
1515
"github.com/ydb-platform/ydb-go-sdk/v3/log"
16+
"github.com/ydb-platform/ydb-go-sdk/v3/operation"
1617
"github.com/ydb-platform/ydb-go-sdk/v3/trace"
1718
)
1819

@@ -36,10 +37,21 @@ func TestOperationList(t *testing.T) {
3637
)
3738
require.NoError(t, err)
3839

39-
operations, err := db.Operation().List(ctx, "scriptexec")
40-
require.NoError(t, err)
41-
42-
for _, op := range operations.Operations {
43-
t.Log(op)
40+
var nextToken string
41+
for {
42+
operations, err := db.Operation().List(ctx, "buildindex",
43+
operation.WithPageSize(10),
44+
operation.WithPageToken(nextToken),
45+
)
46+
require.NoError(t, err)
47+
nextToken = operations.NextToken
48+
49+
for _, op := range operations.Operations {
50+
t.Log(op)
51+
}
52+
53+
if len(operations.Operations) == 0 {
54+
break
55+
}
4456
}
4557
}

0 commit comments

Comments
 (0)