Fix runner changes (#135)

* Upgrade iron-io/runner to 165c16a9

* fix support for Stdin to work
This commit is contained in:
Seif Lotfy سيف لطفي
2016-10-07 21:17:40 +02:00
committed by C Cirello
parent 1da3c7c7cf
commit 064d597b60
5 changed files with 11 additions and 14 deletions

View File

@@ -29,7 +29,7 @@ type Config struct {
AppName string AppName string
Memory uint64 Memory uint64
Env map[string]string Env map[string]string
Input io.Reader Stdin io.Reader
Stdout io.Writer Stdout io.Writer
Stderr io.Writer Stderr io.Writer
} }

View File

@@ -4,6 +4,7 @@ import (
"bytes" "bytes"
"context" "context"
"fmt" "fmt"
"strings"
"testing" "testing"
"time" "time"
@@ -33,11 +34,9 @@ func TestRunnerHello(t *testing.T) {
ID: fmt.Sprintf("hello-%d-%d", i, time.Now().Unix()), ID: fmt.Sprintf("hello-%d-%d", i, time.Now().Unix()),
Image: test.route.Image, Image: test.route.Image,
Timeout: 5 * time.Second, Timeout: 5 * time.Second,
Env: map[string]string{ Stdin: strings.NewReader(test.payload),
"PAYLOAD": test.payload, Stdout: &stdout,
}, Stderr: &stderr,
Stdout: &stdout,
Stderr: &stderr,
} }
result, err := runner.Run(ctx, cfg) 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()), ID: fmt.Sprintf("err-%d-%d", i, time.Now().Unix()),
Image: test.route.Image, Image: test.route.Image,
Timeout: 5 * time.Second, Timeout: 5 * time.Second,
Env: map[string]string{ Stdin: strings.NewReader(test.payload),
"PAYLOAD": test.payload, Stdout: &stdout,
}, Stderr: &stderr,
Stdout: &stdout,
Stderr: &stderr,
} }
result, err := runner.Run(ctx, cfg) result, err := runner.Run(ctx, cfg)

View File

@@ -20,7 +20,7 @@ func (t *containerTask) EnvVars() map[string]string {
return t.cfg.Env return t.cfg.Env
} }
func (t *containerTask) Input() io.Reader { func (t *containerTask) Input() io.Reader {
return t.cfg.Input return t.cfg.Stdin
} }
func (t *containerTask) Labels() map[string]string { func (t *containerTask) Labels() map[string]string {

View File

@@ -141,7 +141,7 @@ func handleRequest(c *gin.Context, enqueue models.Enqueue) {
Stderr: stderr, Stderr: stderr,
Env: envVars, Env: envVars,
Memory: el.Memory, Memory: el.Memory,
Input: payload, Stdin: payload,
} }
var err error var err error

2
glide.lock generated
View File

@@ -112,7 +112,7 @@ imports:
subpackages: subpackages:
- registry - registry
- name: github.com/iron-io/runner - name: github.com/iron-io/runner
version: 1e9a5d73469d222c859fbd2c54ac99bc1c07f711 version: 165c16a9bec62628dc8a8f17e4cbdc6f30707366
repo: git@github.com:iron-io/runner.git repo: git@github.com:iron-io/runner.git
vcs: git vcs: git
subpackages: subpackages: