Skip to content

Commit

Permalink
Add list of test zones that support f1-micro instances
Browse files Browse the repository at this point in the history
  • Loading branch information
denis256 committed Feb 6, 2023
1 parent cbf3a03 commit 6eb8b3c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions modules/gcp/compute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ const DEFAULT_MACHINE_TYPE = "f1-micro"
const DEFAULT_IMAGE_FAMILY_PROJECT_NAME = "ubuntu-os-cloud"
const DEFAULT_IMAGE_FAMILY_NAME = "family/ubuntu-1804-lts"

// Regions that don't support running f1-micro instances
var RegionsToAvoid = []string{"asia-east2", "southamerica-west1", "europe-west8", "europe-southwest1", "us-east5-a"}
// Zones that support running f1-micro instances
var ZonesThatSupportF1Micro = []string{"us-central1-a", "us-east1-b", "us-west1-a", "europe-north1-a", "europe-west1-b", "europe-central2-a"}

func TestGetPublicIpOfInstance(t *testing.T) {
t.Parallel()

instanceName := RandomValidGcpName()
projectID := GetGoogleProjectIDFromEnvVar(t)
zone := GetRandomZone(t, projectID, nil, nil, RegionsToAvoid)
zone := GetRandomZone(t, projectID, ZonesThatSupportF1Micro, nil, nil)

createComputeInstance(t, projectID, zone, instanceName)
defer deleteComputeInstance(t, projectID, zone, instanceName)
Expand Down Expand Up @@ -77,7 +77,7 @@ func TestGetAndSetLabels(t *testing.T) {
instanceName := RandomValidGcpName()
projectID := GetGoogleProjectIDFromEnvVar(t)

zone := GetRandomZone(t, projectID, nil, nil, RegionsToAvoid)
zone := GetRandomZone(t, projectID, ZonesThatSupportF1Micro, nil, nil)

createComputeInstance(t, projectID, zone, instanceName)
defer deleteComputeInstance(t, projectID, zone, instanceName)
Expand Down Expand Up @@ -113,7 +113,7 @@ func TestGetAndSetMetadata(t *testing.T) {
projectID := GetGoogleProjectIDFromEnvVar(t)
instanceName := RandomValidGcpName()

zone := GetRandomZone(t, projectID, nil, nil, RegionsToAvoid)
zone := GetRandomZone(t, projectID, ZonesThatSupportF1Micro, nil, nil)

// Create a new Compute Instance
createComputeInstance(t, projectID, zone, instanceName)
Expand Down
6 changes: 3 additions & 3 deletions test/gcp/packer_gcp_basic_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ var DefaultRetryablePackerErrors = map[string]string{
}
var DefaultTimeBetweenPackerRetries = 15 * time.Second

// Regions that don't support n1-standard-1 instances
var RegionsToAvoid = []string{"asia-east2", "southamerica-west1", "europe-west8", "europe-southwest1", "us-east5-a"}
// Zones that support running f1-micro instances
var ZonesThatSupportF1Micro = []string{"us-central1-a", "us-east1-b", "us-west1-a", "europe-north1-a", "europe-west1-b", "europe-central2-a"}

const DefaultMaxPackerRetries = 3

Expand All @@ -35,7 +35,7 @@ func TestPackerGCPBasicExample(t *testing.T) {
projectID := gcp.GetGoogleProjectIDFromEnvVar(t)

// Pick a random GCP zone to test in. This helps ensure your code works in all regions.
zone := gcp.GetRandomZone(t, projectID, nil, nil, RegionsToAvoid)
zone := gcp.GetRandomZone(t, projectID, ZonesThatSupportF1Micro, nil, nil)

packerOptions := &packer.Options{
// The path to where the Packer template is located
Expand Down

0 comments on commit 6eb8b3c

Please sign in to comment.