nightly load test footprint and workflow (#928)

## Description

Adds the footprint file for running nightly load
tests out of the repository package.  The tests
don't do anything at this stage, but that's okay.
Also introduces a workflow to kick off the tests
every day at 2am UTC.

## Type of change

- [X] 🤖 Test
- [X] 💻 CI/Deployment

## Issue(s)

* #902

## Test Plan

- [X] 💚 E2E
This commit is contained in:
Keepers 2022-09-22 09:16:25 -06:00 committed by GitHub
parent c9224aa773
commit d633be9eef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 209 additions and 0 deletions

61
.github/workflows/load_test.yml vendored Normal file
View File

@ -0,0 +1,61 @@
name: Nightly Load Testing
on:
schedule:
# every day at 01:59 (01:59am) UTC
- cron: "59 1 * * *"
permissions:
# required to retrieve AWS credentials
id-token: write
contents: read
Load-Tests:
environment: Testing
runs-on: ubuntu-latest
defaults:
run:
working-directory: src
steps:
- uses: actions/checkout@v3
- name: Setup Golang with cache
uses: magnetikonline/action-golang-cache@v3
with:
go-version-file: src/go.mod
# Install gotestfmt
- name: Set up gotestfmt
run: go install github.com/haveyoudebuggedit/gotestfmt/v2/cmd/gotestfmt@latest
# AWS creds
- name: Configure AWS credentials from Test account
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::951767375776:role/corso-testing-role
role-session-name: integration-testing
aws-region: us-east-1
# run the tests
- name: Integration Tests
env:
CORSO_LOAD_TESTS: true
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
CORSO_PASSPHRASE: ${{ secrets.INTEGRATION_TEST_CORSO_PASSPHRASE }}
TENANT_ID: ${{ secrets.TENANT_ID }}
run: |
set -euo pipefail
go test \
-json \
-v \
-count=1 \
--timeout 12h \
./... 2>&1 | tee /tmp/gotest.log | gotestfmt -hide successful-tests
# Upload the original go test log as an artifact for later review.
- name: Upload test log
uses: actions/upload-artifact@v2
with:
name: test-log
path: /tmp/gotest.log
if-no-files-found: error

View File

@ -9,6 +9,7 @@ import (
)
const (
CorsoLoadTests = "CORSO_LOAD_TESTS"
CorsoCITests = "CORSO_CI_TESTS"
CorsoCLIBackupTests = "CORSO_COMMAND_LINE_BACKUP_TESTS"
CorsoCLIConfigTests = "CORSO_COMMAND_LINE_CONFIG_TESTS"

View File

@ -0,0 +1,147 @@
package repository_test
import (
"context"
"testing"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/pkg/account"
"github.com/alcionai/corso/src/pkg/control"
"github.com/alcionai/corso/src/pkg/logger"
"github.com/alcionai/corso/src/pkg/repository"
"github.com/alcionai/corso/src/pkg/storage"
)
func initM365Repo(t *testing.T) (
context.Context, *repository.Repository, account.Account, storage.Storage,
) {
_, err := tester.GetRequiredEnvSls(
tester.AWSStorageCredEnvs,
tester.M365AcctCredEnvs,
)
require.NoError(t, err)
ctx := tester.NewContext()
st := tester.NewPrefixedS3Storage(t)
ac := tester.NewM365Account(t)
opts := control.Options{
DisableMetrics: true,
FailFast: true,
}
repo, err := repository.Initialize(ctx, ac, st, opts)
require.NoError(t, err)
return ctx, repo, ac, st
}
// ------------------------------------------------------------------------------------------------
// Exchange
// ------------------------------------------------------------------------------------------------
type RepositoryLoadTestExchangeSuite struct {
suite.Suite
ctx context.Context
repo *repository.Repository
acct account.Account
st storage.Storage
}
func TestRepositoryLoadTestExchangeSuite(t *testing.T) {
if err := tester.RunOnAny(tester.CorsoLoadTests); err != nil {
t.Skip(err)
}
suite.Run(t, new(RepositoryLoadTestExchangeSuite))
}
func (suite *RepositoryLoadTestExchangeSuite) SetupSuite() {
t := suite.T()
suite.ctx, suite.repo, suite.acct, suite.st = initM365Repo(t)
}
func (suite *RepositoryLoadTestExchangeSuite) TeardownSuite() {
suite.repo.Close(suite.ctx)
}
func (suite *RepositoryLoadTestExchangeSuite) SetupTest() {
suite.ctx, _ = logger.SeedLevel(context.Background(), logger.Development)
}
func (suite *RepositoryLoadTestExchangeSuite) TeardownTest() {
logger.Flush(suite.ctx)
}
func (suite *RepositoryLoadTestExchangeSuite) TestExchange() {
// var (
// t = suite.T()
// ctx = context.Background()
// )
// t.parallel()
// backup
// list
// details
// restore
}
// ------------------------------------------------------------------------------------------------
// OneDrive
// ------------------------------------------------------------------------------------------------
type RepositoryLoadTestOneDriveSuite struct {
suite.Suite
ctx context.Context
repo *repository.Repository
acct account.Account
st storage.Storage
}
func TestRepositoryLoadTestOneDriveSuite(t *testing.T) {
if err := tester.RunOnAny(tester.CorsoLoadTests); err != nil {
t.Skip(err)
}
suite.Run(t, new(RepositoryLoadTestOneDriveSuite))
}
func (suite *RepositoryLoadTestOneDriveSuite) SetupSuite() {
t := suite.T()
suite.ctx, suite.repo, suite.acct, suite.st = initM365Repo(t)
}
func (suite *RepositoryLoadTestOneDriveSuite) TeardownSuite() {
suite.repo.Close(suite.ctx)
}
func (suite *RepositoryLoadTestOneDriveSuite) SetupTest() {
suite.ctx, _ = logger.SeedLevel(context.Background(), logger.Development)
}
func (suite *RepositoryLoadTestOneDriveSuite) TeardownTest() {
logger.Flush(suite.ctx)
}
func (suite *RepositoryLoadTestOneDriveSuite) TestExchange() {
// var (
// t = suite.T()
// ctx = context.Background()
// )
// t.parallel()
// backup
// list
// details
// restore
}