blob: eb524307de53afb6114fe225e4f9ce7aafe9bfe3 [file] [log] [blame] [view]
Jamie Hannaforde8ab7b42014-09-09 16:40:06 +02001# Gophercloud Acceptance tests
2
3The purpose of these acceptance tests is to validate that SDK features meet
4the requirements of a contract - to consumers, other parts of the library, and
5to a remote API.
6
7> **Note:** Because every test will be run against a real API endpoint, you
Jamie Hannaford2a2a1462014-09-10 14:05:45 +02008> may incur bandwidth and service charges for all the resource usage. These
9> tests *should* remove their remote products automatically. However, there may
10> be certain cases where this does not happen; always double-check to make sure
11> you have no stragglers left behind.
Jamie Hannaforde8ab7b42014-09-09 16:40:06 +020012
13### Step 1. Set environment variables
14
Ash Wilson9d0abb22014-10-20 15:15:58 -040015A lot of tests rely on environment variables for configuration - so you will need
Jamie Hannaford0fd67522014-09-09 17:00:22 +020016to set them before running the suite. If you're testing against pure OpenStack APIs,
Ash Wilson9d0abb22014-10-20 15:15:58 -040017you can download a file that contains all of these variables for you: just visit
18the `project/access_and_security` page in your control panel and click the "Download
19OpenStack RC File" button at the top right. For all other providers, you will need
Jamie Hannaford0fd67522014-09-09 17:00:22 +020020to set them manually.
21
Jamie Hannaforde8ab7b42014-09-09 16:40:06 +020022#### Authentication
23
24|Name|Description|
25|---|---|
26|`OS_USERNAME`|Your API username|
27|`OS_PASSWORD`|Your API password|
28|`OS_AUTH_URL`|The identity URL you need to authenticate|
29|`OS_TENANT_NAME`|Your API tenant name|
30|`OS_TENANT_ID`|Your API tenant ID|
31
32#### General
33
34|Name|Description|
35|---|---|
36|`OS_REGION_NAME`|The region you want your resources to reside in|
37
38#### Compute
39
40|Name|Description|
41|---|---|
42|`OS_IMAGE_ID`|The ID of the image your want your server to be based on|
43|`OS_FLAVOR_ID`|The ID of the flavor you want your server to be based on|
44|`OS_FLAVOR_ID_RESIZE`|The ID of the flavor you want your server to be resized to|
Joe Topjian0dd44872016-07-26 02:06:38 +000045|`OS_POOL_NAME`|The Pool from where to obtain Floating IPs|
46|`OS_NETWORK_NAME`|The network to launch instances on|
Jamie Hannaforde8ab7b42014-09-09 16:40:06 +020047
Mikko Valkonen9368c002017-01-16 18:31:39 +020048#### Shared file systems
49|Name|Description|
50|---|---|
51|`OS_SHARE_NETWORK_ID`| The share network ID to use when creating shares|
52
Jamie Hannaforde8ab7b42014-09-09 16:40:06 +020053### 2. Run the test suite
54
Jamie Hannaford1c5f5532014-10-22 11:44:55 +020055From the root directory, run:
Jamie Hannaforde8ab7b42014-09-09 16:40:06 +020056
57```
Jamie Hannaford1c5f5532014-10-22 11:44:55 +020058./script/acceptancetest
Ash Wilson9d0abb22014-10-20 15:15:58 -040059```
Joe Topjian0dd44872016-07-26 02:06:38 +000060
61Alternatively, add the following to your `.bashrc`:
62
63```bash
64gophercloudtest() {
65 if [[ -n $1 ]] && [[ -n $2 ]]; then
Krzysztof Szukiełojć3f41d082017-05-07 14:43:06 +020066 pushd ~/go/src/gerrit.mcp.mirantis.net/debian/gophercloud.git
Krzysztof Szukiełojć24a29ce2017-05-07 14:24:02 +020067 go test -v -tags "fixtures acceptance" -run "$1" gerrit.mcp.mirantis.net/debian/gophercloud.git/acceptance/openstack/$2 | tee ~/gophercloud.log
Joe Topjian0dd44872016-07-26 02:06:38 +000068 popd
69fi
70}
71```
72
73Then run either groups or individual tests by doing:
74
75```shell
76$ gophercloudtest TestFlavorsList compute/v2
77$ gophercloudtest TestFlavors compute/v2
78$ gophercloudtest Test compute/v2
79```
80
81### 3. Notes
82
83#### Compute Tests
84
85* In order to run the `TestBootFromVolumeMultiEphemeral` test, a flavor with ephemeral disk space must be used.
86* The `TestDefSecRules` tests require a compatible network driver and admin privileges.