Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added LCOW functional tests and benchmarks for uVMs and containers. (#…
…1351) * Added LCOW functional tests and benchmarks Split out utility functions from `test/functional` into an internal package, separate from functional tests. Updated code to use containerd instead of docker. Added new functional tests and benchmarks for LCOW uVM containers, and updated other LCOW tests as well. Not all (LCOW) functional tests were updated, and most others are now explicitly skipped. Updated `k8s.io/cri-api` to v0.22 to include `WindowsPodSandboxConfig` struct Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com> * Updating tests to use new test\internal package Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com> * PR: doc, simplified signatures Added deprecated warning to `layers.LayerFolders`, which relies on docker. Added doc comment to functional tests to clarify overlap with other tests. Removed unnecessary parameter in `WaitForError`. Updated snapshotter logic Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com> * PR: refactor, updated image names in cri tests Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com> Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
- Loading branch information
Showing
72 changed files
with
2,526 additions
and
416 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# ex: .\scripts\Test-Functional.ps1 -Action Bench -Count 2 -BenchTime "2x" | ||
|
||
[CmdletBinding()] | ||
param ( | ||
[ValidateSet('Test', 'Bench', 'List')] | ||
[alias('a')] | ||
[string] | ||
$Action = 'Bench', | ||
|
||
[string] | ||
$Note = '', | ||
|
||
[string] | ||
$OutDirectory = '.\test\results', | ||
|
||
# test parameters | ||
[int] | ||
$Count = 1, | ||
|
||
[string] | ||
$BenchTime = '5s', | ||
|
||
[string] | ||
$Timeout = '10m', | ||
|
||
[alias('tv')] | ||
[switch] | ||
$TestVerbose, | ||
|
||
[string] | ||
$Run = '', | ||
|
||
[string] | ||
$Feature = '' | ||
) | ||
|
||
Import-Module ( Join-Path $PSScriptRoot Testing.psm1 ) -Force | ||
|
||
$date = Get-Date | ||
$testcmd, $out = New-TestCommand ` | ||
-Action $Action ` | ||
-Path .\bin\test\functional.exe ` | ||
-Name functional ` | ||
-OutDirectory $OutDirectory ` | ||
-Date $date ` | ||
-Note $Note ` | ||
-TestVerbose:$TestVerbose ` | ||
-Count $Count ` | ||
-BenchTime $BenchTime ` | ||
-Timeout $Timeout ` | ||
-Run $Run ` | ||
-Feature $Feature ` | ||
-Verbose:$Verbose | ||
|
||
Invoke-TestCommand ` | ||
-TestCmd $testcmd ` | ||
-OutputFile $out ` | ||
-OutputCmd (&{ if ( $Action -eq 'Bench' ) { 'benchstat' } }) ` | ||
-Preamble ` | ||
-Date $Date ` | ||
-Note $Note ` | ||
-Verbose:$Verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
function New-TestCommand { | ||
[CmdletBinding()] | ||
param ( | ||
[ValidateSet('Test', 'Bench', 'List')] | ||
[alias('a')] | ||
[string] | ||
$Action = 'Bench', | ||
|
||
[Parameter(Mandatory)] | ||
[string] | ||
$Path, | ||
|
||
[Parameter(Mandatory)] | ||
[string] | ||
$Name, | ||
|
||
[Parameter(Mandatory)] | ||
[string] | ||
$OutDirectory , | ||
|
||
[DateTime] | ||
$Date = (Get-Date), | ||
|
||
[string] | ||
$Note = '', | ||
|
||
# test parameters | ||
[alias('tv')] | ||
[switch] | ||
$TestVerbose = $false, | ||
|
||
[int] | ||
$Count = 1, | ||
|
||
[string] | ||
$BenchTime = '5s', | ||
|
||
[string] | ||
$Timeout = '10m', | ||
|
||
[string] | ||
$Run = '', | ||
|
||
[string] | ||
$Feature = '' | ||
) | ||
|
||
$OutDirectory = Resolve-Path $OutDirectory | ||
Write-Verbose "creating $OutDirectory" | ||
|
||
New-Item -ItemType 'directory' -Path $OutDirectory -Force > $null | ||
|
||
$testcmd = "$Path `'-test.timeout=$Timeout`' `'-test.shuffle=on`' `'-test.count=$Count`' " | ||
|
||
if ( $TestVerbose ) { | ||
$testcmd += ' ''-test.v'' ' | ||
} | ||
|
||
switch ( $Action ) { | ||
'List' { | ||
if ( $Run -eq '' ) { | ||
$Run = '.' | ||
} | ||
$testcmd += " `'-test.list=$Run`' " | ||
} | ||
'Test' { | ||
if ( $Run -ne '' ) { | ||
$testcmd += " `'-test.run=$Run`' " | ||
} | ||
} | ||
'Bench' { | ||
if ( $Run -eq '' ) { | ||
$Run = '.' | ||
} | ||
$testcmd += ' ''-test.run=^#'' ''-test.benchmem'' ' + ` | ||
" `'-test.bench=$Run`' `'-test.benchtime=$BenchTime`' " | ||
} | ||
} | ||
|
||
if ( $Feature -ne '' ) { | ||
$testcmd += " `'-feature=$Feature`' " | ||
} | ||
|
||
$f = $Name + '-' + $Action | ||
if ($Note -ne '' ) { | ||
$f += '-' + $Note | ||
} | ||
$out = Join-Path $OutDirectory "$f-$(Get-Date -Date $date -Format FileDateTime).txt" | ||
|
||
return $testcmd, $out | ||
} | ||
|
||
function Invoke-TestCommand { | ||
[CmdletBinding()] | ||
param ( | ||
[Parameter(Mandatory)] | ||
[string] | ||
$TestCmd, | ||
|
||
[string] | ||
$TestCmdPreamble = $TestCmd, | ||
|
||
[string] | ||
$OutputFile = 'nul', | ||
|
||
[string] | ||
$OutputCmd, | ||
|
||
[switch] | ||
$Preamble, | ||
|
||
[DateTime] | ||
$Date = (Get-Date), | ||
|
||
[string] | ||
$Note | ||
) | ||
|
||
if ($OutputFile -eq '' ) { | ||
$OutputFile = 'nul' | ||
} | ||
|
||
Write-Verbose "Saving output to: $OutputFile" | ||
if ( $Preamble ) { | ||
& { | ||
Write-Output "test.date: $(Get-Date -Date $Date -UFormat '%FT%R%Z' -AsUTC)" | ||
if ( $Note -ne '' ) { | ||
Write-Output "note: $Note" | ||
} | ||
Write-Output "test.command: $TestCmdPreamble" | ||
Write-Output "pkg.commit: $(git rev-parse HEAD)" | ||
} | Tee-Object -Append -FilePath $OutputFile | ||
} | ||
|
||
Write-Verbose "Running command: $TestCmd" | ||
Invoke-Expression $TestCmd | Tee-Object -Append -FilePath $OutputFile | ||
|
||
if ( $OutputCmd -ne '' -and $OutputFile -ne 'nul' ) { | ||
$oc = "$OutputCmd $OutputFile" | ||
Write-Verbose "Running command: $oc" | ||
Invoke-Expression $oc | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.