summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2019-10-12 12:37:16 +0300
committerWolfy-J <[email protected]>2019-10-12 12:37:16 +0300
commit5d4a699daa0a3696a5bac04cf5568310ff2b7a5c (patch)
treea9699c63f01de662c3280f0f15185be030899038
parent3589850c4601d4907979a9f996873038de930735 (diff)
- polishing health service tests
- adding auto-CS tools
-rw-r--r--CHANGELOG.md7
-rw-r--r--Makefile1
-rw-r--r--composer.json5
-rw-r--r--service/health/service_test.go3
-rw-r--r--tests/http/slow-client.php46
5 files changed, 59 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 44dc58be..df3f25fe 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,13 @@
CHANGELOG
=========
+v1.5.0 (12.10.2019)
+-------------------
+- initial code style fixes by @ScullWM
+- added health service for better integration with Kubernetes by @awprice
+- added support for payloads in GET methods by @moeinpaki
+- added automatic CS fixer (spiral/code-style)
+
v1.4.8 (06.09.2019)
-------------------
- bugfix in proxy IP resolution by @spudro228
diff --git a/Makefile b/Makefile
index d8200446..c2550a44 100644
--- a/Makefile
+++ b/Makefile
@@ -20,6 +20,7 @@ test:
go test -v -race -cover ./service/limit
go test -v -race -cover ./service/headers
go test -v -race -cover ./service/metrics
+ go test -v -race -cover ./service/health
lint:
go fmt ./...
golint ./... \ No newline at end of file
diff --git a/composer.json b/composer.json
index fd50fa16..47ad6a04 100644
--- a/composer.json
+++ b/composer.json
@@ -28,5 +28,8 @@
},
"bin": [
"bin/rr"
- ]
+ ],
+ "require-dev": {
+ "spiral/code-style": "^1.0"
+ }
}
diff --git a/service/health/service_test.go b/service/health/service_test.go
index 3e86b0bd..7a3b8186 100644
--- a/service/health/service_test.go
+++ b/service/health/service_test.go
@@ -73,7 +73,6 @@ func TestService_Serve(t *testing.T) {
_, res, err := get("http://localhost:2116/")
assert.NoError(t, err)
assert.Equal(t, http.StatusOK, res.StatusCode)
-
}
func TestService_Serve_DeadWorker(t *testing.T) {
@@ -91,7 +90,7 @@ func TestService_Serve_DeadWorker(t *testing.T) {
httpCfg: `{
"address": "localhost:2115",
"workers":{
- "command": "php ../../tests/http/client.php echo pipes",
+ "command": "php ../../tests/http/slow-client.php echo pipes 1000",
"pool": {"numWorkers": 1}
}
}`,
diff --git a/tests/http/slow-client.php b/tests/http/slow-client.php
new file mode 100644
index 00000000..58250dfb
--- /dev/null
+++ b/tests/http/slow-client.php
@@ -0,0 +1,46 @@
+<?php
+
+use Spiral\Goridge;
+use Spiral\RoadRunner;
+
+ini_set('display_errors', 'stderr');
+require dirname(__DIR__) . "/../vendor/autoload.php";
+
+if (count($argv) < 3) {
+ die("need 2 arguments");
+}
+
+list($test, $goridge, $bootDelay) = [$argv[1], $argv[2], $argv[3]];
+usleep($bootDelay * 1000);
+
+switch ($goridge) {
+ case "pipes":
+ $relay = new Goridge\StreamRelay(STDIN, STDOUT);
+ break;
+
+ case "tcp":
+ $relay = new Goridge\SocketRelay("localhost", 9007);
+ break;
+
+ case "unix":
+ $relay = new Goridge\SocketRelay(
+ "sock.unix",
+ null,
+ Goridge\SocketRelay::SOCK_UNIX
+ );
+ break;
+
+ default:
+ die("invalid protocol selection");
+}
+
+$psr7 = new RoadRunner\PSR7Client(new RoadRunner\Worker($relay));
+require_once sprintf("%s/%s.php", __DIR__, $test);
+
+while ($req = $psr7->acceptRequest()) {
+ try {
+ $psr7->respond(handleRequest($req, new \Zend\Diactoros\Response()));
+ } catch (\Throwable $e) {
+ $psr7->getWorker()->error((string)$e);
+ }
+}