@@ -100,6 +100,15 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
100100 message = "running testplugin.Noop"
101101 }
102102
103+ doFailS , ok := varStack ["testplugin_fail" ]
104+ if ! ok {
105+ doFailS = "false"
106+ }
107+ doFail , convErr := strconv .ParseBool (doFailS )
108+ if convErr != nil {
109+ doFail = false
110+ }
111+
103112 stack = make (map [string ]interface {})
104113 stack ["Noop" ] = func () (out string ) { // must formally return string even when we return nothing
105114 log .WithField ("partition" , envId ).
@@ -132,6 +141,40 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
132141
133142 return
134143 }
144+ stack ["Test" ] = func () (out string ) { // must formally return string even when we return nothing
145+ log .WithField ("partition" , envId ).
146+ WithField ("level" , infologger .IL_Ops ).
147+ WithField ("rolepath" , call .GetParentRolePath ()).
148+ WithField ("trigger" , call .GetTraits ().Trigger ).
149+ WithField ("await" , call .GetTraits ().Await ).
150+ Infof ("executing testplugin.Test call: %s" , message )
151+
152+ rn := varStack ["run_number" ]
153+ var (
154+ runNumber64 int64
155+ err error
156+ )
157+ runNumber64 , err = strconv .ParseInt (rn , 10 , 32 )
158+ if err != nil {
159+ runNumber64 = 0
160+ }
161+
162+ timeout := callable .AcquireTimeout (TESTPLUGIN_GENERAL_OP_TIMEOUT , varStack , "Test" , envId )
163+ defer log .WithField ("partition" , envId ).
164+ WithField ("level" , infologger .IL_Ops ).
165+ WithField ("rolepath" , call .GetParentRolePath ()).
166+ WithField ("trigger" , call .GetTraits ().Trigger ).
167+ WithField ("await" , call .GetTraits ().Await ).
168+ WithField ("runNumber" , runNumber64 ).
169+ Infof ("executed testplugin.Test call in %s" , timeout )
170+
171+ time .Sleep (timeout )
172+ if doFail {
173+ call .VarStack ["__call_error" ] = "error triggered in testplugin.Test call"
174+ }
175+
176+ return
177+ }
135178
136179 return
137180}
0 commit comments