Skip to content

Commit

Permalink
Fix bootstrap pipeline tests (#679)
Browse files Browse the repository at this point in the history
**Why?**

The tests that execute in the aws-deployment-framework-bootstrap pipeline
failed.

They failed, as the tests picked up environment variables from the actual ADF
installation. Rather than the test environment they run in normally.

**What?**

Fixed by running the tests using tox. Such that the test environment is
created. This ensure the tests are consistent regardless of where they execute.
  • Loading branch information
sbkok authored Jan 18, 2024
1 parent d0a31cc commit aeacdf3
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tox==4.11.4
40 changes: 40 additions & 0 deletions src/lambda_codebase/initial_commit/bootstrap_repository/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# tox (https://tox.readthedocs.io/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

[tox]
envlist = py312
skipsdist = True


[testenv]
setenv=
PYTHONPATH={toxinidir}/adf-build/shared/python
ORGANIZATION_ID=o-123456789
AWS_REGION=eu-central-1
AWS_DEFAULT_REGION=eu-central-1
ADF_PIPELINE_PREFIX=adf-pipeline-
CODEBUILD_BUILD_ID=abcdef
S3_BUCKET=some_bucket
S3_BUCKET_NAME=some_bucket
DEPLOYMENT_ACCOUNT_BUCKET=some_deployment_account_bucket
MASTER_ACCOUNT_ID=123
ADF_VERSION=1.0.0
ADF_LOG_LEVEL=CRITICAL
ADF_PROJECT_NAME=whatever
ACCOUNT_ID=111111111111

allowlist_externals =
pytest
# python
deps =
-r{toxinidir}/adf-build/requirements.txt
-r{toxinidir}/adf-build/requirements-dev.txt
-r{toxinidir}/adf-build/shared/helpers/requirements.txt
-r{toxinidir}/adf-build/shared/helpers/requirements-dev.txt
-r{toxinidir}/adf-build/shared/requirements.txt
-r{toxinidir}/adf-build/shared/requirements-dev.txt

commands =
pytest -vvv
5 changes: 3 additions & 2 deletions src/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,7 @@ Resources:
CodeBuildProject:
Type: AWS::CodeBuild::Project
Properties:
TimeoutInMinutes: 40
TimeoutInMinutes: 60
Artifacts:
Type: CODEPIPELINE
Environment:
Expand Down Expand Up @@ -1377,14 +1377,15 @@ Resources:
commands:
- >-
pip install
-r requirements-dev.txt
-r adf-build/requirements.txt
-r adf-build/requirements-dev.txt
-r adf-build/shared/requirements.txt
-r adf-build/shared/requirements-dev.txt
-r adf-build/shared/helpers/requirements.txt
-r adf-build/shared/helpers/requirements-dev.txt
--quiet
- pytest -vvv
- tox
build:
commands:
- sam build -t adf-bootstrap/deployment/global.yml
Expand Down

0 comments on commit aeacdf3

Please sign in to comment.