This repository has been archived by the owner on Jul 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
docs: Add test & debugging doc #451
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
bb50ae6
docs: Add test & debugging doc
jrconlin 1a07000
docs: integrate TESTING.md content into contract-test documentation u…
Trinaa fb9a0f2
docs: add debugging information to contract test client readme
Trinaa acb569a
Merge branch 'main' into test/docs
jrconlin 6e5d7b1
Merge branch 'main' into test/docs
pjenvey 1d3a31e
docs: fix contile port number in client README
Trinaa a405176
docs: replace command markdown from 'text' to 'shell'
Trinaa 36f2a54
Merge remote-tracking branch 'origin/main' into test/docs
Trinaa 0bf95ca
docs: In contract test README replace 'UserAgent' with 'User-Agent'
Trinaa a5a6b81
docs: In contract test client README add pytest verbose '-vv' instruc…
Trinaa b862cfd
Merge remote-tracking branch 'origin/main' into test/docs
Trinaa 663ee50
Merge branch 'main' into test/docs
pjenvey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,4 +1,4 @@ | ||||||
# contile-contract-tests | ||||||
# Contile Contract Tests | ||||||
|
||||||
This directory contains the automated contract test suite for the Mozilla Tile | ||||||
Service (MTS). Passing contract tests are a prerequisite for moving to the next | ||||||
|
@@ -14,13 +14,14 @@ the individual components of the suite. | |||||
**Test Scenario: success_tiles_cached_for_identical_proxy_params** | ||||||
![Sequence diagram of the integration tests][sequence_diagram] | ||||||
|
||||||
To run the contract tests locally, execute the following from the repository root: | ||||||
### client | ||||||
|
||||||
```text | ||||||
docker compose \ | ||||||
-f test-engineering\contract-tests\docker-compose.yml \ | ||||||
up --abort-on-container-exit --build | ||||||
``` | ||||||
The `client` directory contains a Python-based test framework for the | ||||||
contract tests. The HTTP client used in the framework requests tiles from the | ||||||
MTS and performs checks against the responses. The framework implements response | ||||||
models for the MTS API. | ||||||
|
||||||
For more details see the client [README][client_readme] | ||||||
|
||||||
### partner | ||||||
|
||||||
|
@@ -39,26 +40,73 @@ MTS. | |||||
|
||||||
For more details see the partner [README][partner_readme] | ||||||
|
||||||
### client | ||||||
|
||||||
The `client` directory contains a Python-based test framework for the | ||||||
contract tests. The HTTP client used in the framework requests tiles from the | ||||||
MTS and performs checks against the responses. The framework implements response | ||||||
models for the MTS API. | ||||||
|
||||||
For more details see the client [README][client_readme] | ||||||
|
||||||
### volumes | ||||||
|
||||||
The `volumes` directory contains subdirectories which will be mounted as | ||||||
volumes into the Docker containers used in the contract test suite: | ||||||
|
||||||
- the `volumes/partner` directory contains a YML file which defines every | ||||||
response that the API returns keyed by form-factor and then os-family | ||||||
- the `volumes/contile` directory contains files that need to be provided to a | ||||||
MTS Docker container such as a partner settings file | ||||||
- the `volumes/client` directory contains a YML file which defines every test | ||||||
scenario that the contract test suite will run | ||||||
- the `volumes/contile` directory contains files that need to be provided to a | ||||||
MTS Docker container such as a partner settings file | ||||||
- the `volumes/partner` directory contains a YML file which defines every | ||||||
response that the API returns keyed by form-factor and then os-family | ||||||
|
||||||
|
||||||
## Local Execution | ||||||
|
||||||
To run the contract tests locally, execute the following from the repository root: | ||||||
|
||||||
**Build Contile Docker Image** | ||||||
```shell | ||||||
docker build -t app:build . | ||||||
``` | ||||||
|
||||||
**Build Contract Test Docker Images & Execute Tests** | ||||||
```shell | ||||||
docker compose \ | ||||||
-f test-engineering\contract-tests\docker-compose.yml \ | ||||||
up --abort-on-container-exit --build | ||||||
``` | ||||||
|
||||||
## Debugging | ||||||
|
||||||
The contract testing system is optimized to run within a set of related docker images. | ||||||
|
||||||
### client | ||||||
|
||||||
See the `Debugging` section of the client [README][client_readme] | ||||||
|
||||||
### Contile | ||||||
|
||||||
To run the contile service, and it's dependant partner service locally, execute the | ||||||
following from the contract-tests root: | ||||||
|
||||||
```shell | ||||||
docker-compose run -p 8000:8000 contile | ||||||
``` | ||||||
|
||||||
Contile runs, by default, on `http://localhost:8000/`. | ||||||
However, it may be necessary to run the tests outside of docker, in order to debug | ||||||
functions or manually verify expected results. | ||||||
|
||||||
**Fetching Tiles** | ||||||
|
||||||
Contile will attempt to look up your IP address if you access it using Firefox. | ||||||
The easiest way to get a test response back would be to craft a curl request. | ||||||
For example (presuming that Contile is running on `http://localhost:8000/v1/tiles`): | ||||||
|
||||||
```sh | ||||||
curl -v \ | ||||||
-H "UserAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:10.0) Gecko/20100101 Firefox/91.0'" \ | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or there's also
Suggested change
|
||||||
-H "X-Forwarded-For: '89.160.20.115'" \ | ||||||
"http://localhost:8000/v1/tiles" | ||||||
``` | ||||||
|
||||||
### partner | ||||||
|
||||||
See the `Local Execution` and `Debugging` sections of the partner [README][partner_readme] | ||||||
|
||||||
|
||||||
[client_readme]: ./client/README.md | ||||||
[contract-test-repo]: https://github.com/mozilla-services/contile-integration-tests | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for documenting this 🙂 now my newbie docker self can stop editing docker-compose and accidentally commit it now 🙃