Metadata-Version: 2.1
Name: b-aws-testing-framework
Version: 0.0.9
Summary: AWS infrastructure testing framework that supports multiple IAC tools.
Home-page: https://github.com/biomapas/B.AwsTestingFramework.git
Author: Laimonas Sutkus
Author-email: laimonas.sutkus@biomapas.com
License: Apache License 2.0
Keywords: AWS Test IAC
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
Requires-Dist: aws-cdk.core (<2.0.0,>=1.54.0)
Requires-Dist: boto3 (<1.16.0,>=1.10.46)
Requires-Dist: pytest (<7.0.0,>=5.4.3)
Requires-Dist: b-continuous-subprocess (<1.0.0,>=0.0.2)

# B.AwsTestingFramework

A python based AWS infrastructure testing micro-framework.<br>
It supports multiple IAC tools like AWS CDK and AWS CloudFormation.

### Description

Creating infrastructure in AWS is quite hard. There are many nuances,
pitfalls and "gotchas" that sometimes are awfully frustrating. Often some 
IAC code changes might result in some unexpected infrastructure changes.
That is why the created infrastructure should have automated integration tests. 
This python based framework provides you basic functionality to help you
write unit ant integration tests to test AWS infrastructure created
via UI or via tools like AWS CDK. 

The framework is based on pytest - a python based testing library. With that
said, all pytest functionality and configs can be applied on this framework too.

The framework is easy to use with explicit examples for each IAC tool. Go to
examples section and find which example suits you the most.

### Remarks

[Biomapas](https://biomapas.com) aims to modernise life-science 
industry by sharing its IT knowledge with other companies and 
the community. This is an open source library intended to be used 
by anyone. Improvements and pull requests are welcome.

### Related technology

- Python 3
- Pytest
- AWS CDK
- AWS CloudFormation

### Assumptions

The project assumes the following:

- You have basic-good knowledge in python programming.
- You have basic-good knowledge in AWS.
- You have basic knowledge in testing.

### Useful sources

- Read more about pytest:<br>
https://docs.pytest.org/en/latest/

### Install

The project is built and uploaded to PyPi. Install it by using pip.

```
pip install b_aws_testing_framework
```

Or directly install it through source.

```
pip install .
```

### Usage & Examples

The framework uses flexible credentials management. You can either
set credentials in the constructor:
```python
from b_aws_testing_framework.credentials import Credentials
Credentials(
    aws_access_key_id='key',
    aws_secret_access_key='secret',
    region_name='region'
)
```

Or you can set the environment:
```
set AWS_ACCESS_KEY_ID=key
set AWS_SECRET_ACCESS_KEY=key
set AWS_DEFAULT_REGION=region
```

And then in your python program:
```python
from b_aws_testing_framework.credentials import Credentials
Credentials()
```

See the specific examples for specific tools:

- [Testing AWS CDK based projects](https://github.com/Biomapas/B.AwsTestingFramework/blob/master/documentation/example-cdk.md)
- [Testing CloudFormation based projects](https://github.com/Biomapas/B.AwsTestingFramework/blob/master/documentation/example-cf.md)

### Testing

The project has tests that can be run. 
Note, that tests are integration tests inherently because they
test how resources are created in AWS environment. Since resources 
are created and tested in AWS you are subject for all the applicable
charges while tests are being run.

#### Setting environment

Before running tests set environment variables:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_DEFAULT_REGION

Or:
- AWS_PROFILE
- AWS_DEFAULT_REGION

#### Running tests

Then run tests from a root directory with `pytest` python testing library.

Testing *CloudFormation* functionality:
```
pytest b_aws_testing_framework_test/tools/testing_with_cf
```

Testing *Cloud Development Kit* functionality:
```
pytest b_aws_testing_framework_test/tools/testing_with_cdk
```

Note that integration tests usually take a while to complete (from 5 to 30
minutes on average).

### Contribution

Found a bug? Want to add or suggest a new feature?<br>
Contributions of any kind are gladly welcome. You may contact us 
directly, create a pull-request or an issue in github platform.
Lets modernize the world together.


# Release history

### 0.0.9
* Create github pipelines.
* Update code.

### 0.0.8
* Make sure CDK deploy works both on linux based systems and windows based systems.

### 0.0.7
* Bug fix related to environment.

### 0.0.6
* Update pytest dependency version.

### 0.0.5
* Rethink how this framework should be used.

### 0.0.4
* Fix imports.
* Update examples.

### 0.0.3
* Rename project.
* Update gitignore and ignore idea files.
* Update MANIFEST.
* Move examples to a documentation folder.

### 0.0.2
* Add hyperlinks for examples.

### 0.0.1
* Initial build.

