@@ -12,6 +12,7 @@ import (
12
12
"github.com/cschleiden/go-workflows/backend/history"
13
13
"github.com/cschleiden/go-workflows/client"
14
14
"github.com/cschleiden/go-workflows/core"
15
+ "github.com/cschleiden/go-workflows/internal/sync"
15
16
internalwf "github.com/cschleiden/go-workflows/internal/workflow"
16
17
"github.com/cschleiden/go-workflows/worker"
17
18
"github.com/cschleiden/go-workflows/workflow"
@@ -43,6 +44,48 @@ func EndToEndBackendTest(t *testing.T, setup func(options ...backend.BackendOpti
43
44
require .Equal (t , "hello world" , output )
44
45
},
45
46
},
47
+ {
48
+ name : "Workflow_LotsOfActivities" ,
49
+ f : func (t * testing.T , ctx context.Context , c * client.Client , w * worker.Worker , b TestBackend ) {
50
+ a := func (ctx context.Context ) (int , error ) {
51
+ return 42 , nil
52
+ }
53
+
54
+ wf := func (ctx workflow.Context , msg string ) (string , error ) {
55
+ done := 0
56
+
57
+ y := make ([]workflow.SelectCase , 0 )
58
+ for i := 0 ; i < 100 ; i ++ {
59
+ var sc workflow.SelectCase
60
+ sc = workflow .Await [int ](workflow .ExecuteActivity [int ](ctx , workflow.ActivityOptions {}, a ),
61
+ func (ctx sync.Context , f workflow.Future [int ]) {
62
+ done ++
63
+
64
+ // Remove sc from y
65
+ for i , v := range y {
66
+ if v == sc {
67
+ y = append (y [:i ], y [i + 1 :]... )
68
+ break
69
+ }
70
+ }
71
+ })
72
+ y = append (y , sc )
73
+ }
74
+
75
+ for done < 100 {
76
+ workflow .Select (ctx , y ... )
77
+ }
78
+
79
+ return msg + " world" , nil
80
+ }
81
+ register (t , ctx , w , []interface {}{wf }, []interface {}{a })
82
+
83
+ output , err := runWorkflowWithResult [string ](t , ctx , c , wf , "hello" )
84
+
85
+ require .NoError (t , err )
86
+ require .Equal (t , "hello world" , output )
87
+ },
88
+ },
46
89
{
47
90
name : "SimpleWorkflow_ExpectedHistory" ,
48
91
f : func (t * testing.T , ctx context.Context , c * client.Client , w * worker.Worker , b TestBackend ) {
0 commit comments