From 064d597b6012a1239662051a84a5588fca3322f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Seif=20Lotfy=20=D8=B3=D9=8A=D9=81=20=D9=84=D8=B7=D9=81?= =?UTF-8?q?=D9=8A?= Date: Fri, 7 Oct 2016 21:17:40 +0200 Subject: [PATCH] Fix runner changes (#135) * Upgrade iron-io/runner to 165c16a9 * fix support for Stdin to work --- api/runner/runner.go | 2 +- api/runner/runner_test.go | 17 +++++++---------- api/runner/task.go | 2 +- api/server/runner.go | 2 +- glide.lock | 2 +- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/api/runner/runner.go b/api/runner/runner.go index a7da57a98..059b7e6f3 100644 --- a/api/runner/runner.go +++ b/api/runner/runner.go @@ -29,7 +29,7 @@ type Config struct { AppName string Memory uint64 Env map[string]string - Input io.Reader + Stdin io.Reader Stdout io.Writer Stderr io.Writer } diff --git a/api/runner/runner_test.go b/api/runner/runner_test.go index 6bcb54afb..1310484f5 100644 --- a/api/runner/runner_test.go +++ b/api/runner/runner_test.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "fmt" + "strings" "testing" "time" @@ -33,11 +34,9 @@ func TestRunnerHello(t *testing.T) { ID: fmt.Sprintf("hello-%d-%d", i, time.Now().Unix()), Image: test.route.Image, Timeout: 5 * time.Second, - Env: map[string]string{ - "PAYLOAD": test.payload, - }, - Stdout: &stdout, - Stderr: &stderr, + Stdin: strings.NewReader(test.payload), + Stdout: &stdout, + Stderr: &stderr, } result, err := runner.Run(ctx, cfg) @@ -82,11 +81,9 @@ func TestRunnerError(t *testing.T) { ID: fmt.Sprintf("err-%d-%d", i, time.Now().Unix()), Image: test.route.Image, Timeout: 5 * time.Second, - Env: map[string]string{ - "PAYLOAD": test.payload, - }, - Stdout: &stdout, - Stderr: &stderr, + Stdin: strings.NewReader(test.payload), + Stdout: &stdout, + Stderr: &stderr, } result, err := runner.Run(ctx, cfg) diff --git a/api/runner/task.go b/api/runner/task.go index 9d8055ca4..5147ad2db 100644 --- a/api/runner/task.go +++ b/api/runner/task.go @@ -20,7 +20,7 @@ func (t *containerTask) EnvVars() map[string]string { return t.cfg.Env } func (t *containerTask) Input() io.Reader { - return t.cfg.Input + return t.cfg.Stdin } func (t *containerTask) Labels() map[string]string { diff --git a/api/server/runner.go b/api/server/runner.go index b62a8eb28..b1595b820 100644 --- a/api/server/runner.go +++ b/api/server/runner.go @@ -141,7 +141,7 @@ func handleRequest(c *gin.Context, enqueue models.Enqueue) { Stderr: stderr, Env: envVars, Memory: el.Memory, - Input: payload, + Stdin: payload, } var err error diff --git a/glide.lock b/glide.lock index 094e33ee2..003bc82de 100644 --- a/glide.lock +++ b/glide.lock @@ -112,7 +112,7 @@ imports: subpackages: - registry - name: github.com/iron-io/runner - version: 1e9a5d73469d222c859fbd2c54ac99bc1c07f711 + version: 165c16a9bec62628dc8a8f17e4cbdc6f30707366 repo: git@github.com:iron-io/runner.git vcs: git subpackages: