mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
[Feature] Function status
This commit is contained in:
@@ -18,6 +18,8 @@ import (
|
||||
"gitlab-odx.oracle.com/odx/functions/api/models"
|
||||
"gitlab-odx.oracle.com/odx/functions/api/mqs"
|
||||
"gitlab-odx.oracle.com/odx/functions/api/runner/task"
|
||||
"gitlab-odx.oracle.com/odx/functions/api/datastore"
|
||||
"gitlab-odx.oracle.com/odx/functions/api/runner/drivers"
|
||||
)
|
||||
|
||||
func setLogBuffer() *bytes.Buffer {
|
||||
@@ -198,6 +200,15 @@ func testRunner(t *testing.T) (*Runner, context.CancelFunc) {
|
||||
return r, cancel
|
||||
}
|
||||
|
||||
type RunResult struct {
|
||||
drivers.RunResult
|
||||
}
|
||||
|
||||
func (r RunResult) Status() string {
|
||||
return "success"
|
||||
}
|
||||
|
||||
|
||||
func TestAsyncRunnersGracefulShutdown(t *testing.T) {
|
||||
buf := setLogBuffer()
|
||||
mockTask := getMockTask()
|
||||
@@ -211,16 +222,15 @@ func TestAsyncRunnersGracefulShutdown(t *testing.T) {
|
||||
go func() {
|
||||
for t := range tasks {
|
||||
t.Response <- task.Response{
|
||||
Result: nil,
|
||||
Result: RunResult{},
|
||||
Err: nil,
|
||||
}
|
||||
|
||||
}
|
||||
}()
|
||||
|
||||
rnr, cancel := testRunner(t)
|
||||
defer cancel()
|
||||
startAsyncRunners(ctx, ts.URL+"/tasks", tasks, rnr)
|
||||
startAsyncRunners(ctx, ts.URL+"/tasks", tasks, rnr, datastore.NewMock())
|
||||
|
||||
if err := ctx.Err(); err != context.DeadlineExceeded {
|
||||
t.Log(buf.String())
|
||||
|
||||
Reference in New Issue
Block a user