Skip to content

Commit

Permalink
Issue #23 Fixing entrypoint-app (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoapaes committed May 12, 2021
1 parent 6e99b7f commit bdc94ed
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/docker-publish-56.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ jobs:
--file docker-compose-56.yml \
down -v
- name: Run tests app
run: |
APP_RUN=$(docker-compose -f docker-compose-56.yml run -w /var/www/ --entrypoint entrypoint-app app echo)
echo "CHAMADA APP: ${APP_RUN}";
if [[ ! "${APP_RUN}" =~ "core|56" ]]; then
echo "Chamada APP retornou errado: ${APP_RUN}"
exit 1;
fi
- name: Run tests prod
run: |
docker-compose \
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/docker-publish-73.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ jobs:
--file docker-compose-73.yml \
down -v
- name: Run tests app
run: |
APP_RUN=$(docker-compose -f docker-compose-73.yml run -w /var/www/ --entrypoint entrypoint-app app echo)
echo "CHAMADA APP: ${APP_RUN}";
if [[ ! "${APP_RUN}" =~ "core|73" ]]; then
echo "Chamada APP retornou errado: ${APP_RUN}"
exit 1;
fi
- name: Run tests prod
run: |
docker-compose \
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/docker-publish-74.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ jobs:
docker-compose -f docker-compose-74.yml down -v
- name: Run tests app
run: |
APP_RUN=$(docker-compose -f docker-compose-74.yml run -w /var/www/ --entrypoint entrypoint-app app echo)
echo "CHAMADA APP: ${APP_RUN}";
if [[ ! "${APP_RUN}" =~ "core|74" ]]; then
echo "Chamada APP retornou errado: ${APP_RUN}"
exit 1;
fi
- name: Run tests prod
run: |
docker-compose -f docker-compose-74.yml -f docker-compose.prod.yml up --build -d
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/docker-publish-80.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,17 @@ jobs:
fi
docker-compose -f docker-compose-80.yml down -v
- name: Run tests app
run: |
APP_RUN=$(docker-compose -f docker-compose-80.yml run -w /var/www/ --entrypoint entrypoint-app app echo)
echo "CHAMADA APP: ${APP_RUN}";
if [[ ! "${APP_RUN}" =~ "core|80" ]]; then
echo "Chamada APP retornou errado: ${APP_RUN}"
exit 1;
fi
- name: Run tests prod
run: |
docker-compose -f docker-compose-80.yml up --build -d
Expand Down
12 changes: 12 additions & 0 deletions k6/README.md
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/).
29 changes: 29 additions & 0 deletions k6/index.js
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);
}
3 changes: 1 addition & 2 deletions sh/entrypoint-app
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}" "$@"

0 comments on commit bdc94ed

Please sign in to comment.