Skip to content
Draft
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
29 changes: 25 additions & 4 deletions ci/ip-intelligence-performance.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,35 @@ It 'writes the summary the performance step reports' {
& $script:Script -RepoName $script:Product -Name 'test' | Out-Null

# common-ci compares results_<Name>.json, one file for each configuration,
# which also holds Device Detection's figures, so these carry the product.
# which also holds Device Detection's figures, so these are lookups, the
# names most languages graph IP Intelligence under.
$folder = Join-Path $script:Product 'test-results' 'performance-summary'
Get-ChildItem $folder | ForEach-Object Name | Should -Be 'results_test.json'
$results = Get-Content (Join-Path $folder 'results_test.json') |
ConvertFrom-Json
$results.HigherIsBetter.IpIntelligence_DetectionsPerSecond | Should -Be 1
$results.LowerIsBetter.IpIntelligence_AvgMillisecsPerDetection |
Should -Be 1
@($results.HigherIsBetter.PSObject.Properties.Name) |
Should -Be @('LookupsPerSecond')
@($results.LowerIsBetter.PSObject.Properties.Name) |
Should -Be @('AvgMillisecsPerLookup')
$results.HigherIsBetter.LookupsPerSecond | Should -Be 1
$results.LowerIsBetter.AvgMillisecsPerLookup | Should -Be 1
}

It 'adds figures that Device Detection does not write' {
& $script:Script -RepoName $script:Product -Name 'test' | Out-Null

# The root step merges this summary into Device Detection's and fails on
# a figure both write, so none of these may be a Device Detection name.
$deviceDetection = Join-Path $PSScriptRoot '..' 'device-detection' 'ci' `
'run-performance-tests.ps1'
$results = Get-Content (Join-Path $script:Product 'test-results' `
'performance-summary' 'results_test.json') | ConvertFrom-Json
$text = Get-Content -Raw $deviceDetection
foreach ($section in $results.HigherIsBetter, $results.LowerIsBetter) {
foreach ($name in $section.PSObject.Properties.Name) {
$text | Should -Not -Match "\b$name\b"
}
}
}

It 'fails rather than skipping when the free Lite file is absent' {
Expand Down
10 changes: 6 additions & 4 deletions ip-intelligence/ci/run-performance-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ try {
python fiftyone_ipintelligence_examples/src/fiftyone_ipintelligence_examples/onpremise/performance_console.py --data_file "$assets/$dataFileName" --evidence_file "$assets/$evidenceFileName" --json_output $pwd/summary.json || $(throw "performance tests failed with $LASTEXITCODE")

# The root step puts every product's figures in the one summary of the
# configuration, and Device Detection measures the same things, so these
# carry the product's name.
# configuration, beside Device Detection's detections, so these are
# written as lookups. Those are the names most languages graph IP
# Intelligence under, so the graph is
# perf-graph-<Name>-LookupsPerSecond-latest.png as theirs is.
$Results = Get-Content $pwd/summary.json | ConvertFrom-Json
@{
HigherIsBetter = @{
IpIntelligence_DetectionsPerSecond = $Results.DetectionsPerSecond
LookupsPerSecond = $Results.DetectionsPerSecond
};
LowerIsBetter = @{
IpIntelligence_AvgMillisecsPerDetection = $Results.MsPerDetection
AvgMillisecsPerLookup = $Results.MsPerDetection
}
} | ConvertTo-Json | Out-File $perfSummary/results_$Name.json
} finally {
Expand Down
Loading