Skip to content

Commit b8ca4f6

Browse files
committed
Add unit test
1 parent 40fd21c commit b8ca4f6

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

pkg/common/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const (
7171
// Example: us
7272
multiRegionalLocationFmt = "^[a-z]+$"
7373
// Example: us-east1
74-
regionalLocationFmt = "^[a-z]+-[a-z]+[0-9]+$"
74+
regionalLocationFmt = "^[a-z]+-[a-z]+[0-9]{1,2}$"
7575

7676
// Full or partial URL of the machine type resource, in the format:
7777
// zones/zone/machineTypes/machine-type

pkg/common/utils_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,10 +804,16 @@ func TestSnapshotStorageLocations(t *testing.T) {
804804
[]string{"us-east1"},
805805
false,
806806
},
807+
{
808+
"valid region in large continent",
809+
"europe-west12",
810+
[]string{"europe-west12"},
811+
false,
812+
},
807813
{
808814
// Zones are not valid bucket/snapshot locations.
809815
"single zone",
810-
"us-east1a",
816+
"us-east1-a",
811817
[]string{},
812818
true,
813819
},

0 commit comments

Comments
 (0)