-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
6e99b7f
commit bdc94ed
Showing
7 changed files
with
83 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# K6.io | ||
|
||
Para rodar os testes iniciar o PHP usando o docker-compose da versão escolhida e executar o k6 como o exemplo abaixo usando o PHP 7.3. | ||
|
||
```shell | ||
docker-compose -f docker-compose-73.yml up --build -d | ||
k6 run -e PHP_VERSION=73 --vus 40 --duration 30s index.js | ||
``` | ||
|
||
Neste exemplo ele irá rodar com 40 conexões simultaneas por 30 segundos. | ||
|
||
Para instalar o k6 seguir os passos no próprio [site](https://k6.io/docs/getting-started/installation/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import http from 'k6/http'; | ||
import { check } from 'k6'; | ||
import { Counter } from 'k6/metrics'; | ||
|
||
export const requests = new Counter('http_reqs'); | ||
|
||
export const urlbase = __ENV.URL != null ? __ENV.URL : "http://127.0.0.1/"; | ||
export const phpVersion = __ENV.PHP_VERSION != null ? __ENV.PHP_VERSION : "73"; | ||
|
||
export const options = { | ||
thresholds: { | ||
http_req_duration: ['p(95)<200'], | ||
}, | ||
}; | ||
|
||
export default function () { | ||
const ok = { | ||
'status is 200': (r) => r.status === 200, | ||
'response body': (r) => { | ||
if(r.body === undefined || r.body === null) { | ||
return false; | ||
} | ||
|
||
return r.body.indexOf('core|'+phpVersion) !== -1; | ||
}, | ||
}; | ||
|
||
check(http.get(urlbase + ''), ok); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
#!/bin/bash | ||
set -e | ||
start-core | ||
"${APP_NAME}" "$@" | ||
start "cli" "${APP_NAME}" "$@" |