@@ -35,6 +35,7 @@ import (
35
35
"github.com/stretchr/testify/mock"
36
36
"google.golang.org/grpc/codes"
37
37
"google.golang.org/grpc/status"
38
+ "google.golang.org/protobuf/types/known/durationpb"
38
39
)
39
40
40
41
type MockHTTPClient struct {
@@ -501,6 +502,64 @@ func TestHydrateNode(t *testing.T) {
501
502
})
502
503
}
503
504
505
+ func TestHydrateGateNode (t * testing.T ) {
506
+ t .Run ("Hydrate Sleep" , func (t * testing.T ) {
507
+ registerFilesSetup ()
508
+ // Write a node that contains a GateNode
509
+ node := & core.Node {
510
+ Target : & core.Node_GateNode {
511
+ GateNode : & core.GateNode {
512
+ Condition : & core.GateNode_Sleep {
513
+ Sleep : & core.SleepCondition {
514
+ Duration : & durationpb.Duration {
515
+ Seconds : 10 ,
516
+ },
517
+ },
518
+ },
519
+ },
520
+ },
521
+ }
522
+ err := hydrateNode (node , rconfig .DefaultFilesConfig .Version , true )
523
+ assert .Nil (t , err )
524
+ })
525
+
526
+ t .Run ("Hydrate Signal" , func (t * testing.T ) {
527
+ registerFilesSetup ()
528
+ // Write a node that contains a GateNode
529
+ node := & core.Node {
530
+ Target : & core.Node_GateNode {
531
+ GateNode : & core.GateNode {
532
+ Condition : & core.GateNode_Signal {
533
+ Signal : & core.SignalCondition {
534
+ SignalId : "abc" ,
535
+ },
536
+ },
537
+ },
538
+ },
539
+ }
540
+ err := hydrateNode (node , rconfig .DefaultFilesConfig .Version , true )
541
+ assert .Nil (t , err )
542
+ })
543
+
544
+ t .Run ("Hydrate Approve" , func (t * testing.T ) {
545
+ registerFilesSetup ()
546
+ // Write a node that contains a GateNode
547
+ node := & core.Node {
548
+ Target : & core.Node_GateNode {
549
+ GateNode : & core.GateNode {
550
+ Condition : & core.GateNode_Approve {
551
+ Approve : & core.ApproveCondition {
552
+ SignalId : "abc" ,
553
+ },
554
+ },
555
+ },
556
+ },
557
+ }
558
+ err := hydrateNode (node , rconfig .DefaultFilesConfig .Version , true )
559
+ assert .Nil (t , err )
560
+ })
561
+ }
562
+
504
563
func TestHydrateTaskSpec (t * testing.T ) {
505
564
testScope := promutils .NewTestScope ()
506
565
labeled .SetMetricKeys (contextutils .AppNameKey , contextutils .ProjectKey , contextutils .DomainKey )
0 commit comments