diff --git a/nginx/Dockerfile b/nginx/Dockerfile index c5ad01a..e1f6c35 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -1,4 +1,5 @@ FROM nginx -RUN rm /etc/nginx/conf.d/default.conf -ADD default.conf /etc/nginx/conf.d/ +RUN rm /etc/nginx/conf.d/default.conf /etc/nginx/nginx.conf +COPY nginx.conf /etc/nginx/ +COPY default.conf /etc/nginx/conf.d/ diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..a4f076c --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,31 @@ +user nginx; +worker_processes 1; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + + +events { + worker_connections 2048; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + include /etc/nginx/conf.d/*.conf; +} diff --git a/tests/Test/BlackBoxTest.php b/tests/Test/BlackBoxTest.php index 0638d82..ff40895 100644 --- a/tests/Test/BlackBoxTest.php +++ b/tests/Test/BlackBoxTest.php @@ -54,18 +54,12 @@ public function gaugShouldBeOverwritten() public function countersShouldIncrementAtomically() { $start = microtime(true); - $promises = [ - $this->client->getAsync('/examples/some_counter.php?c=0'), - $this->client->getAsync('/examples/some_counter.php?c=1'), - $this->client->getAsync('/examples/some_counter.php?c=2'), - $this->client->getAsync('/examples/some_counter.php?c=3'), - $this->client->getAsync('/examples/some_counter.php?c=4'), - $this->client->getAsync('/examples/some_counter.php?c=5'), - $this->client->getAsync('/examples/some_counter.php?c=6'), - $this->client->getAsync('/examples/some_counter.php?c=7'), - $this->client->getAsync('/examples/some_counter.php?c=8'), - $this->client->getAsync('/examples/some_counter.php?c=9'), - ]; + $promises = []; + $sum = 0; + for ($i = 0; $i < 1000; $i++) { + $promises[] = $this->client->getAsync('/examples/some_counter.php?c=' . $i); + $sum += $i; + } Promise\settle($promises)->wait(); $end = microtime(true); @@ -74,7 +68,7 @@ public function countersShouldIncrementAtomically() $metricsResult = $this->client->get('/examples/metrics.php'); $body = (string)$metricsResult->getBody(); - $this->assertThat($body, $this->stringContains('test_some_counter{type="blue"} 45')); + $this->assertThat($body, $this->stringContains('test_some_counter{type="blue"} ' . $sum)); } /**