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

Function TestRuntimeInfo

pkg/controller/rtctrl/runtimeinfo_test.go:56–78  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

54}
55
56func TestRuntimeInfo(t *testing.T) {
57 rtParams := &NewRuntimeParameters{
58 RuntimeID: "aa",
59 ConcurrentMode: false,
60 StreamMode: false,
61 WaitRuntimeAliveTimeout: 3,
62 Resource: &api.Resource{},
63 }
64 rtInfo := NewRuntimeInfo(rtParams)
65 if rtInfo.RuntimeID != "aa" || rtInfo.State != RuntimeStateClosed {
66 t.Errorf("runtime mismatch id = %s, status = %s", rtInfo.RuntimeID, rtInfo.State)
67 }
68 rtInfo.SetInitTime(1, 2)
69 rtInfo.SetLoadTime(3, 4)
70 if rtInfo.PreInitTimeMS != 1 ||
71 rtInfo.PostInitTimeMS != 2 ||
72 rtInfo.PreLoadTimeMS != 3 ||
73 rtInfo.PostLoadTimeMS != 4 {
74 t.Errorf("runtime time mismatch. init[%d-%d], load[%d-%d]",
75 rtInfo.PreInitTimeMS, rtInfo.PostInitTimeMS,
76 rtInfo.PreLoadTimeMS, rtInfo.PostLoadTimeMS)
77 }
78}
79
80func TestHandleRuntimeInit(t *testing.T) {
81 rtParams := &NewRuntimeParameters{

Callers

nothing calls this directly

Calls 4

SetInitTimeMethod · 0.95
SetLoadTimeMethod · 0.95
NewRuntimeInfoFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected