-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(tests): Refactor tests to support easily invoking AL2023 based …
…runtimes (#7251) * Initial al2023 test marking and AppVeyor yml file * Remove the matrix * Remove cache * Collect tests to test marker * Update test to consider use-container arg * Clean up markers * Refactored portions of build integ tests into two * Removed unused consts * Cache on job failures * Removed runtime method check from test base class * Fixed broken tests * Install ruby3.3 * Removed build cache * ls docker directory * Add runtime check back to node tests and cleaned appveyor configs * Fix condition check * Test ruby changes * Update path for ruby3.3 * Removed al2023 mark for terraform tests * Removed unused import * make pr * Check for docker test before checking runtime * Remove check from missing docker tests * chore: separate node,python builds into al2023 * chore: separate provided, java build tests into al2023 * remove runtime_supported_by_docker * update node version * update pytest name * update formatting * update test-files run * update tests * reformat * fix failing tests * separate test * update node test --------- Co-authored-by: Lucas <12496191+lucashuy@users.noreply.github.com>
- Loading branch information
1 parent
94407b0
commit 9c4c75b
Showing
14 changed files
with
1,669 additions
and
1,312 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
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,178 @@ | ||
version: 1.0.{build} | ||
image: ws2022-azure | ||
build: off | ||
|
||
clone_folder: C:\source | ||
|
||
environment: | ||
AWS_DEFAULT_REGION: us-east-1 | ||
SAM_CLI_DEV: 1 | ||
CARGO_LAMBDA_VERSION: "v0.17.1" | ||
|
||
# Python uses $TMPDIR envvar to find root of tempdir | ||
TMPDIR: "%TEMP%" | ||
TMP: "%TEMP%" | ||
|
||
# MSI Installers only use Py3.8. It is sufficient to test with this version here. | ||
PYTHON_HOME: "C:\\Python38-x64" | ||
PYTHON_SCRIPTS: "C:\\Python38-x64\\Scripts" | ||
PYTHON_EXE: "C:\\Python38-x64\\python.exe" | ||
PYTHON_ARCH: "64" | ||
HOME: 'C:\Users\appveyor' | ||
HOMEDRIVE: "C:" | ||
HOMEPATH: 'C:\Users\appveyor' | ||
NOSE_PARAMETERIZED_NO_WARN: 1 | ||
AWS_S3: "AWS_S3_TESTING" | ||
AWS_ECR: "AWS_ECR_TESTING" | ||
APPVEYOR_CONSOLE_DISABLE_PTY: true | ||
APPVEYOR_BUILD_WORKER_IMAGE: "ws2022-azure" | ||
|
||
init: | ||
# Uncomment this for RDP | ||
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) | ||
- ps: gcim Win32_Processor | % { "$($_.NumberOfLogicalProcessors) logical CPUs" } | ||
- ps: gcim Win32_OperatingSystem | % { "$([int]($_.TotalVisibleMemorySize/1mb)) Gb" } | ||
- git config --global core.autocrlf false | ||
- ps: New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force | ||
- ps: git config --system core.longpaths true | ||
|
||
install: | ||
# upgrade chocolately | ||
- choco upgrade chocolatey | ||
# setup make | ||
- "choco install make" | ||
# setup Java, Maven and Gradle | ||
- choco install correttojdk --version=21.0.0 | ||
- 'set JAVA_HOME=C:\Program Files\Amazon Corretto\jdk21.0.0_35' | ||
- 'set PATH=%JAVA_HOME%\bin;%PATH%' | ||
- java --version | ||
- javac --version | ||
- choco upgrade gradle --version=8.4.0 | ||
- "gradle -v" | ||
- "mvn --version" | ||
|
||
# Make sure the temp directory exists for Python to use. | ||
- ps: "mkdir -Force C:\\tmp" | ||
- 'set PATH=%PYTHON_HOME%;C:\Ruby33-x64\bin;C:\Ruby32-x64\bin;%PATH%;C:\Python39-x64;C:\Python310-x64;C:\Python311-x64;C:\Python312-x64' | ||
- "echo %PYTHON_HOME%" | ||
- "echo %PATH%" | ||
- "python --version" | ||
- "ruby --version" | ||
- ps: "Restart-Service docker" | ||
# Switch to Docker Linux containers | ||
- ps: '& $Env:ProgramFiles\Docker\Docker\DockerCli.exe -SwitchLinuxEngine' | ||
- "docker info" | ||
- "docker version" | ||
|
||
# Upgrade setuptools, wheel and virtualenv | ||
- "python -m pip install --upgrade setuptools wheel virtualenv" | ||
|
||
# Install Node 20 | ||
- ps: "Install-Product node 20" | ||
|
||
# Install AWS CLI Globally via pip3 | ||
- "pip install awscli" | ||
|
||
# Check for git executable | ||
- "git --version" | ||
|
||
# Get testing env vars | ||
- ps: " | ||
If (Test-Path env:BY_CANARY){ | ||
python -m virtualenv venv_env_vars; | ||
./venv_env_vars/Scripts/pip install boto3; | ||
$test_env_var = ./venv_env_vars/Scripts/python tests/get_testing_resources.py; | ||
$test_env_var_json = ConvertFrom-Json $test_env_var; | ||
$env:CI_ACCESS_ROLE_AWS_ACCESS_KEY_ID = $env:AWS_ACCESS_KEY_ID; | ||
$env:CI_ACCESS_ROLE_AWS_SECRET_ACCESS_KEY = $env:AWS_SECRET_ACCESS_KEY; | ||
$env:CI_ACCESS_ROLE_AWS_SESSION_TOKEN = $env:AWS_SESSION_TOKEN; | ||
$env:AWS_ACCESS_KEY_ID = $test_env_var_json.accessKeyID; | ||
$env:AWS_SECRET_ACCESS_KEY = $test_env_var_json.secretAccessKey; | ||
$env:AWS_SESSION_TOKEN = $test_env_var_json.sessionToken; | ||
$env:TASK_TOKEN = $test_env_var_json.taskToken; | ||
$env:AWS_S3_TESTING = $test_env_var_json.TestBucketName; | ||
$env:AWS_ECR_TESTING = $test_env_var_json.TestECRURI; | ||
$env:AWS_KMS_KEY = $test_env_var_json.TestKMSKeyArn; | ||
$env:AWS_SIGNING_PROFILE_NAME = $test_env_var_json.TestSigningProfileName; | ||
$env:AWS_SIGNING_PROFILE_VERSION_ARN = $test_env_var_json.TestSigningProfileARN; | ||
}" | ||
|
||
|
||
# Create new virtual environment with chosen python version and activate it | ||
- "python -m virtualenv venv" | ||
- "venv\\Scripts\\activate" | ||
- "python --version" | ||
|
||
# Actually install SAM CLI's dependencies | ||
- 'pip install -e ".[dev]"' | ||
|
||
# Install aws cli | ||
- "pip install awscli" | ||
|
||
# Echo final Path | ||
- "echo %PATH%" | ||
|
||
# use amazon-ecr-credential-helper | ||
- choco install amazon-ecr-credential-helper | ||
- ps: "ls $env:HOME/.docker" | ||
- ps: " | ||
$docker_config = Get-Content $env:HOME/.docker/config.json -raw | ConvertFrom-Json; | ||
$docker_config.credsStore = 'ecr-login'; | ||
$docker_config | ConvertTo-Json | set-content $env:HOME/.docker/config.json; | ||
" | ||
- ps: "get-content $env:HOME/.docker/config.json" | ||
|
||
# claim some disk space before starting the tests | ||
- "docker system prune -a -f" | ||
# activate virtual environment | ||
- "venv\\Scripts\\activate" | ||
|
||
|
||
|
||
# Final clean up no matter success or failure | ||
on_finish: | ||
# Upload test reports as artifacts | ||
- ps: Get-ChildItem .\TEST_REPORT-*.json | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } | ||
- ps: ' | ||
If (Test-Path env:BY_CANARY){ | ||
$env:AWS_ACCESS_KEY_ID = $env:TEST_REPORT_S3_BUCKET_ACCESS_KEY_ID; | ||
$env:AWS_SECRET_ACCESS_KEY = $env:TEST_REPORT_S3_BUCKET_SECRET_ACCESS_KEY; | ||
$env:AWS_SESSION_TOKEN = $env:TEST_REPORT_S3_BUCKET_SESSION_TOKEN; | ||
aws s3 cp ".\" "s3://$env:TEST_REPORT_S3_BUCKET_NAME/appveyor/$env:APPVEYOR_PROJECT_SLUG/$env:APPVEYOR_BUILD_ID/$env:APPVEYOR_JOB_ID/" --recursive --exclude "*" --include "TEST_REPORT-*.json" --region us-west-2 | ||
}' | ||
|
||
# notify success | ||
- ps: " | ||
If (Test-Path env:BY_CANARY){ | ||
$env:AWS_ACCESS_KEY_ID = $env:CI_ACCESS_ROLE_AWS_ACCESS_KEY_ID; | ||
$env:AWS_SECRET_ACCESS_KEY = $env:CI_ACCESS_ROLE_AWS_SECRET_ACCESS_KEY; | ||
$env:AWS_SESSION_TOKEN = $env:CI_ACCESS_ROLE_AWS_SESSION_TOKEN; | ||
aws stepfunctions send-task-success --task-token \"$env:TASK_TOKEN\" --task-output \"{}\" --region us-west-2; | ||
}" | ||
|
||
build_script: | ||
# install Rust in build_script to not override the default "install" actions | ||
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe | ||
- rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain stable | ||
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin | ||
- set RUST_BACKTRACE=1 | ||
- rustup toolchain install stable --profile minimal --no-self-update | ||
- rustup default stable | ||
- rustup target add x86_64-unknown-linux-gnu --toolchain stable | ||
- rustup target add aarch64-unknown-linux-gnu --toolchain stable | ||
- ps: "choco install zig" | ||
- ps: Invoke-WebRequest -Uri https://github.com/cargo-lambda/cargo-lambda/releases/download/$env:CARGO_LAMBDA_VERSION/cargo-lambda-$env:CARGO_LAMBDA_VERSION.windows-x64.zip -OutFile C:\Users\appveyor\cargo-lambda.zip | ||
- ps: Expand-Archive -DestinationPath C:\Users\appveyor\.cargo\bin C:\Users\appveyor\cargo-lambda.zip | ||
- rustc -V | ||
- cargo -V | ||
- cargo lambda -V | ||
|
||
test_script: | ||
- ps: "pytest -vv -n 2 --reruns 3 -m 'al2023' tests/integration/buildcmd --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json" | ||
|
||
# Uncomment for RDP | ||
# on_finish: | ||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,4 @@ markers = | |
python | ||
provided | ||
dotnet | ||
al2023: Marker to note tests that require a newer Docker version on Windows |
Oops, something went wrong.