2019-08-27 23:12:14 +08:00
|
|
|
# Automatic blackbox tests
|
|
|
|
### Prerequisites
|
|
|
|
1. Download google sdk: https://cloud.google.com/sdk/docs/
|
2021-05-13 14:14:50 +08:00
|
|
|
2. Download service account key for MonkeyZoo project (if you deployed MonkeyZoo via terraform scripts then you already have it).
|
2020-07-30 17:41:25 +08:00
|
|
|
GCP console -> IAM -> service accounts(you can use the same key used to authenticate terraform scripts).
|
|
|
|
Place the key in `envs/monkey_zoo/gcp_keys/gcp_key.json`.
|
2021-05-13 14:14:50 +08:00
|
|
|
3. Deploy the relevant branch + complied executables to the Island machine on GCP.
|
2019-10-06 20:05:34 +08:00
|
|
|
|
|
|
|
### Running the tests
|
2021-05-13 14:14:50 +08:00
|
|
|
In order to execute the entire test suite, you must know the external IP of the Island machine on GCP. You can find
|
|
|
|
this information in the GCP Console `Compute Engine/VM Instances` under _External IP_.
|
2019-10-06 20:05:34 +08:00
|
|
|
|
|
|
|
#### Running in command line
|
2021-05-13 14:14:50 +08:00
|
|
|
Either run pytest from `/monkey` directory or set `PYTHONPATH` environment variable to
|
2021-05-17 19:39:30 +08:00
|
|
|
`/monkey` directory so that blackbox tests can import other monkey code.
|
2020-05-13 15:44:04 +08:00
|
|
|
Blackbox tests have following parameters:
|
|
|
|
- `--island=IP` Sets island's IP
|
|
|
|
- `--no-gcp` (Optional) Use for no interaction with the cloud (local test).
|
|
|
|
|
|
|
|
Example run command:
|
2019-10-06 20:05:34 +08:00
|
|
|
|
2021-03-08 22:47:16 +08:00
|
|
|
`monkey\monkey>python -m pytest -s --island=35.207.152.72:5000 ..\envs\monkey_zoo\blackbox\test_blackbox.py`
|
2019-10-06 20:05:34 +08:00
|
|
|
|
|
|
|
#### Running in PyCharm
|
2021-03-08 21:54:15 +08:00
|
|
|
Configure a PyTest configuration with the additional arguments `-s --island=35.207.152.72:5000`, and to run from
|
2020-07-30 17:41:25 +08:00
|
|
|
directory `monkey\envs\monkey_zoo\blackbox`.
|