@@ -89,7 +89,7 @@ func TestRunFunction(t *testing.T) {
8989 Results : []* fnv1beta1.Result {
9090 {
9191 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)" ,
9393 },
9494 },
9595 Desired : & fnv1beta1.State {
@@ -142,7 +142,7 @@ func TestRunFunction(t *testing.T) {
142142 Results : []* fnv1beta1.Result {
143143 {
144144 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" ,
146146 },
147147 },
148148 Desired : & fnv1beta1.State {
@@ -197,7 +197,7 @@ func TestRunFunction(t *testing.T) {
197197 Results : []* fnv1beta1.Result {
198198 {
199199 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)" ,
201201 },
202202 },
203203 Desired : & fnv1beta1.State {
@@ -383,11 +383,11 @@ func TestRunFunction(t *testing.T) {
383383 Results : []* fnv1beta1.Result {
384384 {
385385 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)" ,
387387 },
388388 {
389389 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)" ,
391391 },
392392 },
393393 Desired : & fnv1beta1.State {
@@ -528,7 +528,7 @@ func TestRunFunction(t *testing.T) {
528528 Results : []* fnv1beta1.Result {
529529 {
530530 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)" ,
532532 },
533533 },
534534 Desired : & fnv1beta1.State {
@@ -597,7 +597,7 @@ func TestRunFunction(t *testing.T) {
597597 Results : []* fnv1beta1.Result {
598598 {
599599 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)" ,
601601 },
602602 },
603603 Desired : & fnv1beta1.State {
@@ -679,7 +679,7 @@ func TestRunFunction(t *testing.T) {
679679 Results : []* fnv1beta1.Result {
680680 {
681681 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)" ,
683683 },
684684 },
685685 Desired : & fnv1beta1.State {
@@ -761,7 +761,7 @@ func TestRunFunction(t *testing.T) {
761761 Results : []* fnv1beta1.Result {
762762 {
763763 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)" ,
765765 },
766766 },
767767 Desired : & fnv1beta1.State {
@@ -785,6 +785,84 @@ func TestRunFunction(t *testing.T) {
785785 },
786786 },
787787 },
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+ },
788866 "SequenceRegexAlreadyPrefixed" : {
789867 reason : "The function should not modify the sequence regex, since it's already prefixed" ,
790868 args : args {
@@ -837,7 +915,7 @@ func TestRunFunction(t *testing.T) {
837915 Results : []* fnv1beta1.Result {
838916 {
839917 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)" ,
841919 },
842920 },
843921 Desired : & fnv1beta1.State {
0 commit comments