add load tester suite (#2809)
#### Does this PR need a docs update or release note? - [x] ⛔ No #### Type of change - [x] 🧹 Tech Debt/Cleanup #### Test Plan - [x] 💚 E2E
This commit is contained in:
parent
4515d3a4b2
commit
26bf24c77e
@ -86,6 +86,32 @@ type e2eSuite struct {
|
|||||||
suite.Suite
|
suite.Suite
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Load
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
func NewLoadSuite(
|
||||||
|
t *testing.T,
|
||||||
|
envSets [][]string,
|
||||||
|
runOnAnyEnv ...string,
|
||||||
|
) *loadSuite {
|
||||||
|
RunOnAny(
|
||||||
|
t,
|
||||||
|
append(
|
||||||
|
[]string{CorsoLoadTests},
|
||||||
|
runOnAnyEnv...,
|
||||||
|
)...,
|
||||||
|
)
|
||||||
|
|
||||||
|
MustGetEnvSets(t, envSets...)
|
||||||
|
|
||||||
|
return new(loadSuite)
|
||||||
|
}
|
||||||
|
|
||||||
|
type loadSuite struct {
|
||||||
|
suite.Suite
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Run Condition Checkers
|
// Run Condition Checkers
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|||||||
@ -58,3 +58,20 @@ func (suite *TesterE2ESuite) SetupSuite() {
|
|||||||
func (suite *TesterE2ESuite) TestE2ESuite() {
|
func (suite *TesterE2ESuite) TestE2ESuite() {
|
||||||
require.True(suite.T(), suite.called)
|
require.True(suite.T(), suite.called)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type TesterLoadSuite struct {
|
||||||
|
tester.Suite
|
||||||
|
called bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestTesterLoadSuite(t *testing.T) {
|
||||||
|
suite.Run(t, &TesterLoadSuite{Suite: tester.NewLoadSuite(t, nil)})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (suite *TesterLoadSuite) SetupSuite() {
|
||||||
|
suite.called = true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (suite *TesterLoadSuite) TestE2ESuite() {
|
||||||
|
require.True(suite.T(), suite.called)
|
||||||
|
}
|
||||||
|
|||||||
@ -385,14 +385,24 @@ func normalizeCategorySet(t *testing.T, cats map[string]struct{}) []string {
|
|||||||
return sl
|
return sl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ================================================
|
||||||
|
* A note on load test setup:
|
||||||
|
* Even though most of the code here is boiler-
|
||||||
|
* plate and could be easily compressed into a
|
||||||
|
* test matrix, we want to keep the suites separate
|
||||||
|
* to maximize parallelism. Due to how testify's
|
||||||
|
* suites work, we can only run in parallel at the
|
||||||
|
* level of the suite, not within each test.
|
||||||
|
* ================================================ */
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Exchange
|
// Exchange
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// multiple users
|
// multiple users
|
||||||
|
|
||||||
type RepositoryLoadTestExchangeSuite struct {
|
type LoadExchangeSuite struct {
|
||||||
suite.Suite
|
tester.Suite
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
repo repository.Repository
|
repo repository.Repository
|
||||||
acct account.Account //lint:ignore U1000 future test use
|
acct account.Account //lint:ignore U1000 future test use
|
||||||
@ -400,23 +410,27 @@ type RepositoryLoadTestExchangeSuite struct {
|
|||||||
usersUnderTest []string
|
usersUnderTest []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRepositoryLoadTestExchangeSuite(t *testing.T) {
|
func TestLoadExchangeSuite(t *testing.T) {
|
||||||
tester.RunOnAny(t, tester.CorsoLoadTests)
|
suite.Run(t, &LoadExchangeSuite{
|
||||||
suite.Run(t, new(RepositoryLoadTestExchangeSuite))
|
Suite: tester.NewLoadSuite(
|
||||||
|
t,
|
||||||
|
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs},
|
||||||
|
),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *RepositoryLoadTestExchangeSuite) SetupSuite() {
|
func (suite *LoadExchangeSuite) SetupSuite() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
suite.ctx, suite.repo, suite.acct, suite.st = initM365Repo(t)
|
suite.ctx, suite.repo, suite.acct, suite.st = initM365Repo(t)
|
||||||
suite.usersUnderTest = orgUserSet(t)
|
suite.usersUnderTest = orgUserSet(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *RepositoryLoadTestExchangeSuite) TeardownSuite() {
|
func (suite *LoadExchangeSuite) TeardownSuite() {
|
||||||
suite.repo.Close(suite.ctx)
|
suite.repo.Close(suite.ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *RepositoryLoadTestExchangeSuite) TestExchange() {
|
func (suite *LoadExchangeSuite) TestExchange() {
|
||||||
ctx, flush := tester.WithContext(suite.ctx)
|
ctx, flush := tester.WithContext(suite.ctx)
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
@ -439,8 +453,8 @@ func (suite *RepositoryLoadTestExchangeSuite) TestExchange() {
|
|||||||
|
|
||||||
// single user, lots of data
|
// single user, lots of data
|
||||||
|
|
||||||
type RepositoryIndividualLoadTestExchangeSuite struct {
|
type IndividualLoadExchangeSuite struct {
|
||||||
suite.Suite
|
tester.Suite
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
repo repository.Repository
|
repo repository.Repository
|
||||||
acct account.Account //lint:ignore U1000 future test use
|
acct account.Account //lint:ignore U1000 future test use
|
||||||
@ -448,12 +462,16 @@ type RepositoryIndividualLoadTestExchangeSuite struct {
|
|||||||
usersUnderTest []string
|
usersUnderTest []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRepositoryIndividualLoadTestExchangeSuite(t *testing.T) {
|
func TestIndividualLoadExchangeSuite(t *testing.T) {
|
||||||
tester.RunOnAny(t, tester.CorsoLoadTests)
|
suite.Run(t, &IndividualLoadExchangeSuite{
|
||||||
suite.Run(t, new(RepositoryIndividualLoadTestExchangeSuite))
|
Suite: tester.NewLoadSuite(
|
||||||
|
t,
|
||||||
|
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs},
|
||||||
|
),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *RepositoryIndividualLoadTestExchangeSuite) SetupSuite() {
|
func (suite *IndividualLoadExchangeSuite) SetupSuite() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
t.Skip("individual user exchange suite tests are on hold until token expiry gets resolved")
|
t.Skip("individual user exchange suite tests are on hold until token expiry gets resolved")
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
@ -461,11 +479,11 @@ func (suite *RepositoryIndividualLoadTestExchangeSuite) SetupSuite() {
|
|||||||
suite.usersUnderTest = singleUserSet(t)
|
suite.usersUnderTest = singleUserSet(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *RepositoryIndividualLoadTestExchangeSuite) TeardownSuite() {
|
func (suite *IndividualLoadExchangeSuite) TeardownSuite() {
|
||||||
suite.repo.Close(suite.ctx)
|
suite.repo.Close(suite.ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *RepositoryIndividualLoadTestExchangeSuite) TestExchange() {
|
func (suite *IndividualLoadExchangeSuite) TestExchange() {
|
||||||
ctx, flush := tester.WithContext(suite.ctx)
|
ctx, flush := tester.WithContext(suite.ctx)
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
@ -490,8 +508,8 @@ func (suite *RepositoryIndividualLoadTestExchangeSuite) TestExchange() {
|
|||||||
// OneDrive
|
// OneDrive
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
type RepositoryLoadTestOneDriveSuite struct {
|
type LoadOneDriveSuite struct {
|
||||||
suite.Suite
|
tester.Suite
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
repo repository.Repository
|
repo repository.Repository
|
||||||
acct account.Account //lint:ignore U1000 future test use
|
acct account.Account //lint:ignore U1000 future test use
|
||||||
@ -499,12 +517,16 @@ type RepositoryLoadTestOneDriveSuite struct {
|
|||||||
usersUnderTest []string
|
usersUnderTest []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRepositoryLoadTestOneDriveSuite(t *testing.T) {
|
func TestLoadOneDriveSuite(t *testing.T) {
|
||||||
tester.RunOnAny(t, tester.CorsoLoadTests)
|
suite.Run(t, &LoadOneDriveSuite{
|
||||||
suite.Run(t, new(RepositoryLoadTestOneDriveSuite))
|
Suite: tester.NewLoadSuite(
|
||||||
|
t,
|
||||||
|
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs},
|
||||||
|
),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *RepositoryLoadTestOneDriveSuite) SetupSuite() {
|
func (suite *LoadOneDriveSuite) SetupSuite() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
t.Skip("not running onedrive load tests atm")
|
t.Skip("not running onedrive load tests atm")
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
@ -512,11 +534,11 @@ func (suite *RepositoryLoadTestOneDriveSuite) SetupSuite() {
|
|||||||
suite.usersUnderTest = orgUserSet(t)
|
suite.usersUnderTest = orgUserSet(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *RepositoryLoadTestOneDriveSuite) TeardownSuite() {
|
func (suite *LoadOneDriveSuite) TeardownSuite() {
|
||||||
suite.repo.Close(suite.ctx)
|
suite.repo.Close(suite.ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *RepositoryLoadTestOneDriveSuite) TestOneDrive() {
|
func (suite *LoadOneDriveSuite) TestOneDrive() {
|
||||||
ctx, flush := tester.WithContext(suite.ctx)
|
ctx, flush := tester.WithContext(suite.ctx)
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
@ -535,8 +557,8 @@ func (suite *RepositoryLoadTestOneDriveSuite) TestOneDrive() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
type RepositoryIndividualLoadTestOneDriveSuite struct {
|
type IndividualLoadOneDriveSuite struct {
|
||||||
suite.Suite
|
tester.Suite
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
repo repository.Repository
|
repo repository.Repository
|
||||||
acct account.Account //lint:ignore U1000 future test use
|
acct account.Account //lint:ignore U1000 future test use
|
||||||
@ -544,23 +566,27 @@ type RepositoryIndividualLoadTestOneDriveSuite struct {
|
|||||||
usersUnderTest []string
|
usersUnderTest []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRepositoryIndividualLoadTestOneDriveSuite(t *testing.T) {
|
func TestIndividualLoadOneDriveSuite(t *testing.T) {
|
||||||
tester.RunOnAny(t, tester.CorsoLoadTests)
|
suite.Run(t, &IndividualLoadOneDriveSuite{
|
||||||
suite.Run(t, new(RepositoryIndividualLoadTestOneDriveSuite))
|
Suite: tester.NewLoadSuite(
|
||||||
|
t,
|
||||||
|
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs},
|
||||||
|
),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *RepositoryIndividualLoadTestOneDriveSuite) SetupSuite() {
|
func (suite *IndividualLoadOneDriveSuite) SetupSuite() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
suite.ctx, suite.repo, suite.acct, suite.st = initM365Repo(t)
|
suite.ctx, suite.repo, suite.acct, suite.st = initM365Repo(t)
|
||||||
suite.usersUnderTest = singleUserSet(t)
|
suite.usersUnderTest = singleUserSet(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *RepositoryIndividualLoadTestOneDriveSuite) TeardownSuite() {
|
func (suite *IndividualLoadOneDriveSuite) TeardownSuite() {
|
||||||
suite.repo.Close(suite.ctx)
|
suite.repo.Close(suite.ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *RepositoryIndividualLoadTestOneDriveSuite) TestOneDrive() {
|
func (suite *IndividualLoadOneDriveSuite) TestOneDrive() {
|
||||||
ctx, flush := tester.WithContext(suite.ctx)
|
ctx, flush := tester.WithContext(suite.ctx)
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
@ -583,8 +609,8 @@ func (suite *RepositoryIndividualLoadTestOneDriveSuite) TestOneDrive() {
|
|||||||
// SharePoint
|
// SharePoint
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
type RepositoryLoadTestSharePointSuite struct {
|
type LoadSharePointSuite struct {
|
||||||
suite.Suite
|
tester.Suite
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
repo repository.Repository
|
repo repository.Repository
|
||||||
acct account.Account //lint:ignore U1000 future test use
|
acct account.Account //lint:ignore U1000 future test use
|
||||||
@ -592,12 +618,16 @@ type RepositoryLoadTestSharePointSuite struct {
|
|||||||
sitesUnderTest []string
|
sitesUnderTest []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRepositoryLoadTestSharePointSuite(t *testing.T) {
|
func TestLoadSharePointSuite(t *testing.T) {
|
||||||
tester.RunOnAny(t, tester.CorsoLoadTests)
|
suite.Run(t, &LoadSharePointSuite{
|
||||||
suite.Run(t, new(RepositoryLoadTestSharePointSuite))
|
Suite: tester.NewLoadSuite(
|
||||||
|
t,
|
||||||
|
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs},
|
||||||
|
),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *RepositoryLoadTestSharePointSuite) SetupSuite() {
|
func (suite *LoadSharePointSuite) SetupSuite() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
t.Skip("not running sharepoint load tests atm")
|
t.Skip("not running sharepoint load tests atm")
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
@ -605,11 +635,11 @@ func (suite *RepositoryLoadTestSharePointSuite) SetupSuite() {
|
|||||||
suite.sitesUnderTest = orgSiteSet(t)
|
suite.sitesUnderTest = orgSiteSet(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *RepositoryLoadTestSharePointSuite) TeardownSuite() {
|
func (suite *LoadSharePointSuite) TeardownSuite() {
|
||||||
suite.repo.Close(suite.ctx)
|
suite.repo.Close(suite.ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *RepositoryLoadTestSharePointSuite) TestSharePoint() {
|
func (suite *LoadSharePointSuite) TestSharePoint() {
|
||||||
ctx, flush := tester.WithContext(suite.ctx)
|
ctx, flush := tester.WithContext(suite.ctx)
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
@ -628,8 +658,8 @@ func (suite *RepositoryLoadTestSharePointSuite) TestSharePoint() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
type RepositoryIndividualLoadTestSharePointSuite struct {
|
type IndividualLoadSharePointSuite struct {
|
||||||
suite.Suite
|
tester.Suite
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
repo repository.Repository
|
repo repository.Repository
|
||||||
acct account.Account //lint:ignore U1000 future test use
|
acct account.Account //lint:ignore U1000 future test use
|
||||||
@ -637,12 +667,16 @@ type RepositoryIndividualLoadTestSharePointSuite struct {
|
|||||||
sitesUnderTest []string
|
sitesUnderTest []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRepositoryIndividualLoadTestSharePointSuite(t *testing.T) {
|
func TestIndividualLoadSharePointSuite(t *testing.T) {
|
||||||
tester.RunOnAny(t, tester.CorsoLoadTests)
|
suite.Run(t, &IndividualLoadSharePointSuite{
|
||||||
suite.Run(t, new(RepositoryIndividualLoadTestOneDriveSuite))
|
Suite: tester.NewLoadSuite(
|
||||||
|
t,
|
||||||
|
[][]string{tester.AWSStorageCredEnvs, tester.M365AcctCredEnvs},
|
||||||
|
),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *RepositoryIndividualLoadTestSharePointSuite) SetupSuite() {
|
func (suite *IndividualLoadSharePointSuite) SetupSuite() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
t.Skip("not running sharepoint load tests atm")
|
t.Skip("not running sharepoint load tests atm")
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
@ -650,11 +684,11 @@ func (suite *RepositoryIndividualLoadTestSharePointSuite) SetupSuite() {
|
|||||||
suite.sitesUnderTest = singleSiteSet(t)
|
suite.sitesUnderTest = singleSiteSet(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *RepositoryIndividualLoadTestSharePointSuite) TeardownSuite() {
|
func (suite *IndividualLoadSharePointSuite) TeardownSuite() {
|
||||||
suite.repo.Close(suite.ctx)
|
suite.repo.Close(suite.ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *RepositoryIndividualLoadTestSharePointSuite) TestSharePoint() {
|
func (suite *IndividualLoadSharePointSuite) TestSharePoint() {
|
||||||
ctx, flush := tester.WithContext(suite.ctx)
|
ctx, flush := tester.WithContext(suite.ctx)
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user