@@ -89,7 +89,7 @@ func TestRunFunction(t *testing.T) {
89
89
Results : []* fnv1beta1.Result {
90
90
{
91
91
Severity : fnv1beta1 .Severity_SEVERITY_NORMAL ,
92
- Message : "Delaying creation of resource \" third\" because \" first\" is not fully ready (0 of 1)" ,
92
+ Message : "Delaying creation of resource(s) matching \" third\" because \" first\" is not fully ready (0 of 1)" ,
93
93
},
94
94
},
95
95
Desired : & fnv1beta1.State {
@@ -142,7 +142,7 @@ func TestRunFunction(t *testing.T) {
142
142
Results : []* fnv1beta1.Result {
143
143
{
144
144
Severity : fnv1beta1 .Severity_SEVERITY_NORMAL ,
145
- Message : "Delaying creation of resource \" second\" because \" first\" does not exist yet" ,
145
+ Message : "Delaying creation of resource(s) matching \" second\" because \" first\" does not exist yet" ,
146
146
},
147
147
},
148
148
Desired : & fnv1beta1.State {
@@ -197,7 +197,7 @@ func TestRunFunction(t *testing.T) {
197
197
Results : []* fnv1beta1.Result {
198
198
{
199
199
Severity : fnv1beta1 .Severity_SEVERITY_NORMAL ,
200
- Message : "Delaying creation of resource \" second\" because \" first\" is not fully ready (0 of 1)" ,
200
+ Message : "Delaying creation of resource(s) matching \" second\" because \" first\" is not fully ready (0 of 1)" ,
201
201
},
202
202
},
203
203
Desired : & fnv1beta1.State {
@@ -383,11 +383,11 @@ func TestRunFunction(t *testing.T) {
383
383
Results : []* fnv1beta1.Result {
384
384
{
385
385
Severity : fnv1beta1 .Severity_SEVERITY_NORMAL ,
386
- Message : "Delaying creation of resource \" second\" because \" first\" is not fully ready (0 of 1)" ,
386
+ Message : "Delaying creation of resource(s) matching \" second\" because \" first\" is not fully ready (0 of 1)" ,
387
387
},
388
388
{
389
389
Severity : fnv1beta1 .Severity_SEVERITY_NORMAL ,
390
- Message : "Delaying creation of resource \" fourth\" because \" third\" is not fully ready (0 of 1)" ,
390
+ Message : "Delaying creation of resource(s) matching \" fourth\" because \" third\" is not fully ready (0 of 1)" ,
391
391
},
392
392
},
393
393
Desired : & fnv1beta1.State {
@@ -528,7 +528,7 @@ func TestRunFunction(t *testing.T) {
528
528
Results : []* fnv1beta1.Result {
529
529
{
530
530
Severity : fnv1beta1 .Severity_SEVERITY_NORMAL ,
531
- Message : "Delaying creation of resource \" second\" because \" first\" is not fully ready (0 of 1)" ,
531
+ Message : "Delaying creation of resource(s) matching \" second\" because \" first\" is not fully ready (0 of 1)" ,
532
532
},
533
533
},
534
534
Desired : & fnv1beta1.State {
@@ -597,7 +597,7 @@ func TestRunFunction(t *testing.T) {
597
597
Results : []* fnv1beta1.Result {
598
598
{
599
599
Severity : fnv1beta1 .Severity_SEVERITY_NORMAL ,
600
- Message : "Delaying creation of resource \" second\" because \" first-.*\" is not fully ready (2 of 3)" ,
600
+ Message : "Delaying creation of resource(s) matching \" second\" because \" first-.*\" is not fully ready (2 of 3)" ,
601
601
},
602
602
},
603
603
Desired : & fnv1beta1.State {
@@ -679,7 +679,7 @@ func TestRunFunction(t *testing.T) {
679
679
Results : []* fnv1beta1.Result {
680
680
{
681
681
Severity : fnv1beta1 .Severity_SEVERITY_NORMAL ,
682
- Message : "Delaying creation of resource \" third\" because \" second-.*\" is not fully ready (1 of 2)" ,
682
+ Message : "Delaying creation of resource(s) matching \" third\" because \" second-.*\" is not fully ready (1 of 2)" ,
683
683
},
684
684
},
685
685
Desired : & fnv1beta1.State {
@@ -761,7 +761,7 @@ func TestRunFunction(t *testing.T) {
761
761
Results : []* fnv1beta1.Result {
762
762
{
763
763
Severity : fnv1beta1 .Severity_SEVERITY_NORMAL ,
764
- Message : "Delaying creation of resource \" third\" because \" second-.*\" is not fully ready (1 of 2)" ,
764
+ Message : "Delaying creation of resource(s) matching \" third\" because \" second-.*\" is not fully ready (1 of 2)" ,
765
765
},
766
766
},
767
767
Desired : & fnv1beta1.State {
@@ -785,6 +785,84 @@ func TestRunFunction(t *testing.T) {
785
785
},
786
786
},
787
787
},
788
+ "SequenceRegexWaitComplex" : {
789
+ reason : "The function should not modify the sequence regex, since it's already prefixed" ,
790
+ args : args {
791
+ req : & fnv1beta1.RunFunctionRequest {
792
+ Input : resource .MustStructObject (& v1beta1.Input {
793
+ Rules : []v1beta1.SequencingRule {
794
+ {
795
+ Sequence : []resource.Name {
796
+ "first-.*" ,
797
+ "second$" ,
798
+ "third-resource" ,
799
+ },
800
+ },
801
+ },
802
+ }),
803
+ Observed : & fnv1beta1.State {
804
+ Composite : & fnv1beta1.Resource {
805
+ Resource : resource .MustStructJSON (xr ),
806
+ },
807
+ Resources : map [string ]* fnv1beta1.Resource {},
808
+ },
809
+ Desired : & fnv1beta1.State {
810
+ Composite : & fnv1beta1.Resource {
811
+ Resource : resource .MustStructJSON (xr ),
812
+ },
813
+ Resources : map [string ]* fnv1beta1.Resource {
814
+ "first-0" : {
815
+ Resource : resource .MustStructJSON (mr ),
816
+ Ready : fnv1beta1 .Ready_READY_TRUE ,
817
+ },
818
+ "first-1" : {
819
+ Resource : resource .MustStructJSON (mr ),
820
+ Ready : fnv1beta1 .Ready_READY_FALSE ,
821
+ },
822
+ "0-second" : {
823
+ Resource : resource .MustStructJSON (mr ),
824
+ },
825
+ "1-second" : {
826
+ Resource : resource .MustStructJSON (mr ),
827
+ },
828
+ "third-resource" : {
829
+ Resource : resource .MustStructJSON (mr ),
830
+ },
831
+ },
832
+ },
833
+ },
834
+ },
835
+ want : want {
836
+ rsp : & fnv1beta1.RunFunctionResponse {
837
+ Meta : & fnv1beta1.ResponseMeta {Ttl : durationpb .New (response .DefaultTTL )},
838
+ Results : []* fnv1beta1.Result {
839
+ {
840
+ Severity : fnv1beta1 .Severity_SEVERITY_NORMAL ,
841
+ Message : "Delaying creation of resource(s) matching \" second$\" because \" first-.*\" is not fully ready (1 of 2)" ,
842
+ },
843
+ {
844
+ Severity : fnv1beta1 .Severity_SEVERITY_NORMAL ,
845
+ Message : "Delaying creation of resource(s) matching \" third-resource\" because \" first-.*\" is not fully ready (1 of 2)" ,
846
+ },
847
+ },
848
+ Desired : & fnv1beta1.State {
849
+ Composite : & fnv1beta1.Resource {
850
+ Resource : resource .MustStructJSON (xr ),
851
+ },
852
+ Resources : map [string ]* fnv1beta1.Resource {
853
+ "first-0" : {
854
+ Resource : resource .MustStructJSON (mr ),
855
+ Ready : fnv1beta1 .Ready_READY_TRUE ,
856
+ },
857
+ "first-1" : {
858
+ Resource : resource .MustStructJSON (mr ),
859
+ Ready : fnv1beta1 .Ready_READY_FALSE ,
860
+ },
861
+ },
862
+ },
863
+ },
864
+ },
865
+ },
788
866
"SequenceRegexAlreadyPrefixed" : {
789
867
reason : "The function should not modify the sequence regex, since it's already prefixed" ,
790
868
args : args {
@@ -837,7 +915,7 @@ func TestRunFunction(t *testing.T) {
837
915
Results : []* fnv1beta1.Result {
838
916
{
839
917
Severity : fnv1beta1 .Severity_SEVERITY_NORMAL ,
840
- Message : "Delaying creation of resource \" fourth\" because \" third-.*$\" is not fully ready (0 of 1)" ,
918
+ Message : "Delaying creation of resource(s) matching \" fourth\" because \" third-.*$\" is not fully ready (0 of 1)" ,
841
919
},
842
920
},
843
921
Desired : & fnv1beta1.State {
0 commit comments