Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
| ... | ... |
@@ -390,21 +390,12 @@ jobs: |
| 390 | 390 |
name: Test integration-cli |
| 391 | 391 |
if: matrix.test != './...' |
| 392 | 392 |
run: | |
| 393 |
- & gotestsum ` |
|
| 394 |
- --format=standard-verbose ` |
|
| 395 |
- --jsonfile="./bundles/go-test-report-int-cli-tests.json" ` |
|
| 396 |
- --junitfile="./bundles/junit-report-int-cli-tests.xml" ` |
|
| 397 |
- --packages="./integration-cli/..." ` |
|
| 398 |
- -- ` |
|
| 399 |
- "-coverprofile" "./bundles/coverage-report-int-cli-tests.txt" ` |
|
| 400 |
- "-covermode" "atomic" ` |
|
| 401 |
- "-tags" "autogen" ` |
|
| 402 |
- "-test.run" "(${{ matrix.test }})/" `
|
|
| 403 |
- "-test.timeout" "200m" |
|
| 393 |
+ .\hack\make.ps1 -TestIntegrationCli |
|
| 404 | 394 |
env: |
| 405 | 395 |
DOCKER_HOST: npipe:////./pipe/docker_engine |
| 406 | 396 |
GO111MODULE: "off" |
| 407 | 397 |
TEST_CLIENT_BINARY: ${{ env.BIN_OUT }}\docker
|
| 398 |
+ INTEGRATION_TESTRUN: ${{ matrix.test }}
|
|
| 408 | 399 |
- |
| 409 | 400 |
name: Send to Codecov |
| 410 | 401 |
if: matrix.os == 'windows-2022' |
| ... | ... |
@@ -63,6 +63,9 @@ |
| 63 | 63 |
.PARAMETER TestIntegration |
| 64 | 64 |
Runs integration tests. |
| 65 | 65 |
|
| 66 |
+.PARAMETER TestIntegrationCli |
|
| 67 |
+ Runs integration-cli tests. |
|
| 68 |
+ |
|
| 66 | 69 |
.PARAMETER All |
| 67 | 70 |
Runs everything this script knows about that can run in a container. |
| 68 | 71 |
|
| ... | ... |
@@ -88,6 +91,7 @@ param( |
| 88 | 88 |
[Parameter(Mandatory=$False)][switch]$GoFormat, |
| 89 | 89 |
[Parameter(Mandatory=$False)][switch]$TestUnit, |
| 90 | 90 |
[Parameter(Mandatory=$False)][switch]$TestIntegration, |
| 91 |
+ [Parameter(Mandatory=$False)][switch]$TestIntegrationCli, |
|
| 91 | 92 |
[Parameter(Mandatory=$False)][switch]$All |
| 92 | 93 |
) |
| 93 | 94 |
|
| ... | ... |
@@ -383,6 +387,36 @@ Function Run-IntegrationTests() {
|
| 383 | 383 |
} |
| 384 | 384 |
} |
| 385 | 385 |
|
| 386 |
+# Run the integration-cli tests |
|
| 387 |
+Function Run-IntegrationCliTests() {
|
|
| 388 |
+ Write-Host "INFO: Running integration-cli tests..." |
|
| 389 |
+ |
|
| 390 |
+ $goTestRun = "" |
|
| 391 |
+ $reportSuffix = "" |
|
| 392 |
+ if ($env:INTEGRATION_TESTRUN.Length -ne 0) |
|
| 393 |
+ {
|
|
| 394 |
+ $goTestRun = "-test.run=($env:INTEGRATION_TESTRUN)/" |
|
| 395 |
+ $reportSuffixStream = [IO.MemoryStream]::new([byte[]][char[]]$env:INTEGRATION_TESTRUN) |
|
| 396 |
+ $reportSuffix = "-" + (Get-FileHash -InputStream $reportSuffixStream -Algorithm SHA256).Hash |
|
| 397 |
+ } |
|
| 398 |
+ |
|
| 399 |
+ $jsonFilePath = $bundlesDir + "\go-test-report-int-cli-tests$reportSuffix.json" |
|
| 400 |
+ $xmlFilePath = $bundlesDir + "\junit-report-int-cli-tests$reportSuffix.xml" |
|
| 401 |
+ $coverageFilePath = $bundlesDir + "\coverage-report-int-cli-tests$reportSuffix.txt" |
|
| 402 |
+ $goTestArg = "--format=standard-verbose --packages=./integration-cli/... --jsonfile=$jsonFilePath --junitfile=$xmlFilePath -- -coverprofile=$coverageFilePath -covermode=atomic -tags=autogen -test.timeout=200m $goTestRun $env:INTEGRATION_TESTFLAGS" |
|
| 403 |
+ Write-Host "INFO: Invoking integration-cli tests run with gotestsum.exe $goTestArg" |
|
| 404 |
+ $pinfo = New-Object System.Diagnostics.ProcessStartInfo |
|
| 405 |
+ $pinfo.FileName = "gotestsum.exe" |
|
| 406 |
+ $pinfo.WorkingDirectory = "$($PWD.Path)" |
|
| 407 |
+ $pinfo.UseShellExecute = $false |
|
| 408 |
+ $pinfo.Arguments = $goTestArg |
|
| 409 |
+ $p = New-Object System.Diagnostics.Process |
|
| 410 |
+ $p.StartInfo = $pinfo |
|
| 411 |
+ $p.Start() | Out-Null |
|
| 412 |
+ $p.WaitForExit() |
|
| 413 |
+ if ($p.ExitCode -ne 0) { Throw "integration-cli tests failed" }
|
|
| 414 |
+} |
|
| 415 |
+ |
|
| 386 | 416 |
# Start of main code. |
| 387 | 417 |
Try {
|
| 388 | 418 |
Write-Host -ForegroundColor Cyan "INFO: make.ps1 starting at $(Get-Date)" |
| ... | ... |
@@ -405,7 +439,7 @@ Try {
|
| 405 | 405 |
if ($Binary) { $Client = $True; $Daemon = $True }
|
| 406 | 406 |
|
| 407 | 407 |
# Default to building the daemon if not asked for anything explicitly. |
| 408 |
- if (-not($Client) -and -not($Daemon) -and -not($DCO) -and -not($PkgImports) -and -not($GoFormat) -and -not($TestUnit) -and -not($TestIntegration)) { $Daemon=$True }
|
|
| 408 |
+ if (-not($Client) -and -not($Daemon) -and -not($DCO) -and -not($PkgImports) -and -not($GoFormat) -and -not($TestUnit) -and -not($TestIntegration) -and -not($TestIntegrationCli)) { $Daemon=$True }
|
|
| 409 | 409 |
|
| 410 | 410 |
# Verify git is installed |
| 411 | 411 |
if ($(Get-Command git -ErrorAction SilentlyContinue) -eq $nil) { Throw "Git does not appear to be installed" }
|
| ... | ... |
@@ -501,6 +535,9 @@ Try {
|
| 501 | 501 |
# Run integration tests |
| 502 | 502 |
if ($TestIntegration) { Run-IntegrationTests }
|
| 503 | 503 |
|
| 504 |
+ # Run integration-cli tests |
|
| 505 |
+ if ($TestIntegrationCli) { Run-IntegrationCliTests }
|
|
| 506 |
+ |
|
| 504 | 507 |
# Gratuitous ASCII art. |
| 505 | 508 |
if ($Daemon -or $Client) {
|
| 506 | 509 |
Write-Host |