Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ PERF_RESOURCE_LIST=students studentschoolassociations studenteducationorganizati
PERF_API_PAGE_SIZE=402
PERF_DESCRIPTION=

#
## Query performance testing
#
# Test mode: paging, query, or both (default: both)
PERF_QUERY_TEST_MODE=both
# Maximum number of resources to test for query performance (default: 10)
PERF_QUERY_RESOURCE_COUNT=10
# Maximum number of query parameter combinations to test per resource (default: 50)
PERF_QUERY_COMBINATIONS_LIMIT=50

#
## Performance testing
#
Expand Down
164 changes: 125 additions & 39 deletions TestRunner.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -499,52 +499,129 @@ function Invoke-TestRunner {

if($testSuite -eq 'pagevolume') {
$outputDir = Resolve-Path $testKitOutputPath
Push-Location ./src/edfi-paging-test

try {
Write-DebugLog "Executing: poetry install" -LogLevel $logLevel
&poetry install

# Get test mode configuration
$testMode = Get-ConfigValue -Config $Config -Key "PERF_QUERY_TEST_MODE" -Optional
if ($null -eq $testMode) {
$testMode = "both"
}

# Get query-specific configuration parameters
$queryResourceCount = Get-ConfigValue -Config $Config -Key "PERF_QUERY_RESOURCE_COUNT" -Optional
$queryCombinationsLimit = Get-ConfigValue -Config $Config -Key "PERF_QUERY_COMBINATIONS_LIMIT" -Optional

Write-InfoLog "Running page volume tests in mode: $testMode"

# Execute paging tests (if mode is 'paging' or 'both')
if ($testMode -eq "paging" -or $testMode -eq "both") {
Write-InfoLog "Executing paging tests..."
Push-Location ./src/edfi-paging-test

try {
Write-DebugLog "Executing: poetry install" -LogLevel $logLevel
&poetry install

$command = "poetry run python edfi_paging_test --baseUrl $url --key $key --secret $secret --output $outputDir"
if ($connectionLimit) {
$command += " --connectionLimit $connectionLimit"
}
if ($contentType) {
$command += " --contentType $contentType"
}
if ($resourceList) {
$command += " --resourceList $resourceList"
}
if ($pageSize) {
$command += " --pageSize $pageSize"
}
if ($logLevel) {
$command += " --logLevel $logLevel"
}
if ($description) {
$command += " --description '$description - Paging Tests'"
}
if ($insecure) {
$command += " --ignoreCertificateErrors"
}

$command = "poetry run python edfi_paging_test --baseUrl $url --key $key --secret $secret --output $outputDir"
if ($connectionLimit) {
$command += " --connectionLimit $connectionLimit"
}
if ($contentType) {
$command += " --contentType $contentType"
Write-DebugLog "Executing: $command" -LogLevel $logLevel
Invoke-Expression -Command $command
}
if ($resourceList) {
$command += " --resourceList $resourceList"
catch {
Write-ErrorLog "Error executing paging tests: $($_.Exception.Message)"
$formatstring = "{0} : {1}`n{2}`n" +
" + CategoryInfo : {3}`n" +
" + FullyQualifiedErrorId : {4}`n"
$fields = $_.InvocationInfo.MyCommand.Name,
$_.ErrorDetails.Message,
$_.InvocationInfo.PositionMessage,
$_.CategoryInfo.ToString(),
$_.FullyQualifiedErrorId
Write-ErrorLog ($formatstring -f $fields)
}
if ($pageSize) {
$command += " --pageSize $pageSize"
finally {
Pop-Location
}
if ($logLevel) {
$command += " --logLevel $logLevel"
}

# Execute query tests (if mode is 'query' or 'both')
if ($testMode -eq "query" -or $testMode -eq "both") {
Write-InfoLog "Executing query tests..."
Push-Location ./src/edfi-query-test

try {
Write-DebugLog "Executing: poetry install" -LogLevel $logLevel
&poetry install

$command = "poetry run python edfi_query_test --baseUrl $url --key $key --secret $secret --output $outputDir"
if ($connectionLimit) {
$command += " --connectionLimit $connectionLimit"
}
if ($contentType) {
$command += " --contentType $contentType"
}
if ($resourceList) {
$command += " --resourceList $resourceList"
}
if ($pageSize) {
$command += " --pageSize $pageSize"
}
if ($logLevel) {
$command += " --logLevel $logLevel"
}
if ($description) {
$command += " --description '$description - Query Tests'"
} else {
$command += " --description 'Query Performance Tests'"
}
if ($insecure) {
$command += " --ignoreCertificateErrors"
}
if ($queryResourceCount) {
$command += " --resourceCount $queryResourceCount"
}
if ($queryCombinationsLimit) {
$command += " --combinationsLimit $queryCombinationsLimit"
}

Write-DebugLog "Executing: $command" -LogLevel $logLevel
Invoke-Expression -Command $command
}
if ($description) {
$command += " --description '$description'"
catch {
Write-ErrorLog "Error executing query tests: $($_.Exception.Message)"
$formatstring = "{0} : {1}`n{2}`n" +
" + CategoryInfo : {3}`n" +
" + FullyQualifiedErrorId : {4}`n"
$fields = $_.InvocationInfo.MyCommand.Name,
$_.ErrorDetails.Message,
$_.InvocationInfo.PositionMessage,
$_.CategoryInfo.ToString(),
$_.FullyQualifiedErrorId
Write-ErrorLog ($formatstring -f $fields)
}
if ($insecure) {
$command += " --ignoreCertificateErrors"
finally {
Pop-Location
}

Write-DebugLog "Executing: $command" -LogLevel $logLevel
Invoke-Expression -Command $command
}
catch {
Write-ErrorLog $_.Exception.Message
$formatstring = "{0} : {1}`n{2}`n" +
" + CategoryInfo : {3}`n" +
" + FullyQualifiedErrorId : {4}`n"
$fields = $_.InvocationInfo.MyCommand.Name,
$_.ErrorDetails.Message,
$_.InvocationInfo.PositionMessage,
$_.CategoryInfo.ToString(),
$_.FullyQualifiedErrorId
Write-ErrorLog ($formatstring -f $fields)
}
finally {
Pop-Location
}
}
else{
Expand Down Expand Up @@ -829,7 +906,16 @@ function Initialize-TestRunner {
}

function Invoke-PageVolumeTests {
param(
[ValidateSet("paging", "query", "both")]
[string]
$TestMode = "both"
)

$config = Initialize-TestRunner

# Add test mode to configuration
Set-ConfigValue -Config $config -Key "PERF_QUERY_TEST_MODE" -Value $TestMode

Invoke-TestRunner `
-TestSuite pagevolume `
Expand Down
8 changes: 6 additions & 2 deletions run-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ param(
[string]
[Parameter(Mandatory=$True)]
[ValidateSet("paging", "pipeclean", "volume", "changequeries", "stress", "soak")]
$Type
$Type,

[ValidateSet("paging", "query", "both")]
[string]
$TestMode = "both"
)

Import-Module .\TestRunner.psm1 -Force

switch ($Type) {
"paging" { Invoke-PageVolumeTests }
"paging" { Invoke-PageVolumeTests -TestMode $TestMode }
"pipeclean" { Invoke-PipecleanTests }
"volume" { Invoke-VolumeTests }
"stress" { Invoke-StressTests }
Expand Down
Loading
Loading