@@ -244,7 +244,7 @@ func TestInsertComplexeWorkflowAndExport(t *testing.T) {
244
244
Conditions : sdk.WorkflowNodeConditions {
245
245
PlainConditions : []sdk.WorkflowNodeCondition {
246
246
sdk.WorkflowNodeCondition {
247
- Operator : "= " ,
247
+ Operator : "eq " ,
248
248
Value : "master" ,
249
249
Variable : ".git.branch" ,
250
250
},
@@ -261,7 +261,7 @@ func TestInsertComplexeWorkflowAndExport(t *testing.T) {
<
10000
/code>
261
261
Conditions : sdk.WorkflowNodeConditions {
262
262
PlainConditions : []sdk.WorkflowNodeCondition {
263
263
sdk.WorkflowNodeCondition {
264
- Operator : "= " ,
264
+ Operator : "eq " ,
265
265
Value : "master" ,
266
266
Variable : ".git.branch" ,
267
267
},
@@ -282,7 +282,7 @@ func TestInsertComplexeWorkflowAndExport(t *testing.T) {
282
282
Conditions : sdk.WorkflowNodeConditions {
283
283
PlainConditions : []sdk.WorkflowNodeCondition {
284
284
sdk.WorkflowNodeCondition {
285
- Operator : "= " ,
285
+ Operator : "eq " ,
286
286
Value : "master" ,
287
287
Variable : ".git.branch" ,
288
288
},
@@ -319,6 +319,123 @@ func TestInsertComplexeWorkflowAndExport(t *testing.T) {
319
319
fmt .Println (string (btes ))
320
320
}
321
321
322
+ func TestInsertComplexeWorkflowWithBadOperator (t * testing.T ) {
323
+ db , cache := test .SetupPG (t )
324
+
325
+ u , _ := assets .InsertAdminUser (db )
326
+ key := sdk .RandomString (10 )
327
+ proj := assets .InsertTestProject (t , db , cache , key , key , u )
328
+
329
+ pip1 := sdk.Pipeline {
330
+ ProjectID : proj .ID ,
331
+ ProjectKey : proj .Key ,
332
+ Name : "pip1" ,
333
+ Type : sdk .BuildPipeline ,
334
+ }
335
+
336
+ test .NoError (t , pipeline .InsertPipeline (db , cache , proj , & pip1 , u ))
337
+
338
+ pip2 := sdk.Pipeline {
339
+ ProjectID : proj .ID ,
340
+ ProjectKey : proj .Key ,
341
+ Name : "pip2" ,
342
+ Type : sdk .BuildPipeline ,
343
+ }
344
+
345
+ test .NoError (t , pipeline .InsertPipeline (db , cache , proj , & pip2 , u ))
346
+
347
+ pip3 := sdk.Pipeline {
348
+ ProjectID : proj .ID ,
349
+ ProjectKey : proj .Key ,
350
+ Name : "pip3" ,
351
+ Type : sdk .BuildPipeline ,
352
+ }
353
+
354
+ test .NoError (t , pipeline .InsertPipeline (db , cache , proj , & pip3 , u ))
355
+
356
+ pip4 := sdk.Pipeline {
357
+ ProjectID : proj .ID ,
358
+ ProjectKey : proj .Key ,
359
+ Name : "pip4" ,
360
+ Type : sdk .BuildPipeline ,
361
+ }
362
+
363
+ test .NoError (t , pipeline .InsertPipeline (db , cache , proj , & pip4 , u ))
364
+
365
+ proj , _ = project .LoadByID (db , cache , proj .ID , u , project .LoadOptions .WithApplications , project .LoadOptions .WithPipelines , project .LoadOptions .WithEnvironments , project .LoadOptions .WithGroups )
366
+
367
+ w := sdk.Workflow {
368
+ Name : "test_1" ,
369
+ ProjectID : proj .ID ,
370
+ ProjectKey : proj .Key ,
371
+ Root : & sdk.WorkflowNode {
372
+ Name : "Root" ,
373
+ PipelineID : pip1 .ID ,
374
+ PipelineName : pip1 .Name ,
375
+ Triggers : []sdk.WorkflowNodeTrigger {
376
+ sdk.WorkflowNodeTrigger {
377
+ WorkflowDestNode : sdk.WorkflowNode {
378
+ Name : "First" ,
379
+ PipelineID : pip2 .ID ,
380
+ PipelineName : pip2 .Name ,
381
+ Context : & sdk.WorkflowNodeContext {
382
+ Conditions : sdk.WorkflowNodeConditions {
383
+ PlainConditions : []sdk.WorkflowNodeCondition {
384
+ sdk.WorkflowNodeCondition {
385
+ Operator : "=" ,
386
+ Value : "master" ,
387
+ Variable : ".git.branch" ,
388
+ },
389
+ },
390
+ },
391
+ },
392
+ Triggers : []sdk.WorkflowNodeTrigger {
393
+ sdk.WorkflowNodeTrigger {
394
+ WorkflowDestNode : sdk.WorkflowNode {
395
+ Name : "Second" ,
396
+ PipelineID : pip3 .ID ,
397
+ PipelineName : pip3 .Name ,
398
+ Context : & sdk.WorkflowNodeContext {
399
+ Conditions : sdk.WorkflowNodeConditions {
400
+ PlainConditions : []sdk.WorkflowNodeCondition {
401
+ sdk.WorkflowNodeCondition {
402
+ Operator : "=" ,
403
+ Value : "master" ,
404
+ Variable : ".git.branch" ,
405
+ },
406
+ },
407
+ },
408
+ },
409
+ },
410
+ },
411
+ },
412
+ },
413
+ },
414
+ sdk.WorkflowNodeTrigger {
415
+ WorkflowDestNode : sdk.WorkflowNode {
416
+ Name : "Last" ,
417
+ PipelineID : pip4 .ID ,
418
+ PipelineName : pip4 .Name ,
419
+ Context : & sdk.WorkflowNodeContext {
420
+ Conditions : sdk.WorkflowNodeConditions {
421
+ PlainConditions : []sdk.WorkflowNodeCondition {
422
+ sdk.WorkflowNodeCondition {
423
+ Operator : "=" ,
424
+ Value : "master" ,
425
+ Variable : ".git.branch" ,
426
+ },
427
+ },
428
+ },
429
+ },
430
+ },
431
+ },
432
+ },
433
+ },
434
+ }
435
+
436
+ assert .Error (t , workflow .Insert (db , cache , & w , proj , u ))
437
+ }
438
+
322
439
func assertEqualNode (t * testing.T , n1 , n2 * sdk.WorkflowNode ) {
323
440
t .Logf ("assertEqualNode : %d(%s) on %s" , n2 .ID , n2 .Ref , n2 .PipelineName )
324
441
workflow .SortNode (n1 )
@@ -541,7 +658,7 @@ func TestInsertComplexeWorkflowWithJoinsAndExport(t *testing.T) {
541
658
Conditions : sdk.WorkflowNodeConditions {
542
659
PlainConditions : []sdk.WorkflowNodeCondition {
543
660
sdk.WorkflowNodeCondition {
544
- Operator : "= " ,
661
+ Operator : "eq " ,
545
662
Value : "master" ,
546
663
Variable : ".git.branch" ,
547
664
},
@@ -558,7 +675,7 @@ func TestInsertComplexeWorkflowWithJoinsAndExport(t *testing.T) {
558
675
Conditions : sdk.WorkflowNodeConditions {
559
676
PlainConditions : []sdk.WorkflowNodeCondition {
560
677
sdk.WorkflowNodeCondition {
561
- Operator : "= " ,
678
+ Operator : "eq " ,
562
679
Value : "master" ,
563
680
Variable : ".git.branch" ,
564
681
},
@@ -575,7 +692,7 @@ func TestInsertComplexeWorkflowWithJoinsAndExport(t *testing.T) {
575
692
Conditions : sdk.WorkflowNodeConditions {
576
693
PlainConditions : []sdk.WorkflowNodeCondition {
577
694
sdk.WorkflowNodeCondition {
578
- Operator : "= " ,
695
+ Operator : "eq " ,
579
696
Value : "master" ,
580
697
Variable : ".git.branch" ,
581
698
},
@@ -606,7 +723,7 @@ func TestInsertComplexeWorkflowWithJoinsAndExport(t *testing.T) {
606
723
Conditions : sdk.WorkflowNodeConditions {
607
724
PlainConditions : []sdk.WorkflowNodeCondition {
608
725
sdk.WorkflowNodeCondition {
609
- Operator : "= " ,
726
+ Operator : "eq " ,
610
727
Value : "master" ,
611
728
Variable : ".git.branch" ,
612
729
},
@@ -768,7 +885,7 @@ func TestInsertComplexeWorkflowWithComplexeJoins(t *testing.T) {
768
885
Conditions : sdk.WorkflowNodeConditions {
769
886
PlainConditions : []sdk.WorkflowNodeCondition {
770
887
sdk.WorkflowNodeCondition {
771
- Operator : "= " ,
888
+ Operator : "eq " ,
772
889
Value : "master" ,
773
890
Variable : ".git.branch" ,
774
891
},
@@ -785,7 +902,7 @@ func TestInsertComplexeWorkflowWithComplexeJoins(t *testing.T) {
785
902
Conditions : sdk.WorkflowNodeConditions {
786
903
PlainConditions : []sdk.WorkflowNodeCondition {
787
904
sdk.WorkflowNodeCondition {
788
- Operator : "= " ,
905
+ Operator : "eq " ,
789
906
Value : "master" ,
790
907
Variable : ".git.branch" ,
791
908
},
@@ -802,7 +919,7 @@ func TestInsertComplexeWorkflowWithComplexeJoins(t *testing.T) {
802
919
Conditions : sdk.WorkflowNodeConditions {
803
920
PlainConditions : []sdk.WorkflowNodeCondition {
804
921
sdk.WorkflowNodeCondition {
805
- Operator : "= " ,
922
+ Operator : "eq " ,
806
923
Value : "master" ,
807
924
Variable : ".git.branch" ,
808
925
},
@@ -834,7 +951,7 @@ func TestInsertComplexeWorkflowWithComplexeJoins(t *testing.T) {
834
951
Conditions : sdk.WorkflowNodeConditions {
835
952
PlainConditions : []sdk.WorkflowNodeCondition {
836
953
sdk.WorkflowNodeCondition {
837
- Operator : "= " ,
954
+ Operator : "eq " ,
838
955
Value : "master" ,
839
956
Variable : ".git.branch" ,
840
957
},
@@ -852,7 +969,7 @@ func TestInsertComplexeWorkflowWithComplexeJoins(t *testing.T) {
852
969
Conditions : sdk.WorkflowNodeConditions {
853
970
PlainConditions : []sdk.WorkflowNodeCondition {
854
971
sdk.WorkflowNodeCondition {
855
- Operator : "= " ,
972
+ Operator : "eq " ,
856
973
Value : "master" ,
857
974
Variable : ".git.branch" ,
858
975
},
@@ -876,7 +993,7 @@ func TestInsertComplexeWorkflowWithComplexeJoins(t *testing.T) {
876
993
Conditions : sdk.WorkflowNodeConditions {
877
994
PlainConditions : []sdk.WorkflowNodeCondition {
878
995
sdk.WorkflowNodeCondition {
879
- Operator : "= " ,
996
+ Operator : "eq " ,
880
997
Value : "master" ,
881
998
Variable : ".git.branch" ,
882
999
},
@@ -1079,7 +1196,7 @@ func TestInsertSimpleWorkflowWithHookAndExport(t *testing.T) {
1079
1196
Conditions : sdk.WorkflowNodeConditions {
1080
1197
PlainConditions : []sdk.WorkflowNodeCondition {
1081
1198
sdk.WorkflowNodeCondition {
1082
- Operator : "= " ,
1199
+ Operator : "eq " ,
1083
1200
Value : "master" ,
1084
1201
Variable : ".git.branch" ,
1085
1202
},
0 commit comments