aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/gce/gce_test.go
blob: 82da75a350673e0c537033b899c9caab5aeabe14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2024 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

package gce

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestValidateZone(t *testing.T) {
	assert.True(t, validateZone("us-west1-b"))
	assert.True(t, validateZone("us-central1-a"))
	assert.False(t, validateZone("us-central1"))
}

func TestZoneToRegion(t *testing.T) {
	assert.Equal(t, "us-west1", zoneToRegion("us-west1-b"))
	assert.Equal(t, "northamerica-northeast2", zoneToRegion("northamerica-northeast2-a"))
}

func TestDiskSizeGB(t *testing.T) {
	assert.Equal(t, 10, diskSizeGB("c4a-standard-2"))
	assert.Equal(t, 0, diskSizeGB("e2-standard-2"))
}