From 40fd21ca62b13686d4f3a841bfe220db5034f7ee Mon Sep 17 00:00:00 2001 From: Jordan Pittier Date: Thu, 26 Jun 2025 10:15:19 +0200 Subject: [PATCH 1/2] pkg/common/utils.go: update regionalLocationFmt for Europe with 10+ regions GCP now offers more than 10 regions in Europe. Update the regex accordingly. --- pkg/common/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/common/utils.go b/pkg/common/utils.go index b15181b34..8c0ff049e 100644 --- a/pkg/common/utils.go +++ b/pkg/common/utils.go @@ -71,7 +71,7 @@ const ( // Example: us multiRegionalLocationFmt = "^[a-z]+$" // Example: us-east1 - regionalLocationFmt = "^[a-z]+-[a-z]+[0-9]$" + regionalLocationFmt = "^[a-z]+-[a-z]+[0-9]+$" // Full or partial URL of the machine type resource, in the format: // zones/zone/machineTypes/machine-type From b8ca4f6ca5fda174266fd9dee41ac286367a4943 Mon Sep 17 00:00:00 2001 From: Jordan Pittier Date: Thu, 26 Jun 2025 16:48:00 +0200 Subject: [PATCH 2/2] Add unit test --- pkg/common/utils.go | 2 +- pkg/common/utils_test.go | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/common/utils.go b/pkg/common/utils.go index 8c0ff049e..b5b22713e 100644 --- a/pkg/common/utils.go +++ b/pkg/common/utils.go @@ -71,7 +71,7 @@ const ( // Example: us multiRegionalLocationFmt = "^[a-z]+$" // Example: us-east1 - regionalLocationFmt = "^[a-z]+-[a-z]+[0-9]+$" + regionalLocationFmt = "^[a-z]+-[a-z]+[0-9]{1,2}$" // Full or partial URL of the machine type resource, in the format: // zones/zone/machineTypes/machine-type diff --git a/pkg/common/utils_test.go b/pkg/common/utils_test.go index 1d4cef0e3..84fb46370 100644 --- a/pkg/common/utils_test.go +++ b/pkg/common/utils_test.go @@ -804,10 +804,16 @@ func TestSnapshotStorageLocations(t *testing.T) { []string{"us-east1"}, false, }, + { + "valid region in large continent", + "europe-west12", + []string{"europe-west12"}, + false, + }, { // Zones are not valid bucket/snapshot locations. "single zone", - "us-east1a", + "us-east1-a", []string{}, true, },