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

Function TestHandleRuntimeInit

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

Source from the content-addressed store, hash-verified

78}
79
80func TestHandleRuntimeInit(t *testing.T) {
81 rtParams := &NewRuntimeParameters{
82 RuntimeID: "aa",
83 ConcurrentMode: false,
84 StreamMode: true,
85 WaitRuntimeAliveTimeout: 3,
86 Resource: &api.Resource{},
87 }
88 rt := NewRuntimeInfo(rtParams)
89 p := &startRuntimeParams{
90 urlParams: url.Values{},
91 warmNotify: make(chan struct{}),
92 }
93
94 rt.SetState(RuntimeStateWarmUp)
95 p.urlParams.Set("initstart", "10")
96 p.urlParams.Set("initdone", "20")
97 go func() {
98 time.Sleep(1 * time.Second)
99 close(rt.runtimeStopChan)
100 }()
101 err := rt.startRuntimeLoop(p)
102 if err != nil ||
103 rt.PreInitTimeMS != 10 ||
104 rt.PostInitTimeMS != 20 ||
105 rt.State != RuntimeStateWarm {
106 t.Errorf("handle runtime init failed. %+v; err %s", rt, err)
107 }
108}
109
110func TestHandleInvokeDone(t *testing.T) {
111 rtParams := &NewRuntimeParameters{

Callers

nothing calls this directly

Calls 6

SetStateMethod · 0.95
startRuntimeLoopMethod · 0.95
NewRuntimeInfoFunction · 0.85
ErrorfMethod · 0.80
SetMethod · 0.65
SleepMethod · 0.65

Tested by

no test coverage detected