Skip to content

Commit

Permalink
Increment version number
Browse files Browse the repository at this point in the history
  • Loading branch information
shanejansen committed Apr 26, 2020
1 parent 0d0feec commit 18fc719
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Touchstone
![Touchstone Tests](https://github.com/shane-jansen/touchstone/workflows/Touchstone%20Tests/badge.svg?branch=develop)

Touchstone is a testing framework for your services that focuses on [component](https://martinfowler.com/articles/microservice-testing/#testing-component-out-of-process-diagram), [end-to-end](https://martinfowler.com/articles/microservice-testing/#testing-end-to-end-introduction), and [exploratory](https://martinfowler.com/bliki/ExploratoryTesting.html) testing.
**Touchstone is currently in alpha and APIs may change without warning.**


## Introduction
Expand Down Expand Up @@ -54,7 +53,7 @@ Your services and their monitored dependencies are defined here. Default values
* `host:` - Default: parent host. Fine-grained host control per service.
* `port:` - Default: 8080. The port used for this service.
* `dockerfile:` - Default: N/A. Used to containerize the service during `touchstone run`. If you are only running Touchstone locally, this can be omitted.
* `availability_endpoint:` - Default: N/A. Used to determine when the service is healthy so tests can be executed. A `200` must be returned from the endpoint to be considered healthy.
* `availability_endpoint:` - Default: N/A. Used to determine when the service is healthy so tests can be executed. A HTTP status `2xx` must be returned from the endpoint to be considered healthy.
* `num_retries:` - Default: 20. The number of times Touchstone will try to successfully call the `availability_endpoint`.
* `seconds_between_retries:` - Default: 5. The number of seconds between each retry.
* `mocks:` - Each mock dependency your service(s) are being tested against.
Expand Down Expand Up @@ -85,7 +84,9 @@ Important APIs:
* [MySQL](./docs/mocks/mysql.md)
* [Rabbit MQ](./docs/mocks/rabbitmq.md)
* [S3](./docs/mocks/s3.md)
* [Add one!](./docs/under-construction.md)
* [Add one!](./docs/add-mock.md)

If a specific mock is not supported, consider building your service independent of the implementation layer. For example, if have a dependency on PostgreSQL, use the MySQL mock as your database implementation during testing.

When running via `touchstone develop`, dev ports for each mock are used. When running touchstone via `touchstone run`, ports are automatically discovered and available to your service containers via the following environment variables:
* `TS_{MOCK_NAME}_HOST` - Host where the mock is running.
Expand Down
7 changes: 7 additions & 0 deletions docs/add-mock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Contribute a New Mock
======
1. Create a new directory in [touchstone/lib/mocks](../touchstone/lib/mocks)
1. Create a new class extending [Mock](../touchstone/lib/mocks/mock.py)
1. Add a new property to the [Mocks](../touchstone/lib/mocks/mocks.py) class, so your new mock is accessible in user test cases
1. Build a concrete instance of your new mock in the [Bootstrap](../touchstone/bootstrap.py) `__build_mocks` method with its required dependencies
1. Write [unit](../tests) and [Touchstone tests](../touchstone-tests) for your new mock
2 changes: 1 addition & 1 deletion touchstone/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.3'
__version__ = '1.0.0'
2 changes: 1 addition & 1 deletion touchstone/lib/mocks/mongodb/mongodb_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def __init__(self, mongo_client: MongoClient, mongo_context: MongoContext):
self.__mongo_client = mongo_client
self.__mongo_context = mongo_context

def document_exists(self, database: str, collection: str, document: dict, num_expected: int = 1):
def document_exists(self, database: str, collection: str, document: dict, num_expected: int = 1) -> bool:
"""Returns True if a document exists in the given database and collection. If num_expected is set to None,
any number of documents will be considered passing."""
if not self.__mongo_context.collection_exists(database, collection):
Expand Down

0 comments on commit 18fc719

Please sign in to comment.