Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/notifications.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-12-06 18:55:11 +0300
committerJoas Schilling <coding@schilljs.com>2022-01-20 13:46:56 +0300
commit337f64c08034ac0bd4c0de494b5ebd68cac5c005 (patch)
tree1c252b209ded0dda512a474c7f614bc84ed181d7 /.github
parente76f4ac1bb60c54a400dd96d0ff0b6c991e4c757 (diff)
Count the queries executed in integration tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/integration.yml38
1 files changed, 38 insertions, 0 deletions
diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml
index e16e1fc..e9190c7 100644
--- a/.github/workflows/integration.yml
+++ b/.github/workflows/integration.yml
@@ -75,6 +75,44 @@ jobs:
working-directory: apps/${{ env.APP_NAME }}/tests/Integration
run: bash run.sh
+ - name: Query count
+ uses: actions/github-script@v5
+ with:
+ github-token: ${{secrets.GITHUB_TOKEN}}
+ script: |
+ let myOutput = ''
+ let myError = ''
+
+ const options = {}
+ options.listeners = {
+ stdout: (data) => {
+ myOutput += data.toString()
+ },
+ stderr: (data) => {
+ myError += data.toString()
+ }
+ }
+ await exec.exec(`/bin/bash -c "cat /home/runner/work/notifications/notifications/query.log | wc -l"`, [], options)
+ msg = myOutput
+ const queryCount = parseInt(myOutput, 10)
+
+ myOutput = ''
+ await exec.exec('cat', ['/home/runner/work/notifications/notifications/apps/notifications/tests/Integration/base-query-count.txt'], options)
+ const baseCount = parseInt(myOutput, 10)
+
+ const absoluteIncrease = queryCount - baseCount
+ const relativeIncrease = baseCount <= 0 ? 100 : (parseInt((absoluteIncrease / baseCount * 10000), 10) / 100)
+
+ if (absoluteIncrease >= 100 || relativeIncrease > 5) {
+ const comment = `🐢 Performance warning.\nIt looks like the query count of the integration tests increased with this PR.\nDatabase query count is now ` + queryCount + ' was ' + baseCount + ' (+' + relativeIncrease + '%)\nPlease check your code again. If you added a new test this can be expected and the base value in tests/Integration/base-query-count.txt can be increased.'
+ github.rest.issues.createComment({
+ issue_number: context.issue.number,
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ body: comment
+ })
+ }
+
mysql:
runs-on: ubuntu-latest