MCPcopy Create free account
hub / github.com/golang/appengine / SetTestEnv

Function SetTestEnv

internal/api_common.go:116–141  ·  view source on GitHub ↗

SetTestEnv sets the env variables for testing background ticket in Flex.

()

Source from the content-addressed store, hash-verified

114
115// SetTestEnv sets the env variables for testing background ticket in Flex.
116func SetTestEnv() func() {
117 var environ = []struct {
118 key, value string
119 }{
120 {"GAE_LONG_APP_ID", "my-app-id"},
121 {"GAE_MINOR_VERSION", "067924799508853122"},
122 {"GAE_MODULE_INSTANCE", "0"},
123 {"GAE_MODULE_NAME", "default"},
124 {"GAE_MODULE_VERSION", "20150612t184001"},
125 }
126
127 for _, v := range environ {
128 old := os.Getenv(v.key)
129 os.Setenv(v.key, v.value)
130 v.value = old
131 }
132 return func() { // Restore old environment after the test completes.
133 for _, v := range environ {
134 if v.value == "" {
135 os.Unsetenv(v.key)
136 continue
137 }
138 os.Setenv(v.key, v.value)
139 }
140 }
141}

Callers 2

TestBasicAPICallsFunction · 0.92

Calls

no outgoing calls

Tested by 2

TestBasicAPICallsFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…