@@ -602,3 +602,31 @@ func TestResolveAttributes(t *testing.T) {
602602 })
603603 }
604604}
605+
606+ // An older server sends neither residency_warning_regions nor project_data_region.
607+ // The advisory must then be inert rather than erroring or prompting, so a new CLI
608+ // keeps working against a server that predates it.
609+ func TestConfirmRegionResidencyWithoutServerSettings (t * testing.T ) {
610+ settingsMap := map [string ]string {"available_regions" : "us-east,eu-central" }
611+ warnRegions := splitSetting (settingsMap ["residency_warning_regions" ])
612+ require .Empty (t , warnRegions )
613+
614+ err := confirmRegionResidency (& cli.Command {}, "eu-central" ,
615+ settingsMap ["project_data_region" ], warnRegions )
616+ require .NoError (t , err )
617+ }
618+
619+ // An EU project gets the param with an empty value; it must behave like absent.
620+ func TestConfirmRegionResidencyWithEmptyWarningRegions (t * testing.T ) {
621+ warnRegions := splitSetting ("" )
622+ require .Empty (t , warnRegions )
623+ require .NoError (t , confirmRegionResidency (& cli.Command {}, "eu-central" , "eu" , warnRegions ))
624+ }
625+
626+ // A flagged region without a TTY (or with --yes) warns and proceeds rather than
627+ // blocking, so existing automation deploying into the EU keeps working.
628+ func TestConfirmRegionResidencyProceedsWhenPromptsSkipped (t * testing.T ) {
629+ warnRegions := splitSetting ("eu-central" )
630+ require .Equal (t , []string {"eu-central" }, warnRegions )
631+ require .NoError (t , confirmRegionResidency (& cli.Command {}, "eu-central" , "us" , warnRegions ))
632+ }
0 commit comments