Update tempest hacking regarding unit tests

This commit just updates some of the hacking documentation around unit
tests. It also adds a new hacking rule to ensure that setUpClass isn't
used for the unit tests.

Partially implements bp unit-tests

Change-Id: Ie8b1c9f1312a467265d53bc28ee905fa1b5fbb53
Moves negative tests from api/compute/servers/test_virtual_interfaces

This change set moves the negative tests in test_virtual_interfaces to
a new file test_virtual_interfaces_negative

Also changes line # 43, rand_name(#$%*&^%) to uuid4() to get the invalid
server ID in negative file and removes usage of modules directly.

Note: HACKING.rst
The second requirement is that all negative tests must be added to a negative
test file. If such a file doesn't exist for the particular resource being
tested a new test file should be added

Change-Id: Ia6b4c927112318b5b6b4583511537d1cbe020f56
Add testcases for volume

Adds tests for those GET API functions that accept params

List_volumes and list_volumes_with_detail for nova volume extension
List_volumes and list_volumes_with_detail for Cinder API
List_snapshots and list_snapshots_with_detail for Cinder API
Fixed typo in volume snapshot json client to make it consistent
with the corresponding xml client method "list_snapshots_with_detail"

Partial-Bug: #1086590

Change-Id: Ie703fa8729d838203c12293a7ce1ce942ec83a81
Separate negative tests for list_floating_ips

Add negative tests for test_list_floating_ips to a specific file.
Since no floating_ips are needed to setup for negative test,
generation of non existent id can be simplified.

bp negative-test-files

Change-Id: I1d3ac0956ea3f69bbd5bde897f0a18fc0e182930
Add tests for keystone OS-TRUST v3 API

Add tests providing coverage of the keystone v3 OS-TRUSTS extension,
as documented at:
https://github.com/openstack/identity-api/blob/master/\
openstack-identity-api/v3/src/markdown/identity-api-v3-os-trust-ext.md

This covers all the documented interfaces to create/delete/list/get
trusts and roles delegated by trusts, except those impacted by bug
1246383 and 1245590, which will be submitted separately.

A subsequent patch will add coverage for consuming trusts via the tokens API.

Note only the JSON API is currently tested due to bug #1246941

Partially-Implements: blueprint keystone-trust-api
Change-Id: I310951f070107f3af33b52fcd2c8e54d82654088
Make Heat's non_empty_stack usable without a server

We don't really need to test with a server to check Heat's
API responses. So just use a trivial resource type (a LaunchConfig)
to create some objects that we can query against. Now we can use
this test to gate.

Change-Id: I71bc065d8a1d2064ca90406543a376ce4d477275
Heat: check response fields

Make sure that we get the expected fields in each response.

Change-Id: Ie3d56304ffc7c80c186e100fc8d83fb78dff3044
Add testcases for security groups

Adds tests for those GET API functions that accept params

List_security_groups Nova API

Skip security groups list by 'all_tenants' search filter test
if neutron is enabled because neutron do not support 'all_tenants'
search filter.

Change-Id: I5867acd03c3d184911281c673ce804455f269f57
Partial-Bug: #1086590
add both v2 and v3 tests for get specified extension

this add tests for getting specified extension info both against
on nova v2 and v3 api.

Partially implements blueprint nova-v3-api-tests

Change-Id: I9e254069db737d3eb9088475d7272d8aa79b1bd1
Only initialize the glance_http if service is enabled

This commit just adds a check to see if glance is set as enabled in
the config file before initializing the glance http client. Previously
regardless of whether glance was enabled or not glance_http would
auth against keystone.

Closes-Bug: #1214774
Change-Id: I07127c21d55d58fdb294468a0b74ce2bc54d8719
avoid resource leaks in keypairs tests

this does some code refactor, uses addCleanup to
avoid resource leaks. and import the module test
instead of attr.

Change-Id: I188bec7dda2cd0f180252a9844e378bb2f8ff6da
port test_keypairs into nova v3 part1

This changeset only copies the v2 files into the appropriate v3
directories unchanged. This is being tried in order to make
reviewing of the porting easier as gerrit will display only what
is actually changed for v3 rather than entirely new files.

Partially implements blueprint nova-v3-api-tests

Change-Id: I1f49bb12cb193bfa7db069f392f845838d6f8cc4
Remove duplicate negative test of flavor_id

As tempest/api/compute/admin/test_flavors.py, it is possible to
specify uuid as flavor_id. In addition, Nova creates a flavor with
uuid flavor_id if passing None as the API parameter of flavor_id.

Then, test_get_flavor_details_for_invalid_flavor_id is not an
"invalid id" test, the test is a "non existent id" test.
So the test and test_non_existent_flavor_id are duplicated, and
this patch merges them to one test.

Change-Id: I73f79f82f48a49208500c2542e55c026f120e921
Add new env variable to specify test path

This commit adds the env variable OS_TEST_PATH to specify the test
discovery path for testr. This can be used to specify which path will
be used for test discovery.
Closes-Bug: #1260710

Change-Id: Idcc8f6b5d82a2adc1a1f8ad04a47e8d694dc7de7
Fix failures when l3_agent_scheduler ext is not available

Some plugins do not support the L3 agent scheduler extension.
Therefore, make the tests that rely on it dependent on whether
this is actually available in the plugin under test.

Change-Id: I3154b646677379a34465c6826b71d4ad72c471a2
Closes-bug: #1231152
Run test_service_type_management test only if extension is available

Change-Id: Ic237610dd1b1511bdee484cc2f7797b92a67b9b3
Closes-bug: #1260877
actually turn on neutron cli tests

the cli tests for neutron were never running in the gate,
because neutron doesn't run a full run, so these had to
be marked as smoke tests. This is getting old....

Change-Id: I1bb61e357a5f1dc30345771bf12732d3461311f9
Move common wait_for_image_status from compute images_client to waiters

The wait_for_image_status method in the compute json/xml images_clients
was copy/paste and needed a better error message when it times out, so
rather than write a better error message and copy it in both places,
move the common code into waiters and make the json/xml clients call
that instead, like we do for wait_for_server_status.

The improved error message should help in debugging that failure when
it's hit.

Related-Bug: #1260982

Change-Id: I5e3e33310a91da71467fa744972f1a0e4c0bdb50
Test for the agent management extension API

Add tests for neutron API '/agents'.

Change-Id: Ifd27abf67f8e22eb2a91bbf77c6536066c4acf62
Separate negative tests for test_availability_zone

Move negative tests from test_availability_zone.py to
test_availability_zone_negative.py

This patch also uses 'AZ' short for the 'AvailabilityZone'.
This is because if the class name 'AvailabilityZoneAdminV3
NegativeTestJSON' is used, the tempest test will occur an
error 'Project name should not be greater than 64 characters.'
The Project name is made of class name and the characters
'-tempest-xxxxxxxxxx-tenant'.
'-tempest-xxxxxxxxxx-tenant' is 26 characters, so the class
name should not exceed 38 characters.

Partially implements blueprint negative-test-files
Change-Id: Ic72264e89ac5fd700202b0c75cc63116d8fca172