From 5ee7ecca397f2f32c1e176d31ae64e0067eaf0d8 Mon Sep 17 00:00:00 2001 From: Vichy Meas Date: Fri, 2 Oct 2026 00:13:58 +0000 Subject: [PATCH] test: migrate credential-test gating from branch-name proxy to requires_credential marker Replace the legacy per-test credential gate -- SKIP_* = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY -- with the @pytest.mark.requires_credential marker, now that CI runs exclusively on GitHub Actions and AppVeyor is retired. Changes: - Register requires_credential + tiering markers in pytest.ini. - Collapse 25 copies of the branch-name idiom; the branch term was a proven no-op (BY_CANARY is workflow-wide in the only master-triggered workflow). Drop the dead AppVeyor env reads; RUNNING_ON_CI now reads CI directly. - Mark all 43 credential-gated classes with @pytest.mark.requires_credential, then delete every credential @skipIf gate, the SKIP_CREDENTIAL_TESTS flag, the alias imports, and the dead setUpClass runtime guard. Compound gates keep their non-credential condition (IS_WINDOWS, IS_TARGETTED_PYTHON_VERSION). - Filter the two no-credential PR lanes in build.yml (integ-all-other and the buildcmd catch-all) with 'not requires_credential' so credential tests are deselected where no AWS credentials exist. integration-tests.yml already filters correctly (cloud-based-tests selects requires_credential; the credential-free suites exclude it). - Retire the 5 appveyor-*.yml files and the installer appveyor cleanup steps. Verified: full tree collects (2433) under --strict-markers; the no-credential lanes deselect exactly the set the canary lane selects; no credential test runs without credentials in any lane. --- .github/workflows/build.yml | 4 +- appveyor-linux-binary.yml | 301 --------- appveyor-ubuntu.yml | 582 ------------------ appveyor-windows-al2023.yml | 189 ------ appveyor-windows-binary.yml | 321 ---------- appveyor-windows.yml | 307 --------- installer/pyinstaller/build-linux.sh | 1 - installer/pyinstaller/build-mac.sh | 1 - pytest.ini | 5 + tests/end_to_end/test_runtimes_e2e.py | 13 +- tests/integration/buildcmd/test_build_cmd.py | 3 - .../buildcmd/test_build_cmd_java.py | 4 - .../buildcmd/test_build_cmd_node.py | 3 - .../buildcmd/test_build_cmd_provided.py | 4 - .../buildcmd/test_build_cmd_python.py | 3 - .../integration/delete/test_delete_command.py | 12 +- .../integration/deploy/test_deploy_command.py | 9 +- .../deploy/test_managed_stack_deploy.py | 8 +- .../schemas/test_init_with_schemas_command.py | 6 +- tests/integration/init/test_init_command.py | 6 +- .../local/invoke/invoke_cdk_templates.py | 6 +- .../local/invoke/test_integrations_cli.py | 15 +- .../local/invoke/test_integrations_do_cli.py | 6 - tests/integration/logs/logs_integ_base.py | 9 +- .../package/test_package_command_image.py | 10 +- ...est_package_command_language_extensions.py | 6 +- .../package/test_package_command_zip.py | 8 +- .../pipeline/test_bootstrap_command.py | 11 +- .../integration/pipeline/test_init_command.py | 6 +- .../integration/publish/test_command_integ.py | 10 +- tests/integration/sync/test_sync_adl.py | 11 +- tests/integration/sync/test_sync_code.py | 22 +- tests/integration/sync/test_sync_infra.py | 18 +- tests/integration/sync/test_sync_watch.py | 18 +- .../integration/traces/test_traces_command.py | 8 +- .../validate/test_validate_command.py | 12 +- .../test_validate_language_extensions.py | 10 +- .../deploy/test_deploy_regression.py | 9 +- .../package/test_package_regression.py | 9 +- tests/testing_utils.py | 8 +- 40 files changed, 91 insertions(+), 1903 deletions(-) delete mode 100644 appveyor-linux-binary.yml delete mode 100644 appveyor-ubuntu.yml delete mode 100644 appveyor-windows-al2023.yml delete mode 100644 appveyor-windows-binary.yml delete mode 100644 appveyor-windows.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e6d824b12f3..0c94ab742cf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -132,11 +132,11 @@ jobs: - name: "integ-buildcmd-java" params: "-n 3 --reruns 5 tests/integration/buildcmd/test_build_cmd_java.py" - name: "integ-buildcmd-other" - params: "-n 2 --reruns 3 tests/integration/buildcmd --ignore=tests/integration/buildcmd/test_build_cmd_arm64.py --ignore=tests/integration/buildcmd/test_build_cmd_dotnet.py --ignore=tests/integration/buildcmd/test_build_cmd_provided.py --ignore=tests/integration/buildcmd/test_build_cmd_rust.py --ignore=tests/integration/buildcmd/test_build_cmd_python.py --ignore=tests/integration/buildcmd/test_build_cmd_node.py --ignore=tests/integration/buildcmd/test_build_cmd_java.py" + params: "-n 2 --reruns 3 -m 'not requires_credential' tests/integration/buildcmd --ignore=tests/integration/buildcmd/test_build_cmd_arm64.py --ignore=tests/integration/buildcmd/test_build_cmd_dotnet.py --ignore=tests/integration/buildcmd/test_build_cmd_provided.py --ignore=tests/integration/buildcmd/test_build_cmd_rust.py --ignore=tests/integration/buildcmd/test_build_cmd_python.py --ignore=tests/integration/buildcmd/test_build_cmd_node.py --ignore=tests/integration/buildcmd/test_build_cmd_java.py" #- "delete" #- "deploy" - name: "integ-all-other" - params: "-n 2 --reruns 3 -m 'not pr_skip' tests/integration/init tests/integration/local tests/integration/pipeline tests/integration/root tests/integration/scripts tests/integration/telemetry tests/integration/docs --ignore=tests/integration/local/invoke/test_invoke_durable.py --ignore=tests/integration/local/start_api/test_start_api_durable.py --ignore=tests/integration/local/start_lambda/test_start_lambda_durable.py" + params: "-n 2 --reruns 3 -m 'not pr_skip and not requires_credential' tests/integration/init tests/integration/local tests/integration/pipeline tests/integration/root tests/integration/scripts tests/integration/telemetry tests/integration/docs --ignore=tests/integration/local/invoke/test_invoke_durable.py --ignore=tests/integration/local/start_api/test_start_api_durable.py --ignore=tests/integration/local/start_lambda/test_start_lambda_durable.py" - name: "durable-functions" params: "--reruns 3 tests/integration/local/invoke/test_invoke_durable.py tests/integration/local/start_api/test_start_api_durable.py tests/integration/local/start_lambda/test_start_lambda_durable.py" #- "list" diff --git a/appveyor-linux-binary.yml b/appveyor-linux-binary.yml deleted file mode 100644 index 37391728563..00000000000 --- a/appveyor-linux-binary.yml +++ /dev/null @@ -1,301 +0,0 @@ -version: 1.0.{build} -image: - - Ubuntu2204 - -configuration: - - BuildIntegTesting - - BuildIntegTestingJavaPythonProvided - - BuildIntegTestingArm64 - - BuildIntegTestingArm64Java - - AllTerraformBuildTesting - - PackageAndDeleteAndDeployIntegTesting - - SyncIntegTesting - - LocalInvokeIntegTesting - - LocalStartIntegTesting - # other Integration testing, Dev, regression and smoke testing - - OtherAndEndToEndTesting - -environment: - PYTHON_HOME: "$HOME/venv3.11/bin" - PYTHON_VERSION: '3.11' - AWS_DEFAULT_REGION: us-east-1 - NODE_VERSION: "18.18.2" - AWS_S3: 'AWS_S3_TESTING' - AWS_ECR: 'AWS_ECR_TESTING' - CARGO_LAMBDA_VERSION: "v0.17.1" - PYTHON_ARCH: '64' - NOSE_PARAMETERIZED_NO_WARN: 1 - APPVEYOR_CONSOLE_DISABLE_PTY: false - APPVEYOR_DETAILED_SHELL_LOGGING: true - -install: - # AppVeyor's apt-get cache might be outdated, and the package could potentially be 404. - - sh: "sudo apt-get update --allow-releaseinfo-change" - - # install coretto 21 - - sh: wget -O - https://apt.corretto.aws/corretto.key | sudo gpg --dearmor -o /usr/share/keyrings/corretto-keyring.gpg - - sh: echo "deb [signed-by=/usr/share/keyrings/corretto-keyring.gpg] https://apt.corretto.aws stable main" | sudo tee /etc/apt/sources.list.d/corretto.list - - sh: sudo apt-get update; sudo apt-get install -y java-25-amazon-corretto-jdk - - sh: JAVA_HOME=/usr/lib/jvm/java-25-amazon-corretto - - sh: PATH=$JAVA_HOME/bin:$PATH - - sh: java --version - - sh: javac --version - - - sh: "gvm use go1.19" - - sh: "echo $PATH" - - sh: "ls /usr/" - # install latest maven which is compatible with jdk17 - - sh: "sudo apt-get -y remove maven" - - sh: "wget https://dlcdn.apache.org/maven/maven-3/3.9.14/binaries/apache-maven-3.9.14-bin.zip -P /tmp" - - sh: "sudo unzip -d /opt/mvn /tmp/apache-maven-*.zip" - - sh: "PATH=/opt/mvn/apache-maven-3.9.14/bin:$PATH" - - sh: "mvn --version" - - - sh: "source ${HOME}/venv${PYTHON_VERSION}/bin/activate" - - sh: "git -C ~/.rbenv/plugins/ruby-build pull" - - sh: "rbenv install 3.3.7" - - sh: "rbenv install 3.4.7" - - sh: "rbenv install 3.2.7" - - sh: "rbenv global 3.3.7" - - sh: "ruby --version" - - sh: "docker info" - - sh: "docker version" - - sh: "nvm install ${NODE_VERSION}" - - sh: "npm install npm@10.2.3 -g" - - sh: "npm -v" - - # Install latest gradle - - sh: "sudo apt-get -y remove gradle" - - sh: "wget https://services.gradle.org/distributions/gradle-9.0.0-bin.zip -P /tmp" - - sh: "sudo unzip -d /opt/gradle /tmp/gradle-*.zip" - - sh: "PATH=/opt/gradle/gradle-9.0.0/bin:$PATH" - - sh: "gradle --version" - - # Install dotnet10 SDK (backwards compatible so it works to build all previous versions) - # https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu-install?tabs=dotnet10&pivots=os-linux-ubuntu-2204 - - sh: "sudo add-apt-repository ppa:dotnet/backports" - - sh: "sudo apt-get update" - - sh: "sudo apt-get install -y dotnet-sdk-10.0" - - # Install AWS CLI - - sh: "virtualenv aws_cli" - - sh: "./aws_cli/bin/python -m pip install awscli" - - sh: "PATH=$(echo $PWD'/aws_cli/bin'):$PATH" - - # install python 3.14 - - sh: | - DEST="$HOME/venv3.14" - URL="https://github.com/astral-sh/python-build-standalone/releases/download/20251031/cpython-3.14.0+20251031-x86_64-unknown-linux-gnu-install_only.tar.gz" - curl -L "$URL" | tar -xz - mv python $DEST - $HOME/venv3.14/bin/python --version - $HOME/venv3.14/bin/pip --version - - - sh: "PATH=$PATH:$HOME/venv3.9/bin:$HOME/venv3.10/bin:$HOME/venv3.11/bin:$HOME/venv3.12/bin:$HOME/venv3.13/bin:$HOME/venv3.14/bin" - - # Install pytest - - sh: "python3.10 -m venv $HOME/pytest" - - sh: "$HOME/pytest/bin/pip install uv" - - sh: "$HOME/pytest/bin/uv pip install --python $HOME/pytest/bin/python3 --only-deps --extra dev '.'" - - sh: "PATH=$HOME/pytest/bin:$PATH" - - sh: "pytest --version" - - # update ca-certificates which causes failures with newest golang library - - sh: "sudo apt-get install --reinstall ca-certificates" - - # get testing env vars - - sh: "sudo apt install -y jq" - - # install Rust - - sh: "curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL https://sh.rustup.rs | sh -s -- --default-toolchain none -y > /dev/null 2>&1" - - sh: "source $HOME/.cargo/env" - - sh: "rustup toolchain install stable --profile minimal --no-self-update" - - sh: "rustup default stable" - - sh: "rustup target add x86_64-unknown-linux-gnu --toolchain stable" - - sh: "rustup target add aarch64-unknown-linux-gnu --toolchain stable" - - sh: "pip install cargo-lambda==$CARGO_LAMBDA_VERSION" - - sh: "rustc -V" - - sh: "cargo -V" - - sh: "cargo lambda -V" - - - sh: "python3.9 -m venv .venv_env_vars" - - sh: ".venv_env_vars/bin/pip install boto3" - - sh: "test_env_var=$(.venv_env_vars/bin/python tests/get_testing_resources.py)" - - sh: ' - if [ $? -ne 0 ]; then - echo "get_testing_resources failed. Failed to acquire credentials or test resources."; - false; - fi - ' - - - sh: 'export CI_ACCESS_ROLE_AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID' - - sh: 'export CI_ACCESS_ROLE_AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY' - - sh: 'export CI_ACCESS_ROLE_AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN' - - - sh: 'export AWS_ACCESS_KEY_ID=$(echo "$test_env_var" | jq -j ".accessKeyID")' - - sh: 'export AWS_SECRET_ACCESS_KEY=$(echo "$test_env_var" | jq -j ".secretAccessKey")' - - sh: 'export AWS_SESSION_TOKEN=$(echo "$test_env_var" | jq -j ".sessionToken")' - - sh: 'export TASK_TOKEN=$(echo "$test_env_var" | jq -j ".taskToken")' - - sh: 'export AWS_S3_TESTING=$(echo "$test_env_var" | jq -j ".TestBucketName")' - - sh: 'export AWS_ECR_TESTING=$(echo "$test_env_var" | jq -j ".TestECRURI")' - - sh: 'export AWS_KMS_KEY=$(echo "$test_env_var" | jq -j ".TestKMSKeyArn")' - - sh: 'export AWS_SIGNING_PROFILE_NAME=$(echo "$test_env_var" | jq -j ".TestSigningProfileName")' - - sh: 'export AWS_SIGNING_PROFILE_VERSION_ARN=$(echo "$test_env_var" | jq -j ".TestSigningProfileARN")' - - # required for RIE with arm64 in linux - - sh: " - if [[ -n $BY_CANARY ]] && [[ -n $DOCKER_USER ]] && [[ -n $DOCKER_PASS ]]; - then echo Logging in Docker Hub; echo $DOCKER_PASS | docker login --username $DOCKER_USER --password-stdin registry-1.docker.io; - fi" - - sh: " - if [[ -n $BY_CANARY ]] && [[ -n $DOCKER_USER ]] && [[ -n $DOCKER_PASS ]]; - then echo Logging in Docker Hub; echo $DOCKER_PASS | docker login --username $DOCKER_USER --password-stdin; - fi" - - sh: "docker run --rm --privileged multiarch/qemu-user-static --reset -p yes" - - - # Runs only in Linux, logging Public ECR when running canary and cred is available - - sh: " - if [[ -n $BY_CANARY ]]; - then echo Logging in Public ECR; aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws; - fi" - - -build_script: - - curl -L https://github.com/aws/aws-sam-cli/releases/download/sam-cli-nightly/aws-sam-cli-linux-x86_64.zip -o aws-sam-cli-linux-x86_64.zip - - unzip aws-sam-cli-linux-x86_64.zip -d sam-installation - - sudo ./sam-installation/install - # rename `sam-nightly` binary to `sam` - - sudo mv /usr/local/bin/sam-nightly /usr/local/bin/sam - - sam --version - -# Final clean up no matter success or failure -on_finish: - # Upload test reports as artifacts - - sh: find "$APPVEYOR_BUILD_FOLDER" -type f -name 'TEST_REPORT-*.json' -print0 | xargs -0 -I '{}' appveyor PushArtifact '{}' - - sh: > - AWS_ACCESS_KEY_ID=$TEST_REPORT_S3_BUCKET_ACCESS_KEY_ID - AWS_SECRET_ACCESS_KEY=$TEST_REPORT_S3_BUCKET_SECRET_ACCESS_KEY - AWS_SESSION_TOKEN=$TEST_REPORT_S3_BUCKET_SESSION_TOKEN - aws s3 cp "$APPVEYOR_BUILD_FOLDER" "s3://$TEST_REPORT_S3_BUCKET_NAME/appveyor/$APPVEYOR_PROJECT_SLUG/$APPVEYOR_BUILD_ID/$APPVEYOR_JOB_ID/" --recursive --exclude "*" --include "TEST_REPORT-*.json" --region us-west-2 - - # notify task success - - sh: 'export AWS_ACCESS_KEY_ID=$CI_ACCESS_ROLE_AWS_ACCESS_KEY_ID' - - sh: 'export AWS_SECRET_ACCESS_KEY=$CI_ACCESS_ROLE_AWS_SECRET_ACCESS_KEY' - - sh: 'export AWS_SESSION_TOKEN=$CI_ACCESS_ROLE_AWS_SESSION_TOKEN' - - # When we update to AWS CLI v2, we need to add the `--cli-binary-format raw-in-base64-out` option to pass the payload as a JSON string - - sh: > - aws lambda invoke --function-name "$ACCOUNT_RESET_LAMBDA_ARN" --payload "{\"taskToken\": \"$TASK_TOKEN\", \"output\": \"{}\"}" ./lambda-output.txt --region us-west-2 - - sh: 'cat ./lambda-output.txt' - -for: - # Integ testing build - - - matrix: - only: - - configuration: BuildIntegTesting - - test_script: - - sh: "pytest -vv -n 2 --reruns 3 tests/integration/buildcmd -m 'not java and not python and not provided' --ignore=tests/integration/buildcmd/test_build_cmd_arm64.py --ignore=tests/integration/buildcmd/test_build_terraform_applications.py --ignore=tests/integration/buildcmd/test_build_terraform_applications_other_cases.py --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json" - - - matrix: - only: - - configuration: BuildIntegTestingJavaPythonProvided - - test_script: - - sh: "pytest -vv -n 2 --reruns 3 tests/integration/buildcmd -m 'java or python or provided' --ignore=tests/integration/buildcmd/test_build_cmd_arm64.py --ignore=tests/integration/buildcmd/test_build_terraform_applications.py --ignore=tests/integration/buildcmd/test_build_terraform_applications_other_cases.py --json-report --json-report-file=TEST_REPORT-integration-buildcmd-java-python-provided.json" - - # Integ testing build arm64 functions - - matrix: - only: - - configuration: BuildIntegTestingArm64 - - test_script: - - sh: "pytest -vv --reruns 3 tests/integration/buildcmd/test_build_cmd_arm64.py -m 'not java' --json-report --json-report-file=TEST_REPORT-integration-buildcmd-arm64.json" - - - matrix: - only: - - configuration: BuildIntegTestingArm64Java - - test_script: - - sh: "pytest -vv --reruns 3 tests/integration/buildcmd/test_build_cmd_arm64.py -m 'java' --json-report --json-report-file=TEST_REPORT-integration-buildcmd-arm64-java.json" - - # Integ testing Terraform build - - - matrix: - only: - - configuration: AllTerraformBuildTesting - - test_script: - # install Terraform - - sh: "sudo apt update --allow-releaseinfo-change" - - sh: "TER_VER=`curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest | grep tag_name | cut -d: -f2 | tr -d \\\"\\,\\v | awk '{$1=$1};1'`" - - sh: "wget https://releases.hashicorp.com/terraform/${TER_VER}/terraform_${TER_VER}_linux_amd64.zip -P /tmp" - - sh: "sudo unzip -d /opt/terraform /tmp/terraform_${TER_VER}_linux_amd64.zip" - - sh: "sudo mv /opt/terraform/terraform /usr/local/bin/" - - sh: "terraform -version" - - - sh: "pytest -vv -n 4 --reruns 4 tests/integration/buildcmd/test_build_terraform_applications.py tests/integration/buildcmd/test_build_terraform_applications_other_cases.py --json-report --json-report-file=TEST_REPORT-integration-terraform.json" - - # Integ testing package & delete - - - matrix: - only: - - configuration: PackageAndDeleteAndDeployIntegTesting - - test_script: - - sh: "pytest -vv tests/integration/package tests/integration/delete tests/integration/deploy --dist=loadgroup -n 4 --reruns 4 --json-report --json-report-file=TEST_REPORT-integration-package-delete-deploy.json" - - # Integ testing sync - - - matrix: - only: - - configuration: SyncIntegTesting - - test_script: - - sh: "pytest -vv tests/integration/sync -n 3 --reruns 3 --dist loadscope --json-report --json-report-file=TEST_REPORT-integration-sync.json" - - # Integ testing local - - - matrix: - only: - - configuration: LocalInvokeIntegTesting - - test_script: - # install Terraform - - sh: "sudo apt update --allow-releaseinfo-change" - - sh: "TER_VER=`curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest | grep tag_name | cut -d: -f2 | tr -d \\\"\\,\\v | awk '{$1=$1};1'`" - - sh: "wget https://releases.hashicorp.com/terraform/${TER_VER}/terraform_${TER_VER}_linux_amd64.zip -P /tmp" - - sh: "sudo unzip -d /opt/terraform /tmp/terraform_${TER_VER}_linux_amd64.zip" - - sh: "sudo mv /opt/terraform/terraform /usr/local/bin/" - - sh: "terraform -version" - - - sh: "pytest -vv --reruns 3 tests/integration/local/invoke tests/integration/local/generate_event --json-report --json-report-file=TEST_REPORT-integration-local.json" - - # Integ testing local - - - matrix: - only: - - configuration: LocalStartIntegTesting - - test_script: - # install Terraform - - sh: "sudo apt update --allow-releaseinfo-change" - - sh: "TER_VER=`curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest | grep tag_name | cut -d: -f2 | tr -d \\\"\\,\\v | awk '{$1=$1};1'`" - - sh: "wget https://releases.hashicorp.com/terraform/${TER_VER}/terraform_${TER_VER}_linux_amd64.zip -P /tmp" - - sh: "sudo unzip -d /opt/terraform /tmp/terraform_${TER_VER}_linux_amd64.zip" - - sh: "sudo mv /opt/terraform/terraform /usr/local/bin/" - - sh: "terraform -version" - - - sh: "pytest -vv --reruns 3 tests/integration/local/start_api tests/integration/local/start_lambda --json-report --json-report-file=TEST_REPORT-integration-local-start.json" - - # Other testing - - - matrix: - only: - - configuration: OtherAndEndToEndTesting - - test_script: - - sh: "pytest -vv -n 4 --reruns 4 --dist loadgroup tests/integration tests/end_to_end --ignore=tests/integration/buildcmd --ignore=tests/integration/delete --ignore=tests/integration/deploy --ignore=tests/integration/package --ignore=tests/integration/sync --ignore=tests/integration/local --json-report --json-report-file=TEST_REPORT-integration-others.json" - - sh: "pytest -vv --reruns 3 tests/regression --json-report --json-report-file=TEST_REPORT-regression.json" diff --git a/appveyor-ubuntu.yml b/appveyor-ubuntu.yml deleted file mode 100644 index e6d762046b1..00000000000 --- a/appveyor-ubuntu.yml +++ /dev/null @@ -1,582 +0,0 @@ -version: 1.0.{build} -image: - - Ubuntu2204 - -configuration: - - BuildIntegTesting - - BuildIntegTestingJavaPythonProvided - - BuildIntegTestingArm64 - - BuildIntegTestingArm64Java - - AllTerraformBuildTesting - - PackageAndDeleteAndDeployIntegTesting - - SyncIntegTesting - - LocalInvokeIntegTesting - - LocalStartIntegTesting - # other Integration testing, Dev, regression and smoke testing - - OtherAndEndToEndTesting - -environment: - # Common variables (inherited by all matrix jobs) - PYTHON_HOME: "$HOME/venv3.9/bin" - PYTHON_VERSION: "3.9" - AWS_DEFAULT_REGION: us-east-1 - SAM_CLI_DEV: 1 - SAM_CLI_TELEMETRY: 0 - SAM_CLI_CONTAINER_CONNECTION_TIMEOUT: 60 - NODE_VERSION: "18.18.2" - AWS_S3: "AWS_S3_TESTING" - AWS_ECR: "AWS_ECR_TESTING" - CARGO_LAMBDA_VERSION: "v0.17.1" - PYTHON_ARCH: "64" - NOSE_PARAMETERIZED_NO_WARN: 1 - APPVEYOR_CONSOLE_DISABLE_PTY: false - APPVEYOR_DETAILED_SHELL_LOGGING: true - - # Matrix creates separate jobs for each runtime - matrix: - - CONTAINER_RUNTIME: docker - # All common variables inherited, no additional Docker-specific variables needed - - - CONTAINER_RUNTIME: finch - # All common variables inherited, no additional Finch-specific variables needed - -install: - # AppVeyor's apt-get cache might be outdated, and the package could potentially be 404. - - sh: "sudo apt-get update --allow-releaseinfo-change" - - # install coretto 25 - - sh: wget -O - https://apt.corretto.aws/corretto.key | sudo gpg --dearmor -o /usr/share/keyrings/corretto-keyring.gpg - - sh: echo "deb [signed-by=/usr/share/keyrings/corretto-keyring.gpg] https://apt.corretto.aws stable main" | sudo tee /etc/apt/sources.list.d/corretto.list - - sh: sudo apt-get update; sudo apt-get install -y java-25-amazon-corretto-jdk - - sh: JAVA_HOME=/usr/lib/jvm/java-25-amazon-corretto - - sh: PATH=$JAVA_HOME/bin:$PATH - - sh: java --version - - sh: javac --version - - - sh: "gvm use go1.19" - - sh: "echo $PATH" - - sh: "ls /usr/" - # install latest maven which is compatible with jdk17 - - sh: "sudo apt-get -y remove maven" - - sh: "wget https://dlcdn.apache.org/maven/maven-3/3.9.14/binaries/apache-maven-3.9.14-bin.zip -P /tmp" - - sh: "sudo unzip -d /opt/mvn /tmp/apache-maven-*.zip" - - sh: "PATH=/opt/mvn/apache-maven-3.9.14/bin:$PATH" - - sh: "mvn --version" - - # Finch Runtime Setup (Steps 1-7) - - sh: | - if [ "$CONTAINER_RUNTIME" = "finch" ]; then - echo "=== Initializing Finch runtime ===" - echo "Selected container runtime: $CONTAINER_RUNTIME" - - # Step 1: Stop Docker services for Finch - echo "Stopping Docker services for Finch runtime..." - sudo systemctl stop docker || echo "Warning: Docker stop failed, continuing..." - sudo systemctl stop docker.socket || echo "Warning: Docker socket stop failed, continuing..." - sudo systemctl disable docker || true - sudo systemctl disable docker.socket || true - echo "Docker services stopped successfully" - - # Step 2: Install Finch GPG key - echo "Installing Finch GPG key..." - GPG_SUCCESS=false - for i in {1..3}; do - if curl -fsSL https://artifact.runfinch.com/deb/GPG_KEY.pub | sudo gpg --dearmor -o /usr/share/keyrings/runfinch-finch-archive-keyring.gpg; then - GPG_SUCCESS=true - echo "Finch GPG key installed successfully" - break - else - echo "GPG key installation attempt $i failed, retrying..." - sleep 10 - fi - done - - if [ "$GPG_SUCCESS" = "false" ]; then - echo "FATAL: Failed to install Finch GPG key after 3 attempts" - exit 1 - fi - - # Step 3: Add Finch repository and update apt - echo "Adding Finch repository..." - echo 'deb [signed-by=/usr/share/keyrings/runfinch-finch-archive-keyring.gpg arch=amd64] https://artifact.runfinch.com/deb noble main' | sudo tee /etc/apt/sources.list.d/runfinch-finch.list - sudo apt update || { echo "FATAL: Failed to update apt after adding Finch repository"; exit 1; } - echo "Finch repository added and apt updated successfully" - - # Step 4: Install Finch package - echo "Installing Finch package..." - if sudo apt install -y runfinch-finch; then - echo "Finch package installed successfully" - else - echo "FATAL: Failed to install Finch package" - exit 1 - fi - - # Step 5: Start Finch service - echo "Enable and start Finch service..." - sudo systemctl enable --now finch || { echo "FATAL: Failed to enable and start Finch service"; exit 1; } - - echo "Enable and start Finch Buildkit service..." - sudo systemctl enable --now finch-buildkit || { echo "FATAL: Failed to enable and start Finch BuildKit service"; exit 1; } - - # Give Finch a moment to initialize - sleep 3 - - echo "Checking finch and finch-buildkit status..." - sudo systemctl --no-pager status finch - sudo systemctl --no-pager status finch-buildkit - - # Verify service is active - if ! sudo systemctl is-active finch >/dev/null 2>&1; then - echo "FATAL: Finch service is not active after start" - sudo systemctl status finch - exit 1 - fi - echo "Finch service started and is active" - - # Step 6: Set Finch socket permissions for SAM CLI - # Create finch group and add user for socket access - if [ -S /var/run/finch.sock ]; then - sudo chmod 666 /var/run/finch.sock - else - echo "⚠ Finch socket not found at /var/run/finch.sock - this may cause SAM CLI failures" - echo "Available sockets:" - find /var/run /run -name "*.sock" -type s 2>/dev/null | head -10 || echo "No sockets found" - fi - - # Step 7: Wait for Finch to be ready and display info - echo "Waiting for Finch to be ready..." - RUNTIME_READY=false - for i in {1..12}; do - if sudo finch info >/dev/null 2>&1; then - RUNTIME_READY=true - break - fi - echo "Finch not ready, waiting... (attempt $i/12)" - sleep 5 - done - - if [ "$RUNTIME_READY" = "false" ]; then - echo "FATAL: Finch failed to become ready within 60 seconds" - echo "Attempting Finch service restart for proper BuildKit initialization..." - sudo systemctl restart finch - sleep 10 - - if ! sudo finch info >/dev/null 2>&1; then - echo "FATAL: Finch runtime initialization failed completely" - exit 1 - fi - fi - echo "Finch is ready - displaying runtime information..." - sudo finch info - sudo finch version - echo "Finch runtime successfully initialized" - - # Step 8: Setup BuildKit sockets for SAM CLI. Create symlink directories and set up sockets - echo "Setting up BuildKit sockets for SAM CLI..." - sudo mkdir -p /run/buildkit-finch /run/buildkit-default /run/buildkit - sudo ln -sf /var/lib/finch/buildkit/buildkitd.sock /run/buildkit-finch/buildkitd.sock - sudo ln -sf /var/lib/finch/buildkit/buildkitd.sock /run/buildkit-default/buildkitd.sock - sudo ln -sf /var/lib/finch/buildkit/buildkitd.sock /run/buildkit/buildkitd.sock - - # Set group permissions for SAM CLI access - sudo chmod 666 /var/lib/finch/buildkit/buildkitd.sock - sudo chmod 666 /run/buildkit-*/buildkitd.sock - - # Set up cross platform build support - sudo finch run --privileged --rm tonistiigi/binfmt:master --install all - - echo " BuildKit sockets ready for SAM CLI" - echo "=== Finch runtime initialization complete ===" - fi - - # Docker Runtime Setup (Steps 1-3) - - sh: | - if [ "$CONTAINER_RUNTIME" = "docker" ]; then - echo "=== Initializing Docker runtime ===" - echo "Selected container runtime: $CONTAINER_RUNTIME" - - # Step 1: Initialize Docker runtime (no service changes needed) - echo "Using Docker runtime - no service changes needed" - - # Step 2: Check Docker daemon status - echo "Checking Docker daemon status..." - if ! docker info >/dev/null 2>&1; then - echo "Docker daemon not responding, attempting restart..." - sudo systemctl restart docker || { echo "FATAL: Failed to restart Docker service"; exit 1; } - echo "Docker service restarted successfully" - else - echo "Docker daemon is already running" - fi - - # Step 3: Wait for Docker to be ready and display info - echo "Waiting for Docker to be ready..." - RUNTIME_READY=false - for i in {1..12}; do - if docker info >/dev/null 2>&1; then - RUNTIME_READY=true - break - fi - echo "Docker not ready, waiting... (attempt $i/12)" - sleep 5 - done - - if [ "$RUNTIME_READY" = "false" ]; then - echo "FATAL: Docker runtime initialization failed" - exit 1 - fi - - echo "Docker is ready - displaying runtime information..." - docker info - docker version - echo "Docker runtime successfully initialized" - - echo "=== Docker runtime initialization complete ===" - fi - - - sh: "nvm install ${NODE_VERSION}" - - sh: "npm install npm@10.2.3 -g" - - sh: "npm -v" - - # Install latest gradle comptabile with Java 25 - - sh: "sudo apt-get -y remove gradle" - - sh: "wget https://services.gradle.org/distributions/gradle-9.2.0-bin.zip -P /tmp" - - sh: "sudo unzip -d /opt/gradle /tmp/gradle-*.zip" - - sh: "PATH=/opt/gradle/gradle-9.2.0/bin:$PATH" - - sh: "gradle --version" - - # Install dotnet10 SDK (backwards compatible so it works to build all previous versions) - # https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu-install?tabs=dotnet10&pivots=os-linux-ubuntu-2204 - - sh: "sudo add-apt-repository ppa:dotnet/backports" - - sh: "sudo apt-get update" - - sh: "sudo apt-get install -y dotnet-sdk-10.0" - - # Install AWS CLI - - sh: "virtualenv aws_cli" - - sh: "./aws_cli/bin/python -m pip install awscli" - - sh: "PATH=$(echo $PWD'/aws_cli/bin'):$PATH" - - # install python 3.14 - - sh: | - DEST="$HOME/venv3.14" - URL="https://github.com/astral-sh/python-build-standalone/releases/download/20251031/cpython-3.14.0+20251031-x86_64-unknown-linux-gnu-install_only.tar.gz" - curl -L "$URL" | tar -xz - mv python $DEST - $HOME/venv3.14/bin/python --version - $HOME/venv3.14/bin/pip --version - - - sh: "PATH=$PATH:$HOME/venv3.9/bin:$HOME/venv3.10/bin:$HOME/venv3.11/bin:$HOME/venv3.12/bin:$HOME/venv3.13/bin:$HOME/venv3.14/bin" - - # update ca-certificates which causes failures with newest golang library - - sh: "sudo apt-get install --reinstall ca-certificates" - - # get testing env vars - - sh: "sudo apt install -y jq" - - # install Rust - - sh: "curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL https://sh.rustup.rs | sh -s -- --default-toolchain none -y > /dev/null 2>&1" - - sh: "source $HOME/.cargo/env" - - sh: "rustup toolchain install stable --profile minimal --no-self-update" - - sh: "rustup default stable" - - sh: "rustup target add x86_64-unknown-linux-gnu --toolchain stable" - - sh: "rustup target add aarch64-unknown-linux-gnu --toolchain stable" - - sh: "pip install cargo-lambda==$CARGO_LAMBDA_VERSION" - - sh: "rustc -V" - - sh: "cargo -V" - - sh: "cargo lambda -V" - - - sh: "python3.9 -m venv .venv_env_vars" - - sh: ".venv_env_vars/bin/pip install boto3" - - sh: "test_env_var=$(.venv_env_vars/bin/python tests/get_testing_resources.py)" - - sh: | - if [ $? -ne 0 ]; then - echo "get_testing_resources failed. Failed to acquire credentials or test resources." - false - fi - - - sh: "export CI_ACCESS_ROLE_AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID" - - sh: "export CI_ACCESS_ROLE_AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY" - - sh: "export CI_ACCESS_ROLE_AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN" - - - sh: 'export AWS_ACCESS_KEY_ID=$(echo "$test_env_var" | jq -j ".accessKeyID")' - - sh: 'export AWS_SECRET_ACCESS_KEY=$(echo "$test_env_var" | jq -j ".secretAccessKey")' - - sh: 'export AWS_SESSION_TOKEN=$(echo "$test_env_var" | jq -j ".sessionToken")' - - sh: 'export TASK_TOKEN=$(echo "$test_env_var" | jq -j ".taskToken")' - - sh: 'export AWS_S3_TESTING=$(echo "$test_env_var" | jq -j ".TestBucketName")' - - sh: 'export AWS_ECR_TESTING=$(echo "$test_env_var" | jq -j ".TestECRURI")' - - sh: 'export AWS_KMS_KEY=$(echo "$test_env_var" | jq -j ".TestKMSKeyArn")' - - sh: 'export AWS_SIGNING_PROFILE_NAME=$(echo "$test_env_var" | jq -j ".TestSigningProfileName")' - - sh: 'export AWS_SIGNING_PROFILE_VERSION_ARN=$(echo "$test_env_var" | jq -j ".TestSigningProfileARN")' - - sh: 'export LMI_SUBNET_ID=$(echo "$test_env_var" | jq -j ".LMISubnetId")' - - sh: 'export LMI_SECURITY_GROUP_ID=$(echo "$test_env_var" | jq -j ".LMISecurityGroupId")' - - # Runtime-aware Docker Hub authentication with fail-fast - - sh: | - if [[ -n $BY_CANARY ]] && [[ -n $DOCKER_USER ]] && [[ -n $DOCKER_PASS ]]; then - if [ "$CONTAINER_RUNTIME" = "finch" ]; then - echo "Logging in Docker Hub with Finch" - echo $DOCKER_PASS | sudo finch login --username $DOCKER_USER --password-stdin registry-1.docker.io || { echo "FATAL: Finch Docker Hub login failed"; exit 1; } - echo $DOCKER_PASS | sudo finch login --username $DOCKER_USER --password-stdin || { echo "FATAL: Finch Docker Hub login failed"; exit 1; } - else - echo "Logging in Docker Hub with Docker" - echo $DOCKER_PASS | docker login --username $DOCKER_USER --password-stdin registry-1.docker.io || { echo "FATAL: Docker Hub login failed"; exit 1; } - echo $DOCKER_PASS | docker login --username $DOCKER_USER --password-stdin || { echo "FATAL: Docker Hub login failed"; exit 1; } - fi - fi - # Runtime-aware QEMU setup for ARM64 emulation with fail-fast - - sh: | - echo "Setting up QEMU for ARM64 emulation with $CONTAINER_RUNTIME" - if [ "$CONTAINER_RUNTIME" = "finch" ]; then - sudo finch run --rm --privileged multiarch/qemu-user-static --reset -p yes || { echo "FATAL: Finch QEMU setup failed"; exit 1; } - else - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes || { echo "FATAL: Docker QEMU setup failed"; exit 1; } - fi - echo "QEMU setup completed successfully" - - # Runtime-aware Public ECR authentication with fail-fast - - sh: | - if [[ -n $BY_CANARY ]]; then - if [ "$CONTAINER_RUNTIME" = "finch" ]; then - echo "Logging in Public ECR with Finch" - aws ecr-public get-login-password --region us-east-1 | sudo finch login --username AWS --password-stdin public.ecr.aws || { echo "FATAL: Finch Public ECR login failed"; exit 1; } - else - echo "Logging in Public ECR with Docker" - aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws || { echo "FATAL: Docker Public ECR login failed"; exit 1; } - fi - echo "Public ECR authentication completed successfully" - fi - - - sh: "source ${HOME}/venv${PYTHON_VERSION}/bin/activate" - -build_script: - # Quick runtime validation before build - - sh: | - echo "Validating $CONTAINER_RUNTIME runtime..." - if [ "$CONTAINER_RUNTIME" = "finch" ]; then - sudo finch info >/dev/null 2>&1 || { echo "FATAL: Finch not ready"; exit 1; } - echo " Finch runtime ready" - else - docker info >/dev/null 2>&1 || { echo "FATAL: Docker not ready"; exit 1; } - echo " Docker runtime ready" - fi - - 'python -c "import sys; print(sys.executable)"' - - "make init" - -# Final clean up no matter success or failure -on_finish: - # Rename test reports to include runtime suffix and upload as artifacts - - sh: | - for file in $(find "$APPVEYOR_BUILD_FOLDER" -type f -name 'TEST_REPORT-*.json'); do - new_name=$(echo "$file" | sed "s/\.json$/-${CONTAINER_RUNTIME}.json/") - mv "$file" "$new_name" - appveyor PushArtifact "$new_name" - done - - # Generate runtime-specific diagnostic logs - - sh: | - echo "=== ${CONTAINER_RUNTIME^^} Runtime Diagnostics ===" > "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - echo "Job ID: $APPVEYOR_JOB_ID" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - echo "Build ID: $APPVEYOR_BUILD_ID" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - echo "Timestamp: $(date -u)" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - echo "" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - - if [ "$CONTAINER_RUNTIME" = "finch" ]; then - echo "=== Finch Info ===" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - sudo finch info >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" 2>&1 || echo "Failed to get finch info" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - echo "" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - - echo "=== Finch Version ===" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - sudo finch version >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" 2>&1 || echo "Failed to get finch version" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - echo "" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - - echo "=== Finch Service Status ===" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - sudo systemctl status finch >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" 2>&1 || echo "Failed to get finch service status" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - echo "" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - - echo "=== Finch Socket Info ===" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - ls -la /var/run/finch.sock >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" 2>&1 || echo "Failed to get finch socket info" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - echo "" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - - echo "=== BuildKit Sockets ===" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - ls -la /run/buildkit*/buildkitd.sock >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" 2>&1 || echo "No BuildKit sockets found" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - echo "" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - - echo "=== Environment Variables ===" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - echo "CONTAINER_RUNTIME=$CONTAINER_RUNTIME" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - else - echo "=== Docker Info ===" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - docker info >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" 2>&1 || echo "Failed to get docker info" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - echo "" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - - echo "=== Docker Version ===" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - docker version >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" 2>&1 || echo "Failed to get docker version" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - echo "" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - - echo "=== Docker Service Status ===" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - sudo systemctl status docker >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" 2>&1 || echo "Failed to get docker service status" >> "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - fi - - appveyor PushArtifact "runtime-diagnostics-${CONTAINER_RUNTIME}.log" - - # Cleanup container resources (best effort) - - sh: | - echo "=== Cleaning up container resources for $CONTAINER_RUNTIME ===" - if [ "$CONTAINER_RUNTIME" = "finch" ]; then - # Clean up Finch containers and images (best effort) - sudo finch container prune -f 2>/dev/null || echo "Finch container cleanup skipped" - sudo finch image prune -f 2>/dev/null || echo "Finch image cleanup skipped" - echo "Finch cleanup completed" - else - # Clean up Docker containers and images (best effort) - docker container prune -f 2>/dev/null || echo "Docker container cleanup skipped" - docker image prune -f 2>/dev/null || echo "Docker image cleanup skipped" - echo "Docker cleanup completed" - fi - - # Upload runtime-specific test reports to S3 - - sh: > - AWS_ACCESS_KEY_ID=$TEST_REPORT_S3_BUCKET_ACCESS_KEY_ID - AWS_SECRET_ACCESS_KEY=$TEST_REPORT_S3_BUCKET_SECRET_ACCESS_KEY - AWS_SESSION_TOKEN=$TEST_REPORT_S3_BUCKET_SESSION_TOKEN - aws s3 cp "$APPVEYOR_BUILD_FOLDER" "s3://$TEST_REPORT_S3_BUCKET_NAME/appveyor/$APPVEYOR_PROJECT_SLUG/$APPVEYOR_BUILD_ID/$APPVEYOR_JOB_ID/" --recursive --exclude "*" --include "TEST_REPORT-*-${CONTAINER_RUNTIME}.json" --include "runtime-diagnostics-${CONTAINER_RUNTIME}.log" --region us-west-2 - - # notify task success - - sh: "export AWS_ACCESS_KEY_ID=$CI_ACCESS_ROLE_AWS_ACCESS_KEY_ID" - - sh: "export AWS_SECRET_ACCESS_KEY=$CI_ACCESS_ROLE_AWS_SECRET_ACCESS_KEY" - - sh: "export AWS_SESSION_TOKEN=$CI_ACCESS_ROLE_AWS_SESSION_TOKEN" - - # When we update to AWS CLI v2, we need to add the `--cli-binary-format raw-in-base64-out` option to pass the payload as a JSON string - - sh: > - aws lambda invoke --function-name "$ACCOUNT_RESET_LAMBDA_ARN" --payload "{\"taskToken\": \"$TASK_TOKEN\", \"output\": \"{}\"}" ./lambda-output.txt --region us-west-2 - - sh: "cat ./lambda-output.txt" - -for: - # Integ testing build - - matrix: - only: - - configuration: BuildIntegTesting - - test_script: - # Install Ruby for Ruby build tests - - sh: "git -C ~/.rbenv/plugins/ruby-build pull" - - sh: "rbenv install 3.3.7" - - sh: "rbenv install 3.4.7" - - sh: "rbenv install 3.2.7" - - sh: "rbenv global 3.3.7" - - sh: "ruby --version" - - sh: "pytest -vv -n 2 --reruns 3 tests/integration/buildcmd -m 'not java and not python and not provided' --ignore=tests/integration/buildcmd/test_build_cmd_arm64.py --ignore=tests/integration/buildcmd/test_build_terraform_applications.py --ignore=tests/integration/buildcmd/test_build_terraform_applications_other_cases.py --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json" - - - matrix: - only: - - configuration: BuildIntegTestingJavaPythonProvided - - test_script: - - sh: "pytest -vv -n 2 --reruns 3 tests/integration/buildcmd -m 'java or python or provided' --ignore=tests/integration/buildcmd/test_build_cmd_arm64.py --ignore=tests/integration/buildcmd/test_build_terraform_applications.py --ignore=tests/integration/buildcmd/test_build_terraform_applications_other_cases.py --json-report --json-report-file=TEST_REPORT-integration-buildcmd-java-python-provided.json" - - # Integ testing build arm64 functions - - matrix: - only: - - configuration: BuildIntegTestingArm64 - - test_script: - # Install Ruby for Ruby ARM64 build tests - - sh: "git -C ~/.rbenv/plugins/ruby-build pull" - - sh: "rbenv install 3.3.7" - - sh: "rbenv install 3.4.7" - - sh: "rbenv install 3.2.7" - - sh: "rbenv global 3.3.7" - - sh: "ruby --version" - - sh: "pytest -vv --reruns 3 tests/integration/buildcmd/test_build_cmd_arm64.py -m 'not java' --json-report --json-report-file=TEST_REPORT-integration-buildcmd-arm64.json" - - - matrix: - only: - - configuration: BuildIntegTestingArm64Java - - test_script: - - sh: "pytest -vv --reruns 3 tests/integration/buildcmd/test_build_cmd_arm64.py -m 'java' --json-report --json-report-file=TEST_REPORT-integration-buildcmd-arm64-java.json" - - # Integ testing Terraform build - - matrix: - only: - - configuration: AllTerraformBuildTesting - - test_script: - # install Terraform - - sh: "sudo apt update --allow-releaseinfo-change" - - sh: "TER_VER=`curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest | grep tag_name | cut -d: -f2 | tr -d \\\"\\,\\v | awk '{$1=$1};1'`" - - sh: "wget https://releases.hashicorp.com/terraform/${TER_VER}/terraform_${TER_VER}_linux_amd64.zip -P /tmp" - - sh: "sudo unzip -d /opt/terraform /tmp/terraform_${TER_VER}_linux_amd64.zip" - - sh: "sudo mv /opt/terraform/terraform /usr/local/bin/" - - sh: "terraform -version" - - - sh: "pytest -vv -n 4 --reruns 4 tests/integration/buildcmd/test_build_terraform_applications.py tests/integration/buildcmd/test_build_terraform_applications_other_cases.py --json-report --json-report-file=TEST_REPORT-integration-terraform.json" - - # Integ testing package & delete - - matrix: - only: - - configuration: PackageAndDeleteAndDeployIntegTesting - - test_script: - - sh: "pytest -vv tests/integration/package tests/integration/delete tests/integration/deploy --dist=loadgroup -n 4 --reruns 4 --json-report --json-report-file=TEST_REPORT-integration-package-delete-deploy.json" - - # Integ testing sync - - matrix: - only: - - configuration: SyncIntegTesting - - test_script: - # Install Ruby for Ruby sync tests - - sh: "git -C ~/.rbenv/plugins/ruby-build pull" - - sh: "rbenv install 3.3.7" - - sh: "rbenv install 3.4.7" - - sh: "rbenv install 3.2.7" - - sh: "rbenv global 3.3.7" - - sh: "ruby --version" - - sh: "pytest -vv tests/integration/sync -n 3 --reruns 3 --dist loadscope --json-report --json-report-file=TEST_REPORT-integration-sync.json" - - # Integ testing local - - matrix: - only: - - configuration: LocalInvokeIntegTesting - - test_script: - # install Terraform - - sh: "sudo apt update --allow-releaseinfo-change" - - sh: "TER_VER=`curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest | grep tag_name | cut -d: -f2 | tr -d \\\"\\,\\v | awk '{$1=$1};1'`" - - sh: "wget https://releases.hashicorp.com/terraform/${TER_VER}/terraform_${TER_VER}_linux_amd64.zip -P /tmp" - - sh: "sudo unzip -d /opt/terraform /tmp/terraform_${TER_VER}_linux_amd64.zip" - - sh: "sudo mv /opt/terraform/terraform /usr/local/bin/" - - sh: "terraform -version" - - - sh: "pytest -vv --reruns 3 tests/integration/local/invoke tests/integration/local/generate_event --json-report --json-report-file=TEST_REPORT-integration-local-invoke.json" - - # Integ testing local - - matrix: - only: - - configuration: LocalStartIntegTesting - - test_script: - # install Terraform - - sh: "sudo apt update --allow-releaseinfo-change" - - sh: "TER_VER=`curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest | grep tag_name | cut -d: -f2 | tr -d \\\"\\,\\v | awk '{$1=$1};1'`" - - sh: "wget https://releases.hashicorp.com/terraform/${TER_VER}/terraform_${TER_VER}_linux_amd64.zip -P /tmp" - - sh: "sudo unzip -d /opt/terraform /tmp/terraform_${TER_VER}_linux_amd64.zip" - - sh: "sudo mv /opt/terraform/terraform /usr/local/bin/" - - sh: "terraform -version" - - - sh: "pytest -vv --reruns 3 tests/integration/local/start_api tests/integration/local/start_lambda --json-report --json-report-file=TEST_REPORT-integration-local-start.json" - - # Other testing - - matrix: - only: - - configuration: OtherAndEndToEndTesting - - test_script: - # Install Ruby for Ruby validation and other tests - - sh: "git -C ~/.rbenv/plugins/ruby-build pull" - - sh: "rbenv install 3.3.7" - - sh: "rbenv install 3.4.7" - - sh: "rbenv install 3.2.7" - - sh: "rbenv global 3.3.7" - - sh: "ruby --version" - - sh: "pytest -vv -n 4 --reruns 4 --dist loadgroup tests/integration tests/end_to_end --ignore=tests/integration/buildcmd --ignore=tests/integration/delete --ignore=tests/integration/deploy --ignore=tests/integration/package --ignore=tests/integration/sync --ignore=tests/integration/local --json-report --json-report-file=TEST_REPORT-integration-others.json" - - sh: "pytest -vv --reruns 3 tests/regression --json-report --json-report-file=TEST_REPORT-regression.json" diff --git a/appveyor-windows-al2023.yml b/appveyor-windows-al2023.yml deleted file mode 100644 index 29c512a3d2b..00000000000 --- a/appveyor-windows-al2023.yml +++ /dev/null @@ -1,189 +0,0 @@ -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 use Py3.9. It is sufficient to test with this version here. - PYTHON_HOME: "C:\\Python39-x64" - PYTHON_SCRIPTS: "C:\\Python39-x64\\Scripts" - PYTHON_EXE: "C:\\Python39-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 install maven --version=3.9.12 - - 'set MAVEN_HOME=C:\ProgramData\chocolatey\lib\maven\apache-maven-3.9.12' - - 'set PATH=%MAVEN_HOME%\bin;%PATH%' - - choco upgrade gradle --version=9.0.0 - - choco install ruby --version=3.2.7.1 - - choco install ruby --version=3.3.7.1 - - choco install ruby --version=3.4.7.1 - - "gradle -v" - - "mvn --version" - - # Make sure the temp directory exists for Python to use. - - ps: "mkdir -Force C:\\tmp" - - "python --version" - - 'set PATH=%PYTHON_HOME%;C:\Ruby32-x64\bin;C:\Ruby33-x64\bin;C:\Ruby34-x64\bin;%PATH%;C:\Python39-x64;C:\Python310-x64;C:\Python311-x64;C:\Python312-x64;C:\Python313-x64;C:\Python314-x64' - - "node --version" - - "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; - $env:LMI_SUBNET_ID = $test_env_var_json.LMISubnetId; - $env:LMI_SECURITY_GROUP_ID = $test_env_var_json.LMISecurityGroupId; - }" - - - # 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 lambda invoke --function-name "$env:ACCOUNT_RESET_LAMBDA_ARN" --payload "{\`"taskToken\`": \`"$env:TASK_TOKEN\`", \`"output\`": \`"{}\`"}" lambda-output.txt --region us-west-2; - cat lambda-output.txt - } - -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')) - diff --git a/appveyor-windows-binary.yml b/appveyor-windows-binary.yml deleted file mode 100644 index ae0539969c8..00000000000 --- a/appveyor-windows-binary.yml +++ /dev/null @@ -1,321 +0,0 @@ -version: 1.0.{build} -image: Visual Studio 2022 -build: off - -clone_folder: C:\source - -configuration: - - BuildIntegTesting - - BuildIntegTestingJavaPythonProvided - - BuildIntegTestingArm64 - - AllTerraformBuildTesting - - PackageAndDeleteAndDeployIntegTesting - - SyncIntegTesting - - LocalInvokeIntegTesting - - LocalStartApiIntegTesting - - LocalStartLambdaIntegTesting - # other Integration testing, Dev, regression and smoke testing - - OtherAndEndToEndTesting - -environment: - AWS_DEFAULT_REGION: us-east-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.11. It is sufficient to test with this version here. - PYTHON_HOME: "C:\\Python311-x64" - PYTHON_SCRIPTS: "C:\\Python311-x64\\Scripts" - PYTHON_EXE: "C:\\Python311-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 - - SAM_WINDOWS_BINARY_PATH: "C:\\Program Files\\Amazon\\AWSSAMCLI_NIGHTLY\\bin\\sam-nightly.cmd" - -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 corretto25jdk --version 25.0.1.81 - - 'set JAVA_HOME=C:\Program Files\Amazon Corretto\jdk25.0.1_8' - - 'set PATH=%JAVA_HOME%\bin;%PATH%' - - java --version - - javac --version - - choco install maven --version=3.9.12 - - choco upgrade gradle --version=9.0.0 - - "gradle -v" - - "mvn --version" - - choco install ruby --version=3.2.7.1 - - choco install ruby --version=3.3.7.1 - - choco install ruby --version=3.4.7.1 - - # Make sure the temp directory exists for Python to use. - - ps: "mkdir -Force C:\\tmp" - - 'set PATH=%PYTHON_HOME%;C:\Ruby32-x64\bin;C:\Ruby33-x64\bin;C:\Ruby34-x64\bin;%PATH%;C:\Python39-x64;C:\Python310-x64;C:\Python38-x64;C:\Python312-x64;C:\Python313-x64;C:\Python314-x64' - - "echo %PYTHON_HOME%" - - "echo %PATH%" - - "python --version" - - ps: "Restart-Service docker" - - # Switch to Docker Linux containers - - ps: | - $dockerCliPath = "$Env:ProgramFiles\Docker\Docker\DockerCli.exe" - if (Test-Path $dockerCliPath) { - & $dockerCliPath -SwitchLinuxEngine - Write-Host "Docker successfully switched to Linux container mode" - } else { - Write-Host "DockerCli.exe not found at expected location. Installing tree and exploring Docker directory structure..." - choco install tree - tree "$Env:ProgramFiles\Docker" /F /A - Write-Host "Build stopped for Docker CLI investigation." - exit 1 - } - - "docker info" - - "docker version" - - # Upgrade setuptools, wheel and virtualenv - - "python -m pip install --upgrade setuptools wheel virtualenv" - # Install pip for the python versions which is used by the tests - - "C:\\Python39-x64\\python.exe -m pip install --upgrade pip" - - "C:\\Python310-x64\\python.exe -m pip install --upgrade pip" - - # 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" - - # Install testing pre-reqs without installing sam-cli from source - - "pip install uv" - - "uv pip install --only-deps --extra dev ." - - "pytest --version" - - # Install aws cli - - "pip install awscli" - - # Install aws-sam-cli MSI binary - - ps: | - Invoke-WebRequest -Uri https://github.com/aws/aws-sam-cli/releases/download/sam-cli-nightly/AWS_SAM_CLI_64_PY3.msi -OutFile aws-sam-cli-installer.msi; - Start-Process 'C:\\Windows\\System32\\msiexec.exe' -ArgumentList '/i aws-sam-cli-installer.msi /qn /norestart' -wait -PassThru; - - 'set PATH=C:\Program Files\Amazon\AWSSAMCLI_NIGHTLY\bin\;%PATH%' - - 'sam-nightly --version' - - # Echo final Path - - "echo %PATH%" - - # use amazon-ecr-credential-helper - - choco install amazon-ecr-credential-helper - - 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" - - -# 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 lambda invoke --function-name "$env:ACCOUNT_RESET_LAMBDA_ARN" --payload "{\`"taskToken\`": \`"$env:TASK_TOKEN\`", \`"output\`": \`"{}\`"}" lambda-output.txt --region us-west-2; - cat lambda-output.txt - } - - -for: - #Integ testing build - - matrix: - only: - - configuration: BuildIntegTesting - - test_script: - - ps: "pytest -vv -n 2 --reruns 3 tests/integration/buildcmd -m 'not java and not python and not provided and not al2023' --ignore=tests/integration/buildcmd/test_build_cmd_arm64.py --ignore=tests/integration/buildcmd/test_build_terraform_applications.py --ignore=tests/integration/buildcmd/test_build_terraform_applications_other_cases.py --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json" - - - matrix: - only: - - configuration: BuildIntegTestingJavaPythonProvided - - 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 tests/integration/buildcmd -m 'java and not al2023 or python and not al2023 or provided and not al2023' --ignore=tests/integration/buildcmd/test_build_cmd_arm64.py --ignore=tests/integration/buildcmd/test_build_terraform_applications.py --ignore=tests/integration/buildcmd/test_build_terraform_applications_other_cases.py --json-report --json-report-file=TEST_REPORT-integration-buildcmd-java-python-provided.json" - - #Integ testing build arm64 - - matrix: - only: - - configuration: BuildIntegTestingArm64 - - 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 --reruns 3 -m 'not al2023' tests/integration/buildcmd/test_build_cmd_arm64.py --json-report --json-report-file=TEST_REPORT-integration-buildcmd-arm64.json" - - #Integ testing Terraform build - - matrix: - only: - - configuration: AllTerraformBuildTesting - - test_script: - # install Terraform CLI - - "choco install terraform" - - "terraform -version" - - - ps: "pytest -vv -n 4 --reruns 4 tests/integration/buildcmd/test_build_terraform_applications.py tests/integration/buildcmd/test_build_terraform_applications_other_cases.py --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json" - - # Integ testing package, delete and deploy - - matrix: - only: - - configuration: PackageAndDeleteAndDeployIntegTesting - - test_script: - - ps: "pytest -vv tests/integration/package tests/integration/delete tests/integration/deploy --dist=loadgroup -n 4 --reruns 4 --json-report --json-report-file=TEST_REPORT-integration-package-delete.json" - - # Integ testing sync - - matrix: - only: - - configuration: SyncIntegTesting - - test_script: - - ps: "pytest -vv tests/integration/sync -n 3 --reruns 3 --dist loadscope --json-report --json-report-file=TEST_REPORT-integration-sync.json" - - #Integ testing local invoke and generate event - - matrix: - only: - - configuration: LocalInvokeIntegTesting - - test_script: - # install Terraform CLI - - "choco install terraform" - - "terraform -version" - - - ps: "pytest -vv --reruns 3 tests/integration/local/invoke tests/integration/local/generate_event --json-report --json-report-file=TEST_REPORT-integration-local.json" - - #Integ testing local start-api - - matrix: - only: - - configuration: LocalStartApiIntegTesting - - test_script: - # install Terraform CLI - - "choco install terraform" - - "terraform -version" - - - ps: "pytest -vv --reruns 3 tests/integration/local/start_api --json-report --json-report-file=TEST_REPORT-integration-local-api.json" - - #Integ testing local start-lambda - - matrix: - only: - - configuration: LocalStartLambdaIntegTesting - - test_script: - # install Terraform CLI - - "choco install terraform" - - "terraform -version" - - - ps: "pytest -vv --reruns 3 tests/integration/local/start_lambda --json-report --json-report-file=TEST_REPORT-integration-local-lambda.json" - - #Other testing - - matrix: - only: - - configuration: OtherAndEndToEndTesting - - test_script: - - ps: "pytest -vv -n 4 --reruns 4 --dist loadgroup tests/integration tests/end_to_end --ignore=tests/integration/buildcmd --ignore=tests/integration/delete --ignore=tests/integration/deploy --ignore=tests/integration/package --ignore=tests/integration/sync --ignore=tests/integration/local --json-report --json-report-file=TEST_REPORT-integration-others.json" - - ps: "pytest -vv --reruns 3 tests/regression --json-report --json-report-file=TEST_REPORT-regression.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')) diff --git a/appveyor-windows.yml b/appveyor-windows.yml deleted file mode 100644 index e31859356a6..00000000000 --- a/appveyor-windows.yml +++ /dev/null @@ -1,307 +0,0 @@ -version: 1.0.{build} -image: Visual Studio 2022 -build: off - -clone_folder: C:\source - -configuration: - - BuildIntegTesting - - BuildIntegTestingJavaPythonProvided - - BuildIntegTestingArm64 - - AllTerraformBuildTesting - - PackageAndDeleteAndDeployIntegTesting - - SyncIntegTesting - - LocalInvokeIntegTesting - - LocalStartApiIntegTesting - - LocalStartLambdaIntegTesting - # other Integration testing, Dev, regression and smoke testing - - OtherAndEndToEndTesting - -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 uses Py3.9. It is sufficient to test with this version here. - PYTHON_HOME: "C:\\Python39-x64" - PYTHON_SCRIPTS: "C:\\Python39-x64\\Scripts" - PYTHON_EXE: "C:\\Python39-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 - -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 corretto25jdk --version 25.0.1.81 - - 'set JAVA_HOME=C:\Program Files\Amazon Corretto\jdk25.0.1_8' - - 'set PATH=%JAVA_HOME%\bin;%PATH%' - - java --version - - javac --version - - choco install maven --version=3.9.12 - - choco upgrade gradle --version=9.0.0 - - choco install ruby --version=3.2.7.1 - - choco install ruby --version=3.3.7.1 - - choco install ruby --version=3.4.7.1 - - "gradle -v" - - "mvn --version" - - # Make sure the temp directory exists for Python to use. - - ps: "mkdir -Force C:\\tmp" - - 'set PATH=%PYTHON_HOME%;C:\Ruby32-x64\bin;C:\Ruby33-x64\bin;C:\Ruby34-x64\bin;%PATH%;C:\Python39-x64;C:\Python310-x64;C:\Python311-x64;C:\Python312-x64;C:\Python313-x64;C:\Python314-x64' - - "echo %PYTHON_HOME%" - - "echo %PATH%" - - "python --version" - - ps: "Restart-Service docker" - # Switch to Docker Linux containers - - ps: '& $Env:ProgramFiles\Docker\Docker\DockerCli.exe -SwitchLinuxEngine' - - "ruby --version" - - "docker info" - - "docker version" - - # Upgrade setuptools, wheel and virtualenv - - "python -m pip install --upgrade setuptools wheel virtualenv" - # Install pip for the python versions which is used by the tests - - "C:\\Python39-x64\\python.exe -m pip install --upgrade pip" - - "C:\\Python310-x64\\python.exe -m pip install --upgrade pip" - - # 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; - $env:LMI_SUBNET_ID = $test_env_var_json.LMISubnetId; - $env:LMI_SECURITY_GROUP_ID = $test_env_var_json.LMISecurityGroupId; - }" - - - # 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: " - $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 lambda invoke --function-name "$env:ACCOUNT_RESET_LAMBDA_ARN" --payload "{\`"taskToken\`": \`"$env:TASK_TOKEN\`", \`"output\`": \`"{}\`"}" lambda-output.txt --region us-west-2; - cat lambda-output.txt - } - - -for: - #Integ testing build - - matrix: - only: - - configuration: BuildIntegTesting - - test_script: - - ps: "pytest -vv -n 2 --reruns 3 tests/integration/buildcmd -m 'not java and not python and not provided and not al2023' --ignore=tests/integration/buildcmd/test_build_cmd_arm64.py --ignore=tests/integration/buildcmd/test_build_terraform_applications.py --ignore=tests/integration/buildcmd/test_build_terraform_applications_other_cases.py --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json" - - - matrix: - only: - - configuration: BuildIntegTestingJavaPythonProvided - - 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 tests/integration/buildcmd -m 'java and not al2023 or python and not al2023 or provided and not al2023' --ignore=tests/integration/buildcmd/test_build_cmd_arm64.py --ignore=tests/integration/buildcmd/test_build_terraform_applications.py --ignore=tests/integration/buildcmd/test_build_terraform_applications_other_cases.py --json-report --json-report-file=TEST_REPORT-integration-buildcmd-java-python-provided.json" - - #Integ testing build arm64 - - matrix: - only: - - configuration: BuildIntegTestingArm64 - - 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 --reruns 3 -m 'not al2023' tests/integration/buildcmd/test_build_cmd_arm64.py --json-report --json-report-file=TEST_REPORT-integration-buildcmd-arm64.json" - - #Integ testing Terraform build - - matrix: - only: - - configuration: AllTerraformBuildTesting - - test_script: - # install Terraform CLI - - "choco install terraform" - - "terraform -version" - - - ps: "pytest -vv -n 4 --reruns 4 tests/integration/buildcmd/test_build_terraform_applications.py tests/integration/buildcmd/test_build_terraform_applications_other_cases.py --json-report --json-report-file=TEST_REPORT-integration-buildcmd.json" - - # Integ testing package, delete and deploy - - matrix: - only: - - configuration: PackageAndDeleteAndDeployIntegTesting - - test_script: - - ps: "pytest -vv tests/integration/package tests/integration/delete tests/integration/deploy --dist=loadgroup -n 4 --reruns 4 --json-report --json-report-file=TEST_REPORT-integration-package-delete.json" - - # Integ testing sync - - matrix: - only: - - configuration: SyncIntegTesting - - test_script: - - ps: "pytest -vv tests/integration/sync -n 3 --reruns 3 --dist loadscope --json-report --json-report-file=TEST_REPORT-integration-sync.json" - - #Integ testing local invoke and generate event - - matrix: - only: - - configuration: LocalInvokeIntegTesting - - test_script: - # install Terraform CLI - - "choco install terraform" - - "terraform -version" - - - ps: "pytest -vv --reruns 3 tests/integration/local/invoke tests/integration/local/generate_event --json-report --json-report-file=TEST_REPORT-integration-local.json" - - #Integ testing local start-api - - matrix: - only: - - configuration: LocalStartApiIntegTesting - - test_script: - # install Terraform CLI - - "choco install terraform" - - "terraform -version" - - - ps: "pytest -vv --reruns 3 tests/integration/local/start_api --json-report --json-report-file=TEST_REPORT-integration-local-api.json" - - #Integ testing local start-lambda - - matrix: - only: - - configuration: LocalStartLambdaIntegTesting - - test_script: - # install Terraform CLI - - "choco install terraform" - - "terraform -version" - - - ps: "pytest -vv --reruns 3 tests/integration/local/start_lambda --json-report --json-report-file=TEST_REPORT-integration-local-lambda.json" - - #Other testing - - matrix: - only: - - configuration: OtherAndEndToEndTesting - - test_script: - - ps: "pytest -vv -n 4 --reruns 4 --dist loadgroup tests/integration tests/end_to_end --ignore=tests/integration/buildcmd --ignore=tests/integration/delete --ignore=tests/integration/deploy --ignore=tests/integration/package --ignore=tests/integration/sync --ignore=tests/integration/local --json-report --json-report-file=TEST_REPORT-integration-others.json" - - ps: "pytest -vv --reruns 3 tests/regression --json-report --json-report-file=TEST_REPORT-regression.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')) - diff --git a/installer/pyinstaller/build-linux.sh b/installer/pyinstaller/build-linux.sh index da6a430970a..c359aa3880f 100755 --- a/installer/pyinstaller/build-linux.sh +++ b/installer/pyinstaller/build-linux.sh @@ -89,7 +89,6 @@ cp -r ../[!.]* ./src cp -r ./src/* ./output/aws-sam-cli-src echo "Removing CI Scripts and other files/directories not needed" -rm -vf ./output/aws-sam-cli-src/appveyor*.yml rm -rf ./output/aws-sam-cli-src/tests rm -rf ./output/aws-sam-cli-src/designs rm -rf ./output/aws-sam-cli-src/docs diff --git a/installer/pyinstaller/build-mac.sh b/installer/pyinstaller/build-mac.sh index 1affb9f53da..03604f8993d 100755 --- a/installer/pyinstaller/build-mac.sh +++ b/installer/pyinstaller/build-mac.sh @@ -73,7 +73,6 @@ cp -r ../[!.]* ./src cp -r ./src/* ./output/aws-sam-cli-src echo "Removing CI Scripts and other files/direcories not needed" -rm -vf ./output/aws-sam-cli-src/appveyor*.yml rm -rf ./output/aws-sam-cli-src/tests rm -rf ./output/aws-sam-cli-src/designs rm -rf ./output/aws-sam-cli-src/docs diff --git a/pytest.ini b/pytest.ini index ab3f535e8f3..3fb61302337 100644 --- a/pytest.ini +++ b/pytest.ini @@ -28,3 +28,8 @@ markers = dotnet al2023: Marker to note tests that require a newer Docker version on Windows pr_skip: Tests skipped in PR workflow but run in nightly/integration tests + requires_credential: Tests that need AWS credentials; deselected on credential-free CI lanes + tier1: Fast cross-platform smoke tests + tier1_extra: Additional tier1 tests run separately + flaky: Tests retried on failure (used with pytest-rerunfailures) + xdist_group: Group tests onto the same xdist worker (used with pytest-xdist loadgroup) diff --git a/tests/end_to_end/test_runtimes_e2e.py b/tests/end_to_end/test_runtimes_e2e.py index 6182c05bf37..1a1db454547 100644 --- a/tests/end_to_end/test_runtimes_e2e.py +++ b/tests/end_to_end/test_runtimes_e2e.py @@ -1,7 +1,7 @@ import shutil import os -from unittest import skipIf import json +import pytest from pathlib import Path from parameterized import parameterized_class @@ -15,11 +15,8 @@ DefaultSyncStage, BaseValidator, ) -from tests.testing_utils import RUNNING_ON_CI, RUNNING_TEST_FOR_MASTER_ON_CI, RUN_BY_CANARY -# Deploy tests require credentials and CI/CD will only add credentials to the env if the PR is from the same repo. -# This is to restrict package tests to run outside of CI/CD, when the branch is not master or tests are not run by Canary -SKIP_E2E_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY +# These tests require AWS credentials; they are gated by the requires_credential marker. from tests.testing_utils import CommandResult @@ -65,7 +62,7 @@ def validate(self, command_result: CommandResult): self.assertIn("Description", output) -@skipIf(SKIP_E2E_TESTS, "Skip E2E tests in CI/CD only") +@pytest.mark.requires_credential @parameterized_class( ("runtime", "dependency_manager"), [ @@ -99,7 +96,7 @@ def test_hello_world_default_workflow(self): self._run_tests(stages) -@skipIf(SKIP_E2E_TESTS, "Skip E2E tests in CI/CD only") +@pytest.mark.requires_credential @parameterized_class( ("runtime", "dependency_manager"), [ @@ -137,7 +134,7 @@ def test_hello_world_workflow(self): os.environ.pop("SAM_CLI_RIE_DEV", None) -@skipIf(SKIP_E2E_TESTS, "Skip E2E tests in CI/CD only") +@pytest.mark.requires_credential @parameterized_class( ("runtime", "dependency_manager"), [ diff --git a/tests/integration/buildcmd/test_build_cmd.py b/tests/integration/buildcmd/test_build_cmd.py index 536769a9e38..181cd8e474d 100644 --- a/tests/integration/buildcmd/test_build_cmd.py +++ b/tests/integration/buildcmd/test_build_cmd.py @@ -20,7 +20,6 @@ from tests.testing_utils import ( IS_WINDOWS, RUNNING_ON_CI, - RUNNING_TEST_FOR_MASTER_ON_CI, RUN_BY_CANARY, CI_OVERRIDE, run_command, @@ -44,7 +43,6 @@ LOG = logging.getLogger(__name__) # SAR tests require credentials. This is to skip running the test where credentials are not available. -SKIP_SAR_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY @skipIf(SKIP_DOCKER_TESTS, SKIP_DOCKER_MESSAGE) @@ -2114,7 +2112,6 @@ def test_functions_layers_with_s3_codeuri_in_container(self): ) -@skipIf(SKIP_SAR_TESTS, "Skip SAR tests") @pytest.mark.requires_credential class TestBuildSAR(BuildIntegBase): template = "aws-serverless-application-with-application-id-map.yaml" diff --git a/tests/integration/buildcmd/test_build_cmd_java.py b/tests/integration/buildcmd/test_build_cmd_java.py index fe56997c841..d84b66295a7 100644 --- a/tests/integration/buildcmd/test_build_cmd_java.py +++ b/tests/integration/buildcmd/test_build_cmd_java.py @@ -5,9 +5,6 @@ import pytest from parameterized import parameterized from tests.testing_utils import ( - RUNNING_ON_CI, - RUNNING_TEST_FOR_MASTER_ON_CI, - RUN_BY_CANARY, SKIP_DOCKER_TESTS, SKIP_DOCKER_BUILD, SKIP_DOCKER_MESSAGE, @@ -19,7 +16,6 @@ LOG = logging.getLogger(__name__) # SAR tests require credentials. This is to skip running the test where credentials are not available. -SKIP_SAR_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY @pytest.mark.java diff --git a/tests/integration/buildcmd/test_build_cmd_node.py b/tests/integration/buildcmd/test_build_cmd_node.py index 20ec6a09d27..3415abb4c81 100644 --- a/tests/integration/buildcmd/test_build_cmd_node.py +++ b/tests/integration/buildcmd/test_build_cmd_node.py @@ -6,8 +6,6 @@ from tests.testing_utils import ( IS_WINDOWS, RUNNING_ON_CI, - RUNNING_TEST_FOR_MASTER_ON_CI, - RUN_BY_CANARY, CI_OVERRIDE, ) from tests.integration.buildcmd.build_integ_base import ( @@ -19,7 +17,6 @@ LOG = logging.getLogger(__name__) # SAR tests require credentials. This is to skip running the test where credentials are not available. -SKIP_SAR_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY @pytest.mark.nodejs diff --git a/tests/integration/buildcmd/test_build_cmd_provided.py b/tests/integration/buildcmd/test_build_cmd_provided.py index 83c7e4fd937..9c5cff22a96 100644 --- a/tests/integration/buildcmd/test_build_cmd_provided.py +++ b/tests/integration/buildcmd/test_build_cmd_provided.py @@ -6,9 +6,6 @@ from parameterized import parameterized, parameterized_class from tests.testing_utils import ( - RUNNING_ON_CI, - RUNNING_TEST_FOR_MASTER_ON_CI, - RUN_BY_CANARY, SKIP_DOCKER_TESTS, SKIP_DOCKER_BUILD, SKIP_DOCKER_MESSAGE, @@ -21,7 +18,6 @@ LOG = logging.getLogger(__name__) # SAR tests require credentials. This is to skip running the test where credentials are not available. -SKIP_SAR_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY @parameterized_class( diff --git a/tests/integration/buildcmd/test_build_cmd_python.py b/tests/integration/buildcmd/test_build_cmd_python.py index 139063354e3..fad16d6621e 100644 --- a/tests/integration/buildcmd/test_build_cmd_python.py +++ b/tests/integration/buildcmd/test_build_cmd_python.py @@ -16,8 +16,6 @@ CI_OVERRIDE, IS_WINDOWS, RUN_BY_CANARY, - RUNNING_ON_CI, - RUNNING_TEST_FOR_MASTER_ON_CI, SKIP_DOCKER_BUILD, SKIP_DOCKER_MESSAGE, SKIP_DOCKER_TESTS, @@ -27,7 +25,6 @@ LOG = logging.getLogger(__name__) # SAR tests require credentials. This is to skip running the test where credentials are not available. -SKIP_SAR_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY @skipIf( diff --git a/tests/integration/delete/test_delete_command.py b/tests/integration/delete/test_delete_command.py index 01975a80f6f..fafa4eb975c 100644 --- a/tests/integration/delete/test_delete_command.py +++ b/tests/integration/delete/test_delete_command.py @@ -1,6 +1,5 @@ import os import time -from unittest import skipIf import boto3 import pytest @@ -11,23 +10,18 @@ from samcli.local.docker.utils import get_validated_container_client from tests.integration.delete.delete_integ_base import DeleteIntegBase -from tests.testing_utils import RUNNING_ON_CI, RUNNING_TEST_FOR_MASTER_ON_CI, RUN_BY_CANARY, CommandResult +from tests.testing_utils import CommandResult from tests.testing_utils import ( run_command, run_command_with_input, - start_persistent_process, - read_until_string, - kill_process, ) -# Delete tests require credentials and CI/CD will only add credentials to the env if the PR is from the same repo. -# This is to restrict package tests to run outside of CI/CD, when the branch is not master or tests are not run by Canary -SKIP_DELETE_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY +# These tests require AWS credentials; they are gated by the requires_credential marker. CFN_SLEEP = 3 CFN_PYTHON_VERSION_SUFFIX = os.environ.get("PYTHON_VERSION", "0.0.0").replace(".", "-") -@skipIf(SKIP_DELETE_TESTS, "Skip delete tests in CI/CD only") +@pytest.mark.requires_credential class TestDelete(DeleteIntegBase): @classmethod def setUpClass(cls): diff --git a/tests/integration/deploy/test_deploy_command.py b/tests/integration/deploy/test_deploy_command.py index 69d2a55a044..3d90f934671 100644 --- a/tests/integration/deploy/test_deploy_command.py +++ b/tests/integration/deploy/test_deploy_command.py @@ -15,21 +15,16 @@ from samcli.yamlhelper import yaml_parse from tests.integration.deploy.deploy_integ_base import DeployIntegBase from tests.testing_utils import ( - RUNNING_ON_CI, - RUNNING_TEST_FOR_MASTER_ON_CI, - RUN_BY_CANARY, SKIP_LMI_TESTS, UpdatableSARTemplate, get_sam_command, ) -# Deploy tests require credentials and CI/CD will only add credentials to the env if the PR is from the same repo. -# This is to restrict package tests to run outside of CI/CD, when the branch is not master or tests are not run by Canary -SKIP_DEPLOY_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY +# These tests require AWS credentials; they are gated by the requires_credential marker. CFN_PYTHON_VERSION_SUFFIX = os.environ.get("PYTHON_VERSION", "0.0.0").replace(".", "-") -@skipIf(SKIP_DEPLOY_TESTS, "Skip deploy tests in CI/CD only") +@pytest.mark.requires_credential class TestDeploy(DeployIntegBase): @classmethod def setUpClass(cls): diff --git a/tests/integration/deploy/test_managed_stack_deploy.py b/tests/integration/deploy/test_managed_stack_deploy.py index 5a74af639a4..a895b1f01cc 100644 --- a/tests/integration/deploy/test_managed_stack_deploy.py +++ b/tests/integration/deploy/test_managed_stack_deploy.py @@ -9,13 +9,10 @@ from samcli.lib.bootstrap.bootstrap import SAM_CLI_STACK_NAME from samcli.lib.config.samconfig import DEFAULT_CONFIG_FILE_NAME from tests.integration.deploy.deploy_integ_base import DeployIntegBase -from tests.testing_utils import RUNNING_ON_CI, RUNNING_TEST_FOR_MASTER_ON_CI, RUN_BY_CANARY PYTHON_VERSION = os.environ.get("PYTHON_VERSION", "0.0.0") -# Managed stack tests require credentials and CI/CD will only add credentials to the env if the PR is from the same repo. -# This is to restrict package tests to run outside of CI/CD, when the branch is not master or tests are not run by Canary -SKIP_MANAGED_STACK_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY +# These tests require AWS credentials; they are gated by the requires_credential marker. # Limits the managed stack tests to be run on a single python version to avoid CI race conditions IS_TARGETTED_PYTHON_VERSION = PYTHON_VERSION.startswith("3.8") @@ -24,7 +21,8 @@ DEFAULT_REGION = "us-west-2" -@skipIf(SKIP_MANAGED_STACK_TESTS or not IS_TARGETTED_PYTHON_VERSION, "Skip managed stack tests in CI/CD only") +@pytest.mark.requires_credential +@skipIf(not IS_TARGETTED_PYTHON_VERSION, "Managed stack tests run on the targetted Python version only") @pytest.mark.xdist_group(name="managed_stack") class TestManagedStackDeploy(DeployIntegBase): def setUp(self): diff --git a/tests/integration/init/schemas/test_init_with_schemas_command.py b/tests/integration/init/schemas/test_init_with_schemas_command.py index b436f5e30bb..c322116f2ef 100644 --- a/tests/integration/init/schemas/test_init_with_schemas_command.py +++ b/tests/integration/init/schemas/test_init_with_schemas_command.py @@ -1,9 +1,7 @@ -import os import tempfile import pytest from functools import lru_cache from pathlib import Path -from unittest import skipIf from boto3.session import Session from click.testing import CliRunner @@ -12,10 +10,8 @@ from samcli.commands.init.init_templates import InitTemplates from samcli.commands.init.interactive_init_flow import get_sorted_runtimes from tests.integration.init.schemas.schemas_test_data_setup import SchemaTestDataSetup -from tests.testing_utils import RUNNING_ON_CI, RUNNING_TEST_FOR_MASTER_ON_CI, RUN_BY_CANARY # Schemas tests require credentials. This is to skip running the test where credentials are not available. -SKIP_SCHEMA_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY EVENT_BRIDGE_USE_CASE = "Infrastructure event management" @@ -69,7 +65,7 @@ def _get_use_case_position(use_case_name): raise ValueError(f"Use case '{use_case_name}' not found. Available: {use_cases}") -@skipIf(SKIP_SCHEMA_TESTS, "Skip schema test") +@pytest.mark.requires_credential @pytest.mark.xdist_group(name="sam_init") class TestBasicInitWithEventBridgeCommand(SchemaTestDataSetup): @pytest.mark.timeout(300) diff --git a/tests/integration/init/test_init_command.py b/tests/integration/init/test_init_command.py index dbe4f7885c7..03606a4afd3 100644 --- a/tests/integration/init/test_init_command.py +++ b/tests/integration/init/test_init_command.py @@ -24,7 +24,7 @@ from pathlib import Path from tests.integration.init.test_init_base import InitIntegBase -from tests.testing_utils import get_sam_command, IS_WINDOWS, RUNNING_ON_APPVEYOR, run_command +from tests.testing_utils import get_sam_command, IS_WINDOWS, run_command TIMEOUT = 300 @@ -1305,10 +1305,6 @@ def _read_config(project_path): return text -@skipIf( - IS_WINDOWS and RUNNING_ON_APPVEYOR, - "Killing process in Windows in Appveyor gets stuck, skipping this test since it is already run in GHA", -) @pytest.mark.xdist_group(name="sam_init") class TestInitCommand(InitIntegBase): def test_graceful_exit(self): diff --git a/tests/integration/local/invoke/invoke_cdk_templates.py b/tests/integration/local/invoke/invoke_cdk_templates.py index c62777ce368..4348bfc7c31 100644 --- a/tests/integration/local/invoke/invoke_cdk_templates.py +++ b/tests/integration/local/invoke/invoke_cdk_templates.py @@ -1,7 +1,6 @@ import json import shutil from pathlib import Path -from unittest import skipIf import pytest from docker.errors import APIError @@ -13,8 +12,7 @@ from samcli.lib.utils.architecture import X86_64 from samcli.local.docker.utils import get_validated_container_client from tests.integration.local.invoke.invoke_integ_base import InvokeIntegBase -from tests.integration.local.invoke.test_integrations_cli import TestLayerVersionBase, SKIP_LAYERS_TESTS -from tests.testing_utils import IS_WINDOWS, RUNNING_ON_CI, CI_OVERRIDE +from tests.integration.local.invoke.test_integrations_cli import TestLayerVersionBase class TestCDKSynthesizedTemplate(InvokeIntegBase): @@ -227,7 +225,7 @@ def test_runtime_function_construct(self, function_name): self.assertEqual(response, expected_response) -@skipIf(SKIP_LAYERS_TESTS, "Skip layers tests in Appveyor only") +@pytest.mark.requires_credential class TestCDKLayerVersion(TestLayerVersionBase): # region = "us-west-2" # layer_utils = LayerUtils(region=region) diff --git a/tests/integration/local/invoke/test_integrations_cli.py b/tests/integration/local/invoke/test_integrations_cli.py index 95a0a95cea4..62903106238 100644 --- a/tests/integration/local/invoke/test_integrations_cli.py +++ b/tests/integration/local/invoke/test_integrations_cli.py @@ -9,18 +9,15 @@ from subprocess import Popen, PIPE, TimeoutExpired from timeit import default_timer as timer import pytest -import docker from pathlib import Path from tests.integration.local.invoke.layer_utils import LayerUtils from tests.integration.local.invoke.invoke_integ_base import IntegrationCliIntegBase, InvokeIntegBase -from tests.testing_utils import IS_WINDOWS, RUNNING_ON_CI, RUNNING_TEST_FOR_MASTER_ON_CI, RUN_BY_CANARY, run_command +from tests.testing_utils import IS_WINDOWS, run_command from samcli.local.docker.utils import get_validated_container_client -# Layers tests require credentials and Appveyor will only add credentials to the env if the PR is from the same repo. -# This is to restrict layers tests to run outside of Appveyor, when the branch is not master and tests are not run by Canary. -SKIP_LAYERS_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY +# Layers tests require AWS credentials; they are gated by the requires_credential marker. TIMEOUT = 300 @@ -553,7 +550,6 @@ def test_skip_pull_image_in_env_var(self): self.assertIn("Requested to skip pulling images", process_stderr.decode("utf-8")) # For Windows, this test must run with administrator privilege - @skipIf(SKIP_LAYERS_TESTS, "Skip layers tests in Appveyor only") @pytest.mark.requires_credential def test_invoke_returns_expected_results_from_git_function(self): command_list = InvokeIntegBase.get_command_list( @@ -574,7 +570,6 @@ def test_invoke_returns_expected_results_from_git_function(self): self.assertEqual(process_stdout.decode("utf-8"), '"git init passed"') # For Windows, this test must run with administrator privilege - @skipIf(SKIP_LAYERS_TESTS, "Skip layers tests in Appveyor only") @pytest.mark.requires_credential def test_invoke_returns_expected_results_from_git_function_with_parameters(self): command_list = InvokeIntegBase.get_command_list( @@ -857,7 +852,6 @@ def tearDownClass(cls): (Path("layers", "some-dir", "layer-template-parent.yaml"),), ], ) -@skipIf(SKIP_LAYERS_TESTS, "Skip layers tests in Appveyor only") @pytest.mark.requires_credential @pytest.mark.flaky(reruns=3) @pytest.mark.xdist_group(name="lambda_layers") @@ -1081,7 +1075,7 @@ def test_caching_two_layers_with_layer_cache_env_set(self): self.assertEqual(2, len(cache_contents)) -@skipIf(SKIP_LAYERS_TESTS, "Skip layers tests in Appveyor only") +@pytest.mark.requires_credential @pytest.mark.xdist_group(name="lambda_layers") class TestLocalZipLayerVersion(InvokeIntegBase): template = Path("layers", "local-zip-layer-template.yml") @@ -1101,7 +1095,6 @@ def test_local_zip_layers( self.assertEqual('"Layer1"', execute.stdout.decode()) -@skipIf(SKIP_LAYERS_TESTS, "Skip layers tests in Appveyor only") @pytest.mark.requires_credential @pytest.mark.xdist_group(name="lambda_layers") class TestLayerVersionThatDoNotCreateCache(InvokeIntegBase): @@ -1170,7 +1163,7 @@ def test_account_does_not_exist_for_layer(self): self.assertIn(expected_error_output, error_output) -@skipIf(SKIP_LAYERS_TESTS, "Skip layers tests in Appveyor only") +@pytest.mark.requires_credential @pytest.mark.xdist_group(name="lambda_layers") class TestBadLayerVersion(InvokeIntegBase): template = Path("layers", "layer-bad-template.yaml") diff --git a/tests/integration/local/invoke/test_integrations_do_cli.py b/tests/integration/local/invoke/test_integrations_do_cli.py index 28fb8494959..c4fe1520d16 100644 --- a/tests/integration/local/invoke/test_integrations_do_cli.py +++ b/tests/integration/local/invoke/test_integrations_do_cli.py @@ -1,19 +1,13 @@ -import os import locale -import sys -from io import StringIO from pathlib import Path from parameterized import parameterized import pytest -from tests.integration.local.invoke.layer_utils import LayerUtils from tests.integration.local.invoke.invoke_integ_base import InvokeIntegBase -from tests.testing_utils import IS_WINDOWS, RUNNING_ON_CI, RUNNING_TEST_FOR_MASTER_ON_CI, RUN_BY_CANARY from samcli.commands.local.invoke.cli import cli -from samcli.cli.context import Context from click.testing import CliRunner diff --git a/tests/integration/logs/logs_integ_base.py b/tests/integration/logs/logs_integ_base.py index a6b8d5cbe16..0ee36d6bcb5 100644 --- a/tests/integration/logs/logs_integ_base.py +++ b/tests/integration/logs/logs_integ_base.py @@ -1,18 +1,17 @@ import logging from typing import Optional, List -from unittest import TestCase, skipIf +from unittest import TestCase -from tests.testing_utils import get_sam_command, RUNNING_ON_CI, RUNNING_TEST_FOR_MASTER_ON_CI, RUN_BY_CANARY +from tests.testing_utils import get_sam_command +import pytest RETRY_COUNT = 20 # retry required because of log buffering configuration for each service RETRY_SLEEP = 2 LOG = logging.getLogger(__name__) -SKIP_LOGS_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY - -@skipIf(SKIP_LOGS_TESTS, "Skip logs tests in CI/CD only") +@pytest.mark.requires_credential class LogsIntegBase(TestCase): @staticmethod def get_logs_command_list( diff --git a/tests/integration/package/test_package_command_image.py b/tests/integration/package/test_package_command_image.py index 39f0b36d49a..046b936c5a9 100644 --- a/tests/integration/package/test_package_command_image.py +++ b/tests/integration/package/test_package_command_image.py @@ -3,7 +3,6 @@ import tempfile from subprocess import Popen, PIPE, TimeoutExpired -from unittest import skipIf from urllib.parse import urlparse import boto3 @@ -13,15 +12,14 @@ from samcli.commands._utils.template import get_template_data from samcli.local.docker.utils import get_validated_container_client from tests.integration.package.package_integ_base import PackageIntegBase -from tests.testing_utils import RUNNING_ON_CI, RUNNING_TEST_FOR_MASTER_ON_CI, RUN_BY_CANARY, MAX_ERROR_OUTPUT_LENGTH +from tests.testing_utils import MAX_ERROR_OUTPUT_LENGTH +import pytest -# Package tests require credentials and CI/CD will only add credentials to the env if the PR is from the same repo. -# This is to restrict package tests to run outside of CI/CD, when the branch is not master and tests are not run by Canary. -SKIP_PACKAGE_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY +# These tests require AWS credentials; they are gated by the requires_credential marker. TIMEOUT = 300 -@skipIf(SKIP_PACKAGE_TESTS, "Skip package tests in CI/CD only") +@pytest.mark.requires_credential class TestPackageImage(PackageIntegBase): @classmethod def setUpClass(cls): diff --git a/tests/integration/package/test_package_command_language_extensions.py b/tests/integration/package/test_package_command_language_extensions.py index 2c71e295565..b07699ef47e 100644 --- a/tests/integration/package/test_package_command_language_extensions.py +++ b/tests/integration/package/test_package_command_language_extensions.py @@ -9,18 +9,16 @@ import tempfile from pathlib import Path from subprocess import PIPE, Popen, TimeoutExpired -from unittest import skipIf from samcli.yamlhelper import yaml_parse from .package_integ_base import PackageIntegBase -from tests.testing_utils import RUNNING_ON_CI, RUNNING_TEST_FOR_MASTER_ON_CI, RUN_BY_CANARY +import pytest -SKIP_PACKAGE_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY TIMEOUT = 300 -@skipIf(SKIP_PACKAGE_TESTS, "Skip package tests in CI/CD only") +@pytest.mark.requires_credential class TestPackageLanguageExtensions(PackageIntegBase): """Integration tests for sam package with CloudFormation Language Extensions.""" diff --git a/tests/integration/package/test_package_command_zip.py b/tests/integration/package/test_package_command_zip.py index a328d583522..6fc89b17f76 100644 --- a/tests/integration/package/test_package_command_zip.py +++ b/tests/integration/package/test_package_command_zip.py @@ -5,20 +5,16 @@ import tempfile import pytest -from unittest import skipIf from parameterized import parameterized, param from samcli.lib.utils.hash import dir_checksum from tests.integration.package.package_integ_base import PackageIntegBase -from tests.testing_utils import RUNNING_ON_CI, RUNNING_TEST_FOR_MASTER_ON_CI, RUN_BY_CANARY -# Package tests require credentials and CI/CD will only add credentials to the env if the PR is from the same repo. -# This is to restrict package tests to run outside of CI/CD, when the branch is not master and tests are not run by Canary. -SKIP_PACKAGE_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY +# These tests require AWS credentials; they are gated by the requires_credential marker. TIMEOUT = 300 -@skipIf(SKIP_PACKAGE_TESTS, "Skip package tests in CI/CD only") +@pytest.mark.requires_credential class TestPackageZip(PackageIntegBase): def setUp(self): super().setUp() diff --git a/tests/integration/pipeline/test_bootstrap_command.py b/tests/integration/pipeline/test_bootstrap_command.py index f756e38b6aa..07805bb6f7b 100644 --- a/tests/integration/pipeline/test_bootstrap_command.py +++ b/tests/integration/pipeline/test_bootstrap_command.py @@ -1,5 +1,3 @@ -from unittest import skipIf - import pytest from parameterized import parameterized @@ -7,9 +5,6 @@ from samcli.lib.config.samconfig import SamConfig from tests.integration.pipeline.base import BootstrapIntegBase from tests.testing_utils import ( - run_command_with_input, - RUNNING_ON_CI, - RUNNING_TEST_FOR_MASTER_ON_CI, RUN_BY_CANARY, run_command, run_command_with_inputs, @@ -17,9 +12,7 @@ import boto3 from botocore.exceptions import ClientError -# bootstrap tests require credentials and CI/CD will only add credentials to the env if the PR is from the same repo. -# This is to restrict tests to run outside of CI/CD, when the branch is not master or tests are not run by Canary -SKIP_BOOTSTRAP_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY +# These tests require AWS credentials; they are gated by the requires_credential marker. # In order to run bootstrap integration test locally make sure your test account is configured as `default` account. CREDENTIAL_PROFILE = "2" if not RUN_BY_CANARY else "1" @@ -32,7 +25,7 @@ } -@skipIf(SKIP_BOOTSTRAP_TESTS, "Skip bootstrap tests in CI/CD only") +@pytest.mark.requires_credential class TestBootstrap(BootstrapIntegBase): @parameterized.expand([("create_image_repository",), (False,)]) def test_interactive_with_no_resources_provided(self, create_image_repository): diff --git a/tests/integration/pipeline/test_init_command.py b/tests/integration/pipeline/test_init_command.py index aae0015639b..f13175c428b 100644 --- a/tests/integration/pipeline/test_init_command.py +++ b/tests/integration/pipeline/test_init_command.py @@ -3,7 +3,7 @@ from pathlib import Path from textwrap import dedent from typing import List -from unittest import skipIf +import pytest from parameterized import parameterized @@ -11,7 +11,7 @@ from samcli.commands.pipeline.init.interactive_init_flow import APP_PIPELINE_TEMPLATES_REPO_LOCAL_NAME from samcli.cli.global_config import GlobalConfig from tests.integration.pipeline.base import InitIntegBase, BootstrapIntegBase -from tests.integration.pipeline.test_bootstrap_command import SKIP_BOOTSTRAP_TESTS, CREDENTIAL_PROFILE +from tests.integration.pipeline.test_bootstrap_command import CREDENTIAL_PROFILE from tests.testing_utils import run_command_with_inputs, get_sam_command QUICK_START_JENKINS_INPUTS_WITHOUT_AUTO_FILL = [ @@ -200,7 +200,7 @@ def test_with_pipelineconfig_has_all_stage_values(self, with_bootstrap): self.assertEqual(expected.read(), output.read()) -@skipIf(SKIP_BOOTSTRAP_TESTS, "Skip bootstrap tests in CI/CD only") +@pytest.mark.requires_credential class TestInitWithBootstrap(BootstrapIntegBase): generated_files: List[Path] = [] diff --git a/tests/integration/publish/test_command_integ.py b/tests/integration/publish/test_command_integ.py index a5713c37415..f311b1d96b6 100644 --- a/tests/integration/publish/test_command_integ.py +++ b/tests/integration/publish/test_command_integ.py @@ -3,23 +3,19 @@ import json from subprocess import Popen, PIPE, TimeoutExpired -from unittest import skipIf import pytest from parameterized import parameterized from samcli.commands.publish.command import SEMANTIC_VERSION from tests.integration.publish.publish_app_integ_base import PublishAppIntegBase -from tests.testing_utils import RUNNING_ON_CI, RUNNING_TEST_FOR_MASTER_ON_CI, RUN_BY_CANARY from tests.testing_utils import run_command -# Publish tests require credentials and CI/CD will only add credentials to the env if the PR is from the same repo. -# This is to restrict publish tests to run outside of CI/CD, when the branch is not master and tests are not run by Canary. -SKIP_PUBLISH_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY +# These tests require AWS credentials; they are gated by the requires_credential marker. TIMEOUT = 300 -@skipIf(SKIP_PUBLISH_TESTS, "Skip publish tests in CI/CD only") +@pytest.mark.requires_credential class TestPublishExistingApp(PublishAppIntegBase): def setUp(self): super().setUp() @@ -93,7 +89,7 @@ def test_update_application_fail_on_same_semantic_version(self): self.assertIn(expected_msg, result.stderr.decode("utf-8")) -@skipIf(SKIP_PUBLISH_TESTS, "Skip publish tests in CI/CD only") +@pytest.mark.requires_credential class TestPublishNewApp(PublishAppIntegBase): def setUp(self): super().setUp() diff --git a/tests/integration/sync/test_sync_adl.py b/tests/integration/sync/test_sync_adl.py index 41fa7ec35c4..e56aaf0d1e4 100644 --- a/tests/integration/sync/test_sync_adl.py +++ b/tests/integration/sync/test_sync_adl.py @@ -4,15 +4,14 @@ import pytest -from samcli.commands._utils.experimental import set_experimental, ExperimentalFlag from samcli.lib.utils.resources import AWS_LAMBDA_FUNCTION, AWS_LAMBDA_LAYERVERSION from tests.integration.sync.sync_integ_base import SyncIntegBase -from tests.integration.sync.test_sync_code import TestSyncCodeBase, SKIP_SYNC_TESTS, TestSyncCode +from tests.integration.sync.test_sync_code import TestSyncCodeBase, TestSyncCode from tests.integration.sync.test_sync_watch import TestSyncWatchBase from tests.testing_utils import run_command_with_input, read_until_string, IS_WINDOWS -@skipIf(SKIP_SYNC_TESTS, "Skip sync tests in CI/CD only") +@pytest.mark.requires_credential class TestSyncAdlCasesWithCodeParameter(TestSyncCodeBase): template = "template-python-no-dependencies.yaml" folder = "code" @@ -108,7 +107,8 @@ def test_sync_code_function_without_dependencies(self): self.assertIn("extra_message", lambda_response) -@skipIf(SKIP_SYNC_TESTS or IS_WINDOWS, "Skip sync tests in CI/CD only") +@pytest.mark.requires_credential +@skipIf(IS_WINDOWS, "Skip sync watch tests on Windows") class TestSyncAdlWithWatchStartWithNoDependencies(TestSyncWatchBase): template_before = os.path.join("code", "before", "template-python-no-dependencies.yaml") folder = "code" @@ -169,7 +169,8 @@ def _verify_lambda_response(_lambda_response): self._confirm_lambda_response(self._get_lambda_response(lambda_functions[0]), _verify_lambda_response) -@skipIf(SKIP_SYNC_TESTS or IS_WINDOWS, "Skip sync tests in CI/CD only") +@pytest.mark.requires_credential +@skipIf(IS_WINDOWS, "Skip sync watch tests on Windows") class TestDisableAdlForEsbuildFunctions(SyncIntegBase): template_file = "code/before/template-esbuild.yaml" dependency_layer = True diff --git a/tests/integration/sync/test_sync_code.py b/tests/integration/sync/test_sync_code.py index 497c4a8ce88..9c313e9ec57 100644 --- a/tests/integration/sync/test_sync_code.py +++ b/tests/integration/sync/test_sync_code.py @@ -4,7 +4,6 @@ import logging import json import shutil -import tempfile import time import uuid from pathlib import Path @@ -14,7 +13,6 @@ import pytest import boto3 -from botocore.exceptions import ClientError from parameterized import parameterized_class, parameterized from samcli.lib.utils.resources import ( @@ -24,12 +22,10 @@ ) from tests.integration.sync.sync_integ_base import SyncIntegBase -from tests.testing_utils import RUNNING_ON_CI, RUNNING_TEST_FOR_MASTER_ON_CI, RUN_BY_CANARY, SKIP_LMI_TESTS +from tests.testing_utils import SKIP_LMI_TESTS from tests.testing_utils import run_command_with_input -# Deploy tests require credentials and CI/CD will only add credentials to the env if the PR is from the same repo. -# This is to restrict package tests to run outside of CI/CD, when the branch is not master or tests are not run by Canary -SKIP_SYNC_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY +# These tests require AWS credentials; they are gated by the requires_credential marker. IS_WINDOWS = platform.system().lower() == "windows" # Some wait time for code updates to be reflected on each service API_SLEEP = 5 @@ -90,7 +86,7 @@ def sync_code_base(self, execute_infra_sync): self.assertIn("Stack creation succeeded. Sync infra completed.", str(sync_process_execute.stderr)) -@skipIf(SKIP_SYNC_TESTS, "Skip sync tests in CI/CD only") +@pytest.mark.requires_credential @parameterized_class( [ {"dependency_layer": True, "use_container": True}, @@ -280,7 +276,7 @@ def test_sync_code_state_machine(self): self.assertEqual(self._get_sfn_response(state_machine), '"World 2"') -@skipIf(SKIP_SYNC_TESTS, "Skip sync tests in CI/CD only") +@pytest.mark.requires_credential class TestSyncCodeDotnetFunctionTemplate(TestSyncCodeBase): template = "template-dotnet.yaml" dependency_layer = False @@ -320,7 +316,7 @@ def test_sync_code_shared_codeuri(self): self.assertEqual(lambda_response.get("message"), "hello sam accelerate!!") -@skipIf(SKIP_SYNC_TESTS, "Skip sync tests in CI/CD only") +@pytest.mark.requires_credential @parameterized_class([{"dependency_layer": True}, {"dependency_layer": False}]) class TestSyncCodeNodejsFunctionTemplate(TestSyncCodeBase): template = "template-nodejs.yaml" @@ -374,7 +370,7 @@ def test_sync_code_nodejs_function(self): self.assertIn("@faker-js", layer_contents) -@skipIf(SKIP_SYNC_TESTS, "Skip sync tests in CI/CD only") +@pytest.mark.requires_credential @parameterized_class([{"dependency_layer": True}, {"dependency_layer": False}]) class TestSyncCodeNested(TestSyncCodeBase): template = "template.yaml" @@ -552,7 +548,7 @@ def test_sync_code_nested_state_machine(self): self.assertEqual(self._get_sfn_response(state_machine), '"World 2"') -@skipIf(SKIP_SYNC_TESTS, "Skip sync tests in CI/CD only") +@pytest.mark.requires_credential @parameterized_class([{"dependency_layer": True}, {"dependency_layer": False}]) class TestSyncCodeNestedWithIntrinsics(TestSyncCodeBase): template = "template.yaml" @@ -600,7 +596,7 @@ def test_sync_code_nested_getattr_layer(self): self.assertEqual(lambda_response.get("message"), "9") -@skipIf(SKIP_SYNC_TESTS, "Skip sync tests in CI/CD only") +@pytest.mark.requires_credential class TestSyncCodeEsbuildFunctionTemplate(TestSyncCodeBase): template = "template-esbuild.yaml" folder = "code" @@ -643,7 +639,7 @@ def test_sync_code_esbuild_function(self): self.assertEqual(lambda_response.get("message"), "Hello world!") -@skipIf(SKIP_SYNC_TESTS, "Skip sync tests in CI/CD only") +@pytest.mark.requires_credential @parameterized_class( [ {"dependency_layer": True, "use_container": True}, diff --git a/tests/integration/sync/test_sync_infra.py b/tests/integration/sync/test_sync_infra.py index be4d9deea92..94bbd62a735 100644 --- a/tests/integration/sync/test_sync_infra.py +++ b/tests/integration/sync/test_sync_infra.py @@ -7,7 +7,7 @@ import uuid from pathlib import Path from typing import Dict -from unittest import skipIf, SkipTest +from unittest import skipIf import pytest from parameterized import parameterized, parameterized_class @@ -18,12 +18,10 @@ AWS_STEPFUNCTIONS_STATEMACHINE, ) from tests.integration.sync.sync_integ_base import SyncIntegBase -from tests.testing_utils import RUNNING_ON_CI, RUNNING_TEST_FOR_MASTER_ON_CI, RUN_BY_CANARY, SKIP_LMI_TESTS +from tests.testing_utils import SKIP_LMI_TESTS from tests.testing_utils import run_command_with_input -# Deploy tests require credentials and CI/CD will only add credentials to the env if the PR is from the same repo. -# This is to restrict package tests to run outside of CI/CD, when the branch is not master or tests are not run by Canary -SKIP_SYNC_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY +# These tests require AWS credentials; they are gated by the requires_credential marker. IS_WINDOWS = platform.system().lower() == "windows" # Some wait time for code updates to be reflected on each service API_SLEEP = 5 @@ -33,7 +31,7 @@ LOG = logging.getLogger(__name__) -@skipIf(SKIP_SYNC_TESTS, "Skip sync tests in CI/CD only") +@pytest.mark.requires_credential @parameterized_class([{"dependency_layer": True}, {"dependency_layer": False}]) class TestSyncInfra(SyncIntegBase): parameter_overrides: Dict[str, str] = {} @@ -384,7 +382,7 @@ def test_sync_infra_s3_bucket_option(self, template_file): self.assertEqual(self._get_sfn_response(state_machine), '"World 1"') -@skipIf(SKIP_SYNC_TESTS, "Skip sync tests in CI/CD only") +@pytest.mark.requires_credential class TestSyncInfraCDKTemplates(SyncIntegBase): dependency_layer = None @@ -512,7 +510,7 @@ def test_cdk_templates(self, template_file, template_after, function_id, depende self.assertEqual(lambda_response.get("message"), "9") -@skipIf(SKIP_SYNC_TESTS, "Skip sync tests in CI/CD only") +@pytest.mark.requires_credential @parameterized_class([{"dependency_layer": True}, {"dependency_layer": False}]) class TestSyncInfraWithJava(SyncIntegBase): ecr_repo_name = None @@ -566,7 +564,7 @@ def _run_sync_and_validate_lambda_call(self, dependency_layer: bool, template_pa self.assertEqual(lambda_response.get("sum"), 12) -@skipIf(SKIP_SYNC_TESTS, "Skip sync tests in CI/CD only") +@pytest.mark.requires_credential class TestSyncInfraWithEsbuild(SyncIntegBase): dependency_layer = False @@ -702,7 +700,7 @@ def test_sync_infra_lmi_with_capacity_provider_config(self): self.assertEqual(body["max_concurrency"], "20") # Updated from 10 to 20 -@skipIf(SKIP_SYNC_TESTS, "Skip sync tests in CI/CD only") +@pytest.mark.requires_credential @parameterized_class([{"dependency_layer": False}]) class TestSyncInfraExpress(SyncIntegBase): parameter_overrides: Dict[str, str] = {} diff --git a/tests/integration/sync/test_sync_watch.py b/tests/integration/sync/test_sync_watch.py index 93663f85dbd..f91606a5bda 100644 --- a/tests/integration/sync/test_sync_watch.py +++ b/tests/integration/sync/test_sync_watch.py @@ -8,7 +8,7 @@ import json from pathlib import Path from typing import Dict, List -from unittest import skipIf, SkipTest +from unittest import skipIf import pytest import boto3 @@ -25,9 +25,6 @@ from tests.integration.sync.test_sync_code import API_SLEEP, SFN_SLEEP from tests.testing_utils import ( - RUNNING_ON_CI, - RUNNING_TEST_FOR_MASTER_ON_CI, - RUN_BY_CANARY, SKIP_LMI_TESTS, kill_process, read_until_string, @@ -35,9 +32,7 @@ run_command_with_input, ) -# Deploy tests require credentials and CI/CD will only add credentials to the env if the PR is from the same repo. -# This is to restrict package tests to run outside of CI/CD, when the branch is not master or tests are not run by Canary -SKIP_SYNC_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY +# These tests require AWS credentials; they are gated by the requires_credential marker. CFN_PYTHON_VERSION_SUFFIX = os.environ.get("PYTHON_VERSION", "0.0.0").replace(".", "-") LOG = logging.getLogger(__name__) @@ -52,7 +47,7 @@ LOG.addHandler(handler) -@skipIf(SKIP_SYNC_TESTS, "Skip sync tests in CI/CD only") +@pytest.mark.requires_credential class TestSyncWatchBase(SyncIntegBase): template_before = "" parameter_overrides: Dict[str, str] = {} @@ -60,8 +55,7 @@ class TestSyncWatchBase(SyncIntegBase): @classmethod def setUpClass(cls): - if not SKIP_SYNC_TESTS: - super().setUpClass() + super().setUpClass() def setUp(self): # set up clean testing folder @@ -150,7 +144,7 @@ def _verify_infra_changes(self, resources): self.assertEqual(self._get_sfn_response(state_machine), '"World 2"') -@skipIf(SKIP_SYNC_TESTS, "Skip sync tests in CI/CD only") +@pytest.mark.requires_credential class TestSyncWatchEsbuildBase(TestSyncWatchBase): def _setup_verify_infra(self): template_path = self.test_data_path.joinpath(self.template_before) @@ -588,7 +582,7 @@ def test_sync_watch_code(self): ) -@skipIf(SKIP_SYNC_TESTS, "Skip sync tests in CI/CD only") +@pytest.mark.requires_credential @parameterized_class( [{"runtime": "python", "dependency_layer": True}, {"runtime": "python", "dependency_layer": False}] ) diff --git a/tests/integration/traces/test_traces_command.py b/tests/integration/traces/test_traces_command.py index e325f6e30c0..b4d26536b7b 100644 --- a/tests/integration/traces/test_traces_command.py +++ b/tests/integration/traces/test_traces_command.py @@ -2,7 +2,6 @@ import time from pathlib import Path from typing import Any, List -from unittest import skipIf import boto3 import pytest @@ -12,9 +11,6 @@ from tests.integration.traces.traces_integ_base import TracesIntegBase, RETRY_COUNT, RETRY_SLEEP from tests.testing_utils import ( run_command, - RUNNING_ON_CI, - RUNNING_TEST_FOR_MASTER_ON_CI, - RUN_BY_CANARY, method_to_stack_name, kill_process, start_persistent_process, @@ -26,10 +22,8 @@ LOG = logging.getLogger(__name__) -SKIP_TRACES_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY - -@skipIf(SKIP_TRACES_TESTS, "Skip traces tests in CI/CD only") +@pytest.mark.requires_credential # Deprecated in pytest 9.1. Fix before pytest 10. @pytest.mark.filterwarnings("ignore::pytest.PytestRemovedIn10Warning") @pytest.mark.xdist_group(name="sam_traces") diff --git a/tests/integration/validate/test_validate_command.py b/tests/integration/validate/test_validate_command.py index 990d13473e5..46eb2dac47e 100644 --- a/tests/integration/validate/test_validate_command.py +++ b/tests/integration/validate/test_validate_command.py @@ -10,15 +10,11 @@ from enum import Enum, auto from pathlib import Path from typing import List, Optional -from unittest import TestCase, skip -from unittest.case import skipIf +from unittest import TestCase import pytest from parameterized import parameterized from tests.testing_utils import ( - RUN_BY_CANARY, - RUNNING_ON_CI, - RUNNING_TEST_FOR_MASTER_ON_CI, run_command, get_sam_command, ) @@ -48,9 +44,7 @@ def get_runtime_deprecation_values(runtime): return {"code": "E2533", "msg": "Check if Lambda Function Runtimes are updatable"} -# Validate tests require credentials and CI/CD will only add credentials to the env if the PR is from the same repo. -# This is to restrict package tests to run outside of CI/CD, when the branch is not master or tests are not run by Canary -SKIP_VALIDATE_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY +# These tests require AWS credentials; they are gated by the requires_credential marker. class TemplateFileTypes(Enum): @@ -58,7 +52,7 @@ class TemplateFileTypes(Enum): YAML = auto() -@skipIf(SKIP_VALIDATE_TESTS, "Skip validate tests in CI/CD only") +@pytest.mark.requires_credential class TestValidate(TestCase): @classmethod def setUpClass(cls): diff --git a/tests/integration/validate/test_validate_language_extensions.py b/tests/integration/validate/test_validate_language_extensions.py index 158bf80ad5b..d92d82ba7fd 100644 --- a/tests/integration/validate/test_validate_language_extensions.py +++ b/tests/integration/validate/test_validate_language_extensions.py @@ -3,20 +3,16 @@ """ from pathlib import Path -from unittest import TestCase, skipIf +from unittest import TestCase from tests.testing_utils import ( - RUNNING_ON_CI, - RUNNING_TEST_FOR_MASTER_ON_CI, - RUN_BY_CANARY, run_command, get_sam_command, ) +import pytest -SKIP_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY - -@skipIf(SKIP_TESTS, "Skip validate tests in CI/CD only") +@pytest.mark.requires_credential class TestValidateLanguageExtensions(TestCase): """Integration tests for validate command with Language Extensions.""" diff --git a/tests/regression/deploy/test_deploy_regression.py b/tests/regression/deploy/test_deploy_regression.py index f9a829964b1..997d110ed06 100644 --- a/tests/regression/deploy/test_deploy_regression.py +++ b/tests/regression/deploy/test_deploy_regression.py @@ -3,24 +3,21 @@ import uuid import time from subprocess import Popen, PIPE, TimeoutExpired -from unittest import skipIf import boto3 from parameterized import parameterized from tests.regression.deploy.regression_deploy_base import DeployRegressionBase from tests.regression.package.regression_package_base import PackageRegressionBase -from tests.testing_utils import RUNNING_ON_CI, RUNNING_TEST_FOR_MASTER_ON_CI, RUN_BY_CANARY +import pytest -# Package Regression tests require credentials and CI/CD will only add credentials to the env if the PR is from the same repo. -# This is to restrict package tests to run outside of CI/CD, when the branch is not master and tests are not run by Canary. -SKIP_DEPLOY_REGRESSION_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY +# These tests require AWS credentials; they are gated by the requires_credential marker. CFN_SLEEP = 3 TIMEOUT = 300 # Only testing return codes to be equivalent -@skipIf(SKIP_DEPLOY_REGRESSION_TESTS, "Skip deploy regression tests in CI/CD only") +@pytest.mark.requires_credential class TestDeployRegression(PackageRegressionBase, DeployRegressionBase): def setUp(self): self.sns_arn = os.environ.get("AWS_SNS") diff --git a/tests/regression/package/test_package_regression.py b/tests/regression/package/test_package_regression.py index 5212abcc75c..3274825dc8a 100644 --- a/tests/regression/package/test_package_regression.py +++ b/tests/regression/package/test_package_regression.py @@ -1,20 +1,15 @@ -from unittest import skipIf - import pytest from parameterized import parameterized from tests.regression.package.regression_package_base import PackageRegressionBase -from tests.testing_utils import RUNNING_ON_CI, RUNNING_TEST_FOR_MASTER_ON_CI, RUN_BY_CANARY -# Package Regression tests require credentials and CI/CD will only add credentials to the env if the PR is from the same repo. -# This is to restrict package tests to run outside of CI/CD, when the branch is not master and tests are not run by Canary. -SKIP_PACKAGE_REGRESSION_TESTS = RUNNING_ON_CI and RUNNING_TEST_FOR_MASTER_ON_CI and not RUN_BY_CANARY +# These tests require AWS credentials; they are gated by the requires_credential marker. # Only tested cases where the output template file changes, adding metadata or kms keys does not change the output. -@skipIf(SKIP_PACKAGE_REGRESSION_TESTS, "Skip package regression tests in CI/CD only") +@pytest.mark.requires_credential class TestPackageRegression(PackageRegressionBase): def setUp(self): super().setUp() diff --git a/tests/testing_utils.py b/tests/testing_utils.py index e3dc3286bb5..71982b8d1bc 100644 --- a/tests/testing_utils.py +++ b/tests/testing_utils.py @@ -22,13 +22,8 @@ from samcli.local.docker.utils import get_validated_container_client -RUNNING_ON_APPVEYOR = os.environ.get("APPVEYOR", False) IS_WINDOWS = platform.system().lower() == "windows" -RUNNING_ON_GITHUB_ACTIONS = os.environ.get("CI", False) -RUNNING_ON_CI = RUNNING_ON_APPVEYOR or RUNNING_ON_GITHUB_ACTIONS -RUNNING_TEST_FOR_MASTER_ON_CI = ( - os.environ.get("APPVEYOR_REPO_BRANCH", os.environ.get("GITHUB_REF_NAME", "master")) != "master" -) +RUNNING_ON_CI = os.environ.get("CI", False) CI_OVERRIDE = ( os.environ.get("APPVEYOR_CI_OVERRIDE", False) or os.environ.get("CI_OVERRIDE", False) @@ -37,6 +32,7 @@ RUN_BY_CANARY = os.environ.get("BY_CANARY", False) USING_FINCH_RUNTIME = os.environ.get("CONTAINER_RUNTIME") == "finch" + # Tests require docker suffers from Docker Hub request limit FORCE_RUN_DOCKER_TEST = os.environ.get("FORCE_RUN_DOCKER_TEST", False) SKIP_DOCKER_TESTS = RUNNING_ON_CI and not RUN_BY_CANARY and not FORCE_RUN_DOCKER_TEST