mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fn: I/O related improvements (#809)
*) I/O protocol parse issues should shutdown the container as the container goes to inconsistent state between calls. (eg. next call may receive previous calls left overs.) *) Move ghost read/write code into io_utils in common. *) Clean unused error from docker Wait() *) We can catch one case in JSON, if there's remaining unparsed data in decoder buffer, we can shut the container *) stdout/stderr when container is not handling a request are now blocked if freezer is also enabled. *) if a fatal err is set for slot, we do not requeue it and proceed to shutdown *) added a test function for a few cases with freezer strict behavior
This commit is contained in:
@@ -384,7 +384,7 @@ type waitResult struct {
|
||||
}
|
||||
|
||||
// waitResult implements drivers.WaitResult
|
||||
func (w *waitResult) Wait(ctx context.Context) (drivers.RunResult, error) {
|
||||
func (w *waitResult) Wait(ctx context.Context) drivers.RunResult {
|
||||
defer close(w.done)
|
||||
|
||||
// wait until container is stopped (or ctx is cancelled if sooner)
|
||||
@@ -392,7 +392,7 @@ func (w *waitResult) Wait(ctx context.Context) (drivers.RunResult, error) {
|
||||
return &runResult{
|
||||
status: status,
|
||||
err: err,
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
// Repeatedly collect stats from the specified docker container until the stopSignal is closed or the context is cancelled
|
||||
|
||||
@@ -56,9 +56,9 @@ func TestRunnerDocker(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
result, err := waiter.Wait(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
result := waiter.Wait(ctx)
|
||||
if result.Error() != nil {
|
||||
t.Fatal(result.Error())
|
||||
}
|
||||
|
||||
if result.Status() != "success" {
|
||||
@@ -109,9 +109,9 @@ func TestRunnerDockerStdin(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
result, err := waiter.Wait(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
result := waiter.Wait(ctx)
|
||||
if result.Error() != nil {
|
||||
t.Fatal(result.Error())
|
||||
}
|
||||
|
||||
if result.Status() != "success" {
|
||||
|
||||
Reference in New Issue
Block a user