2019-12-06 00:24:47 +03:00
|
|
|
// Copyright 2019 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package buildenv
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestEnvironmentNextZone(t *testing.T) {
|
2021-09-15 21:25:15 +03:00
|
|
|
env := Environment{
|
|
|
|
VMZones: []string{"texas", "california", "washington"},
|
2019-12-06 00:24:47 +03:00
|
|
|
}
|
2021-09-15 21:25:15 +03:00
|
|
|
wantOneOf := []string{"texas", "california", "washington"}
|
|
|
|
got := env.RandomVMZone()
|
|
|
|
if !containsString(got, wantOneOf) {
|
|
|
|
t.Errorf("got=%q; want %v", got, wantOneOf)
|
2019-12-06 00:24:47 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func containsString(item string, items []string) bool {
|
|
|
|
for _, s := range items {
|
|
|
|
if item == s {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|