diff options
author | Valery Piashchynski <[email protected]> | 2020-11-26 12:13:53 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-11-26 12:13:53 +0300 |
commit | 073683ebe27131cf8371decdfe309264b8ea2ad6 (patch) | |
tree | 4d5d7c114dbd1bda9a5b68f0fd1ee32b74de8906 | |
parent | b6ade6e91e58f14c874c450201b821a048d4950d (diff) |
Truncate stderr before write, http_reset test config update
-rw-r--r-- | plugins/http/tests/configs/.rr-resetter.yaml | 28 | ||||
-rw-r--r-- | plugins/http/tests/http_test.go | 4 | ||||
-rwxr-xr-x | worker.go | 4 |
3 files changed, 33 insertions, 3 deletions
diff --git a/plugins/http/tests/configs/.rr-resetter.yaml b/plugins/http/tests/configs/.rr-resetter.yaml new file mode 100644 index 00000000..a08bb83f --- /dev/null +++ b/plugins/http/tests/configs/.rr-resetter.yaml @@ -0,0 +1,28 @@ +rpc: + listen: tcp://127.0.0.1:6001 + disabled: false + +server: + command: "php ../../../tests/http/client.php echo pipes" + user: "" + group: "" + env: + "RR_HTTP": "true" + relay: "pipes" + relayTimeout: "20s" + +http: + debug: true + address: 127.0.0.1:8084 + maxRequestSize: 1024 + middleware: [ "" ] + uploads: + forbid: [ ".php", ".exe", ".bat" ] + trustedSubnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] + pool: + numWorkers: 4 + maxJobs: 0 + allocateTimeout: 60s + destroyTimeout: 60s + + diff --git a/plugins/http/tests/http_test.go b/plugins/http/tests/http_test.go index 2c380bf7..28461950 100644 --- a/plugins/http/tests/http_test.go +++ b/plugins/http/tests/http_test.go @@ -107,7 +107,7 @@ func TestHTTPInformerReset(t *testing.T) { assert.NoError(t, err) cfg := &config.Viper{ - Path: "configs/.rr-http.yaml", + Path: "configs/.rr-resetter.yaml", Prefix: "rr", } @@ -219,7 +219,7 @@ func informerTest(t *testing.T) { err = client.Call("informer.Workers", "http", &list) assert.NoError(t, err) - assert.Len(t, list.Workers, 12) + assert.Len(t, list.Workers, 4) } func TestSSL(t *testing.T) { @@ -232,7 +232,6 @@ func (w *WorkerProcess) Wait(ctx context.Context) error { // if process return code > 0, here will be an error from stderr (if presents) if w.stderr.Len() > 0 { err = multierr.Append(err, errors.E(op, errors.Str(w.stderr.String()))) - w.stderr.Truncate(0) } return multierr.Append(err, w.closeRelay()) @@ -307,7 +306,10 @@ func (w *WorkerProcess) Kill() error { func (w *WorkerProcess) Write(p []byte) (int, error) { w.mu.Lock() defer w.mu.Unlock() + // clean all previous messages in the stderr + w.stderr.Truncate(0) w.events.Push(WorkerEvent{Event: EventWorkerLog, Worker: w, Payload: p}) + // write new message w.stderr.Write(p) return len(p), nil |