corso/.github/workflows/load_test.yml
dependabot[bot] 51af4dcb57
⬆️ Bump magnetikonline/action-golang-cache from 3 to 4 (#2768)
Bumps [magnetikonline/action-golang-cache](https://github.com/magnetikonline/action-golang-cache) from 3 to 4.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/magnetikonline/action-golang-cache/releases">magnetikonline/action-golang-cache's releases</a>.</em></p>
<blockquote>
<h2>v4</h2>
<ul>
<li>Provide action outputs of <code>build-cache-path</code>, <code>module-cache-path</code> and <code>cache-key</code>.</li>
<li>Some <code>README.md</code> cleanups.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="8f4eaf544f"><code>8f4eaf5</code></a> Updated action version and usage examples to include <code>outputs:</code></li>
<li><a href="3388f2a59a"><code>3388f2a</code></a> Provide outputs for Golang build/module paths and generated cache key</li>
<li><a href="ef3757439c"><code>ef37574</code></a> Refine action input descriptions</li>
<li><a href="ba4f7b3e0d"><code>ba4f7b3</code></a> Remove leading dash from <code>cache-key-suffix:</code> usage example in <code>README.md</code> - n...</li>
<li><a href="189ebca495"><code>189ebca</code></a> Bump Golang version in <code>README.md</code> examples</li>
<li>See full diff in <a href="https://github.com/magnetikonline/action-golang-cache/compare/v3...v4">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=magnetikonline/action-golang-cache&package-manager=github_actions&previous-version=3&new-version=4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

You can trigger a rebase of this PR by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>
2023-03-13 13:11:59 +00:00

155 lines
5.1 KiB
YAML

name: Nightly Load Testing
on:
schedule:
# every day at 01:59 (01:59am) UTC
# - cron: "59 1 * * *"
# temp, for testing: every 4 hours
- cron: "0 */4 * * *"
permissions:
# required to retrieve AWS credentials
id-token: write
contents: write
# cancel currently running jobs if a new version of the branch is pushed
concurrency:
group: load_testing-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
Load-Tests:
environment: Load Testing
runs-on: ubuntu-latest
defaults:
run:
working-directory: src
steps:
- uses: actions/checkout@v3
- name: Build the otel-daemon
run: make build-otel-daemon
# TODO: write logs to a file in src/test_results for archival
- name: Run the otel-daemon
run: make otel-daemon
- name: Setup Golang with cache
uses: magnetikonline/action-golang-cache@v4
with:
go-version-file: src/go.mod
- run: mkdir test_results
# Install gotestfmt
- name: Set up gotestfmt
run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
# run the tests
- name: Integration Tests
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_SECRET }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
CORSO_LOAD_TESTS: true
CORSO_LOG_FILE: ./src/test_results/testlogging.log
CORSO_M365_LOAD_TEST_USER_ID: ${{ secrets.CORSO_M365_LOAD_TEST_USER_ID }}
CORSO_M365_LOAD_TEST_ORG_USERS: ${{ secrets.CORSO_M365_LOAD_TEST_ORG_USERS }}
CORSO_PASSPHRASE: ${{ secrets.CORSO_PASSPHRASE }}
IGNORE_LOAD_TEST_USER_ID: ${{ secrets.EXT_SDK_TEST_USER_ID }}
LOG_GRAPH_REQUESTS: true
run: |
set -euo pipefail
go test \
-count=1 \
-json \
-v \
--timeout 12h \
-blockprofile=block.prof \
-cpuprofile=cpu.prof \
-memprofile=mem.prof \
-mutexprofile=mutex.prof \
-trace=trace.out \
-outputdir=test_results \
./pkg/repository/repository_load_test.go \
2>&1 | tee ./test_results/goloadtest.log | gotestfmt -hide successful-tests
# generate new entries to roll into the next load test
# only runs if the test was successful
- name: New Data Creation
working-directory: ./src/cmd/factory
env:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
CORSO_M365_LOAD_TEST_USER_ID: ${{ secrets.CORSO_M365_LOAD_TEST_USER_ID }}
run: |
go run . exchange emails \
--user ${{ env.CORSO_M365_LOAD_TEST_USER_ID }} \
--destination lt_${{ env.NOW }} \
--count 10
go run . exchange contacts \
--user ${{ env.CORSO_M365_LOAD_TEST_USER_ID }} \
--destination lt_${{ env.NOW }} \
--count 10
go run . exchange events \
--user ${{ env.CORSO_M365_LOAD_TEST_USER_ID }} \
--destination lt_${{ env.NOW }} \
--count 10
- name: Put Down the Daemons Arisen
if: always()
run: docker kill otel-daemon
# package all artifacts for later review
- name: Upload Log, Profilers, Traces
if: always()
uses: actions/upload-artifact@v3
with:
name: load-test-profiling
path: src/test_results/*
if-no-files-found: error
retention-days: 14
setup:
environment: Load Testing
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.build.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- id: build
run: |
u=$(echo "${{ secrets.CORSO_M365_LOAD_TEST_ORG_USERS }}" | sed 's/\[/["/g' | sed 's/\]/"]/g' | sed 's/|/","/g')
marr=$(cat <<-end
{ "user": $u }
end
)
m=$(echo $marr | jq -c .)
echo "matrix=$m" >> $GITHUB_OUTPUT
purge-load-test-user-data:
needs: [setup, Load-Tests]
if: always()
environment: Load Testing
runs-on: ubuntu-latest
strategy:
matrix:
user: ${{ fromJson(needs.setup.outputs.matrix).user }}
folder: [Corso_Restore_,'']
steps:
- uses: actions/checkout@v3
- name: Set folder boundary datetime
run: |
echo "NOW=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_ENV
- name: Purge Load-Test-Produced Folders
uses: ./.github/actions/purge-m365-user-data
with:
older-than: ${{ env.NOW }}
folder-prefix: ${{ matrix.folder }}
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
user: ${{ matrix.user }}