Skip to content

Commit 869dcce

Browse files
committed
tests: add environ test
1 parent fae42c4 commit 869dcce

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

environ_test.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package gcpen
2+
3+
import (
4+
"os"
5+
"testing"
6+
)
7+
8+
const (
9+
testProject = "test-project"
10+
testService = "test-service"
11+
testVersion = "test-version"
12+
)
13+
14+
func init() {
15+
os.Setenv(EnvKeyGoogleCloudProject, testProject)
16+
os.Setenv(EnvKeyServiceName, testService)
17+
os.Setenv(EnvKeyServiceVersion, testVersion)
18+
}
19+
20+
func TestEnviron(t *testing.T) {
21+
Reload()
22+
if ProjectID != testProject {
23+
t.Fatalf("unexpected, expected: %s, actual: %#v", testProject, ProjectID)
24+
}
25+
if ServiceName != testService {
26+
t.Fatalf("unexpected, expected: %s, actual: %#v", testService, ServiceName)
27+
}
28+
if ServiceVersion != testVersion {
29+
t.Fatalf("unexpected, expected: %s, actual: %#v", testVersion, ServiceVersion)
30+
}
31+
}

0 commit comments

Comments
 (0)