component-test.ps1 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. Set-StrictMode -Version Latest
  2. $ErrorActionPreference = "Stop"
  3. $ProgressPreference = "SilentlyContinue"
  4. $WorkingDirectory = Get-Location
  5. $CloudflaredDirectory = "$WorkingDirectory\go\src\github.com\cloudflare\cloudflared"
  6. go env
  7. go version
  8. $env:TARGET_OS = "windows"
  9. $env:CGO_ENABLED = 1
  10. $env:TARGET_ARCH = "amd64"
  11. $env:Path = "$Env:Temp\go\bin;$($env:Path)"
  12. python --version
  13. python -m pip --version
  14. cd $CloudflaredDirectory
  15. go env
  16. go version
  17. Write-Output "Building cloudflared"
  18. & make cloudflared
  19. if ($LASTEXITCODE -ne 0) { throw "Failed to build cloudflared" }
  20. echo $LASTEXITCODE
  21. Write-Output "Running unit tests"
  22. # Not testing with race detector because of https://github.com/golang/go/issues/61058
  23. # We already test it on other platforms
  24. & go test -failfast -mod=vendor ./...
  25. if ($LASTEXITCODE -ne 0) { throw "Failed unit tests" }
  26. Write-Output "Running component tests"
  27. python -m pip --disable-pip-version-check install --upgrade -r component-tests/requirements.txt --use-pep517
  28. python component-tests/setup.py --type create
  29. python -m pytest component-tests -o log_cli=true --log-cli-level=INFO
  30. if ($LASTEXITCODE -ne 0) {
  31. python component-tests/setup.py --type cleanup
  32. throw "Failed component tests"
  33. }
  34. python component-tests/setup.py --type cleanup