(t *testing.T)
| 148 | } |
| 149 | |
| 150 | func 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 | |
| 173 | func TestCoolDownRuntime(t *testing.T) { |
| 174 | rtMap := initRuntimeList(2) |
nothing calls this directly
no test coverage detected