@@ -39,8 +39,9 @@ import (
39
39
)
40
40
41
41
const (
42
- testBufSize = 1024 * 1024
43
- testSocket = "/tmp/dapr.socket"
42
+ testBufSize = 1024 * 1024
43
+ testSocket = "/tmp/dapr.socket"
44
+ testWorkflowFailureID = "test_failure_id"
44
45
)
45
46
46
47
var testClient Client
@@ -500,6 +501,62 @@ func (s *testDaprServer) UnsubscribeConfiguration(ctx context.Context, in *pb.Un
500
501
return & pb.UnsubscribeConfigurationResponse {Ok : true }, nil
501
502
}
502
503
504
+ func (s * testDaprServer ) StartWorkflowBeta1 (ctx context.Context , in * pb.StartWorkflowRequest ) (* pb.StartWorkflowResponse , error ) {
505
+ if in .GetInstanceId () == testWorkflowFailureID {
506
+ return nil , errors .New ("test failure" )
507
+ }
508
+ return & pb.StartWorkflowResponse {
509
+ InstanceId : in .GetInstanceId (),
510
+ }, nil
511
+ }
512
+
513
+ func (s * testDaprServer ) GetWorkflowBeta1 (ctx context.Context , in * pb.GetWorkflowRequest ) (* pb.GetWorkflowResponse , error ) {
514
+ if in .GetInstanceId () == testWorkflowFailureID {
515
+ return nil , errors .New ("test failure" )
516
+ }
517
+ return & pb.GetWorkflowResponse {
518
+ InstanceId : in .GetInstanceId (),
519
+ WorkflowName : "TestWorkflowName" ,
520
+ RuntimeStatus : "Running" ,
521
+ Properties : make (map [string ]string ),
522
+ }, nil
523
+ }
524
+
525
+ func (s * testDaprServer ) PurgeWorkflowBeta1 (ctx context.Context , in * pb.PurgeWorkflowRequest ) (* emptypb.Empty , error ) {
526
+ if in .GetInstanceId () == testWorkflowFailureID {
527
+ return nil , errors .New ("test failure" )
528
+ }
529
+ return & emptypb.Empty {}, nil
530
+ }
531
+
532
+ func (s * testDaprServer ) TerminateWorkflowBeta1 (ctx context.Context , in * pb.TerminateWorkflowRequest ) (* emptypb.Empty , error ) {
533
+ if in .GetInstanceId () == testWorkflowFailureID {
534
+ return nil , errors .New ("test failure" )
535
+ }
536
+ return & emptypb.Empty {}, nil
537
+ }
538
+
539
+ func (s * testDaprServer ) PauseWorkflowBeta1 (ctx context.Context , in * pb.PauseWorkflowRequest ) (* emptypb.Empty , error ) {
540
+ if in .GetInstanceId () == testWorkflowFailureID {
541
+ return nil , errors .New ("test failure" )
542
+ }
543
+ return & emptypb.Empty {}, nil
544
+ }
545
+
546
+ func (s * testDaprServer ) ResumeWorkflowBeta1 (ctx context.Context , in * pb.ResumeWorkflowRequest ) (* emptypb.Empty , error ) {
547
+ if in .GetInstanceId () == testWorkflowFailureID {
548
+ return nil , errors .New ("test failure" )
549
+ }
550
+ return & emptypb.Empty {}, nil
551
+ }
552
+
553
+ func (s * testDaprServer ) RaiseEventWorkflowBeta1 (ctx context.Context , in * pb.RaiseEventWorkflowRequest ) (* emptypb.Empty , error ) {
554
+ if in .GetInstanceId () == testWorkflowFailureID {
555
+ return nil , errors .New ("test failure" )
556
+ }
557
+ return & emptypb.Empty {}, nil
558
+ }
559
+
503
560
func TestGrpcClient (t * testing.T ) {
504
561
protoClient := pb .NewDaprClient (nil )
505
562
client := & GRPCClient {protoClient : protoClient }
0 commit comments