Skip to content

Commit e77d320

Browse files
author
Jamie Hannaford
authored
Merge pull request #89 from haphan/contrib
[rfr] Add clearer steps on how to set up ENV in Contribution.md
2 parents 165c935 + 4de4ca0 commit e77d320

File tree

2 files changed

+45
-5
lines changed

2 files changed

+45
-5
lines changed

CONTRIBUTING.md

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,23 +206,51 @@ deleted after the test suite finishes.
206206
We use all of our sample files as live integration tests, achieving the dual aim of reducing code duplication and
207207
ensuring that our samples actually work.
208208

209+
### Setting up environment variables
210+
211+
Rename `env_test.sh.dist` as `env_test.sh` and replace values according to your OpenStack instance configuration.
212+
Completed file may look as following.
213+
214+
215+
```bash
216+
#!/usr/bin/env bash
217+
export OS_AUTH_URL="http://1.2.3.4:5000/v3"
218+
export OS_REGION="RegionOne"
219+
export OS_REGION_NAME="RegionOne"
220+
export OS_USER_ID="536068bcb1b946ff8e2f10eff6543f9c"
221+
export OS_USERNAME="admin"
222+
export OS_PASSWORD="2251639ecaea442b"
223+
export OS_PROJECT_ID="b62b3bebf9e84e4eb11aafcd8c58db3f"
224+
export OS_PROJECT_NAME="admin"
225+
export OS_RESIZE_FLAVOR=2 #Must be a valid flavor ID
226+
export OS_FLAVOR=1 #Must be a valid flavor ID
227+
export OS_DOMAIN_ID="default"
228+
```
229+
230+
To export environment variables, run
231+
```bash
232+
$ . env_test.sh
233+
```
234+
235+
Additionally, integration tests require image called `cirros` exists.
236+
209237
### Running integration tests
210238

211239
You interact with integration tests through a runner script:
212240

213241
```bash
214-
php ./integration/Runner.php
242+
php ./tests/integration/run.php
215243
```
216244

217245
It supports these command-line flags:
218246

219247
| Flag | Description | Example |
220248
| ---- | ----------- | ------- |
221-
| `-s` `--service` | Allows you to refine tests by a particular service. A service corresponds to top-level directories in the `./integration` directory, meaning that `compute` and `identity` are services because they exist as sub-directories there. If omitted, all services are run.|Run compute service: `php ./integration/Runner.php -s compute` Run all tests: `php ./integration/Runner.php`|
222-
| `-v` `--version` | Allows you to refine by a particular service version. A version corresponds to the sub-directories inside a service directory, meaning that `v2` is a supported version of `compute` because it exists as a sub-directory inside the `compute` directory. If omitted, all versions are run.|Run v2 Compute tests: `php ./integration/Runner.php -s compute -v v2` Run all compute tests: `php ./integration/Runner.php -s compute`|
223-
| `-t` `--test` | Allows you to refine by a particular test. Tests are defined in classes like `integration\OpenStack\Compute\v2`. Each test method manually references a sample file. To refine which tests are run, list the name of the method in this class. If omitted, all tests are run.|Run create server test: `php ./integration/Runner.php -s compute -v v2 -t createServer` Run all compute v2 tests: `php ./integration/Runner.php -s compute -v v2`|
249+
| `-s` `--service` | Allows you to refine tests by a particular service. A service corresponds to top-level directories in the `./integration` directory, meaning that `compute` and `identity` are services because they exist as sub-directories there. If omitted, all services are run.|Run compute service: `php ./tests/integration/run.php -s compute` Run all tests: `php ./tests/integration/run.php`|
250+
| `-v` `--version` | Allows you to refine by a particular service version. A version corresponds to the sub-directories inside a service directory, meaning that `v2` is a supported version of `compute` because it exists as a sub-directory inside the `compute` directory. If omitted, all versions are run.|Run v2 Compute tests: `php ./tests/integration/run.php -s compute -v v2` Run all compute tests: `php ./tests/integration/run.php -s compute`|
251+
| `-t` `--test` | Allows you to refine by a particular test. Tests are defined in classes like `integration\OpenStack\Compute\v2`. Each test method manually references a sample file. To refine which tests are run, list the name of the method in this class. If omitted, all tests are run.|Run create server test: `php ./tests/integration/run.php -s compute -v v2 -t createServer` Run all compute v2 tests: `php ./tests/integration/run.php -s compute -v v2`|
224252
| `--debug` |||
225-
| `--help` | A help screen is returned and no tests run | `php ./integration/Runner.php --help`
253+
| `--help` | A help screen is returned and no tests run | `php ./tests/integration/run.php --help`
226254

227255

228256
## Style guide

env_test.sh.dist

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
export OS_AUTH_URL=""
3+
export OS_REGION=""
4+
export OS_REGION_NAME=""
5+
export OS_USER_ID=""
6+
export OS_USERNAME=""
7+
export OS_PASSWORD=""
8+
export OS_PROJECT_ID=""
9+
export OS_PROJECT_NAME=""
10+
export OS_RESIZE_FLAVOR=""
11+
export OS_FLAVOR=""
12+
export OS_DOMAIN_ID="default"

0 commit comments

Comments
 (0)