@@ -716,6 +716,55 @@ void main() {
716716 'FLUTTER_ROOT' : _kFlutterRoot,
717717 'SWARMING_TASK_ID' : '12345678990' ,
718718 'GOLDCTL' : 'goldctl' ,
719+ 'GIT_BRANCH' : 'master' ,
720+ },
721+ operatingSystem: 'macos' ,
722+ );
723+ expect (
724+ FlutterPostSubmitFileComparator .isAvailableForEnvironment (platform),
725+ isTrue,
726+ );
727+ });
728+
729+ test ('returns false on release branches in postsubmit' , () {
730+ platform = FakePlatform (
731+ environment: < String , String > {
732+ 'FLUTTER_ROOT' : _kFlutterRoot,
733+ 'SWARMING_TASK_ID' : 'sweet task ID' ,
734+ 'GOLDCTL' : 'some/path' ,
735+ 'GIT_BRANCH' : 'flutter-3.16-candidate.0' ,
736+ },
737+ operatingSystem: 'macos' ,
738+ );
739+ expect (
740+ FlutterPostSubmitFileComparator .isAvailableForEnvironment (platform),
741+ isFalse,
742+ );
743+ });
744+
745+ test ('returns true on master branch in postsubmit' , () {
746+ platform = FakePlatform (
747+ environment: < String , String > {
748+ 'FLUTTER_ROOT' : _kFlutterRoot,
749+ 'SWARMING_TASK_ID' : 'sweet task ID' ,
750+ 'GOLDCTL' : 'some/path' ,
751+ 'GIT_BRANCH' : 'master' ,
752+ },
753+ operatingSystem: 'macos' ,
754+ );
755+ expect (
756+ FlutterPostSubmitFileComparator .isAvailableForEnvironment (platform),
757+ isTrue,
758+ );
759+ });
760+
761+ test ('returns true on main branch in postsubmit' , () {
762+ platform = FakePlatform (
763+ environment: < String , String > {
764+ 'FLUTTER_ROOT' : _kFlutterRoot,
765+ 'SWARMING_TASK_ID' : 'sweet task ID' ,
766+ 'GOLDCTL' : 'some/path' ,
767+ 'GIT_BRANCH' : 'main' ,
719768 },
720769 operatingSystem: 'macos' ,
721770 );
@@ -828,13 +877,65 @@ void main() {
828877 });
829878
830879 group ('correctly determines testing environment' , () {
880+ test ('returns false on release branches in presubmit' , () {
881+ platform = FakePlatform (
882+ environment: < String , String > {
883+ 'FLUTTER_ROOT' : _kFlutterRoot,
884+ 'SWARMING_TASK_ID' : 'sweet task ID' ,
885+ 'GOLDCTL' : 'some/path' ,
886+ 'GOLD_TRYJOB' : 'true' ,
887+ 'GIT_BRANCH' : 'flutter-3.16-candidate.0' ,
888+ },
889+ operatingSystem: 'macos' ,
890+ );
891+ expect (
892+ FlutterPreSubmitFileComparator .isAvailableForEnvironment (platform),
893+ isFalse,
894+ );
895+ });
896+
897+ test ('returns true on master branch in presubmit' , () {
898+ platform = FakePlatform (
899+ environment: < String , String > {
900+ 'FLUTTER_ROOT' : _kFlutterRoot,
901+ 'SWARMING_TASK_ID' : 'sweet task ID' ,
902+ 'GOLDCTL' : 'some/path' ,
903+ 'GOLD_TRYJOB' : 'true' ,
904+ 'GIT_BRANCH' : 'master' ,
905+ },
906+ operatingSystem: 'macos' ,
907+ );
908+ expect (
909+ FlutterPreSubmitFileComparator .isAvailableForEnvironment (platform),
910+ isTrue,
911+ );
912+ });
913+
914+ test ('returns true on main branch in presubmit' , () {
915+ platform = FakePlatform (
916+ environment: < String , String > {
917+ 'FLUTTER_ROOT' : _kFlutterRoot,
918+ 'SWARMING_TASK_ID' : 'sweet task ID' ,
919+ 'GOLDCTL' : 'some/path' ,
920+ 'GOLD_TRYJOB' : 'true' ,
921+ 'GIT_BRANCH' : 'main' ,
922+ },
923+ operatingSystem: 'macos' ,
924+ );
925+ expect (
926+ FlutterPreSubmitFileComparator .isAvailableForEnvironment (platform),
927+ isTrue,
928+ );
929+ });
930+
831931 test ('returns true for Luci' , () {
832932 platform = FakePlatform (
833933 environment: < String , String > {
834934 'FLUTTER_ROOT' : _kFlutterRoot,
835935 'SWARMING_TASK_ID' : '12345678990' ,
836936 'GOLDCTL' : 'goldctl' ,
837937 'GOLD_TRYJOB' : 'git/ref/12345/head' ,
938+ 'GIT_BRANCH' : 'master' ,
838939 },
839940 operatingSystem: 'macos' ,
840941 );
@@ -908,6 +1009,39 @@ void main() {
9081009
9091010 group ('Skipping' , () {
9101011 group ('correctly determines testing environment' , () {
1012+ test ('returns true on release branches in presubmit' , () {
1013+ platform = FakePlatform (
1014+ environment: < String , String > {
1015+ 'FLUTTER_ROOT' : _kFlutterRoot,
1016+ 'SWARMING_TASK_ID' : 'sweet task ID' ,
1017+ 'GOLDCTL' : 'some/path' ,
1018+ 'GOLD_TRYJOB' : 'true' ,
1019+ 'GIT_BRANCH' : 'flutter-3.16-candidate.0' ,
1020+ },
1021+ operatingSystem: 'macos' ,
1022+ );
1023+ expect (
1024+ FlutterSkippingFileComparator .isAvailableForEnvironment (platform),
1025+ isTrue,
1026+ );
1027+ });
1028+
1029+ test ('returns true on release branches in postsubmit' , () {
1030+ platform = FakePlatform (
1031+ environment: < String , String > {
1032+ 'FLUTTER_ROOT' : _kFlutterRoot,
1033+ 'SWARMING_TASK_ID' : 'sweet task ID' ,
1034+ 'GOLDCTL' : 'some/path' ,
1035+ 'GIT_BRANCH' : 'flutter-3.16-candidate.0' ,
1036+ },
1037+ operatingSystem: 'macos' ,
1038+ );
1039+ expect (
1040+ FlutterSkippingFileComparator .isAvailableForEnvironment (platform),
1041+ isTrue,
1042+ );
1043+ });
1044+
9111045 test ('returns true on Cirrus builds' , () {
9121046 platform = FakePlatform (
9131047 environment: < String , String > {
@@ -936,16 +1070,15 @@ void main() {
9361070 );
9371071 });
9381072
939- test ('returns false - no CI' , () {
1073+ test ('returns false - not in CI' , () {
9401074 platform = FakePlatform (
9411075 environment: < String , String > {
9421076 'FLUTTER_ROOT' : _kFlutterRoot,
9431077 },
9441078 operatingSystem: 'macos' ,
9451079 );
9461080 expect (
947- FlutterSkippingFileComparator .isAvailableForEnvironment (
948- platform),
1081+ FlutterSkippingFileComparator .isAvailableForEnvironment (platform),
9491082 isFalse,
9501083 );
9511084 });
0 commit comments