MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / TestRuntimeStatistics

Function TestRuntimeStatistics

pkg/controller/rtctrl/runtime_dispatcher_test.go:150–171  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

148}
149
150func TestRuntimeStatistics(t *testing.T) {
151 totalNum := 5
152 rtMap := initRuntimeList(totalNum)
153 rtMapList := rtMap.RuntimeList()
154 t.Logf("runtime list len %d", len(rtMapList))
155 cmID := "xxx"
156 req := &InvocationInput{
157 Configuration: &api.FunctionConfiguration{
158 CommitID: &cmID,
159 PodConcurrentQuota: 4,
160 FunctionConfiguration: lambda.FunctionConfiguration{
161 MemorySize: &minMemory,
162 },
163 },
164 WithStreamMode: false,
165 }
166 rtMap.OccupyColdRuntime(req)
167 cold, inuse, all := rtMap.RuntimeStatistics()
168 assert.Equal(t, cold, totalNum-1)
169 assert.Equal(t, inuse, 1)
170 assert.Equal(t, all, totalNum)
171}
172
173func TestCoolDownRuntime(t *testing.T) {
174 rtMap := initRuntimeList(2)

Callers

nothing calls this directly

Calls 5

initRuntimeListFunction · 0.85
RuntimeListMethod · 0.65
OccupyColdRuntimeMethod · 0.65
RuntimeStatisticsMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected