github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/pkg/gce/gce_test.go (about)

     1  // Copyright 2024 syzkaller project authors. All rights reserved.
     2  // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  package gce
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/stretchr/testify/assert"
    10  )
    11  
    12  func TestValidateZone(t *testing.T) {
    13  	assert.True(t, validateZone("us-west1-b"))
    14  	assert.True(t, validateZone("us-central1-a"))
    15  	assert.False(t, validateZone("us-central1"))
    16  }
    17  
    18  func TestZoneToRegion(t *testing.T) {
    19  	assert.Equal(t, "us-west1", zoneToRegion("us-west1-b"))
    20  	assert.Equal(t, "northamerica-northeast2", zoneToRegion("northamerica-northeast2-a"))
    21  }