gds-operations/vcloud-core — pull request #146 by dcarley (2014-11-28 16:54:44+00:00)
Title: [Fixes #75811634] vcloud-logout and revoke session token after tests

#### Expose method to logout of vCloud session
This will form the basis of a new command line utility to revoke a vCloud
session token. We'll use this foremost to make sure that session tokens
created during integration tests aren't valid for use after the tests have
finished.

The `return true` at the end of `Vcloud::Core::Fog.logout` prevents the
Excon response from Fog being exposed to callers when logout has been
successful.

I've called our `ServiceInterface` method `logout` instead of the underlying
`delete_logout` because we don't need to know at this level what type of
HTTP request is being sent to vCloud.

The integration tests create a new temporary token and confirm that it is
working, then revokes it and verifies that it no longer works. The use of a
temporary token and stubbing `ENV` prevents us from affecting other other
tests by preventing:

- `logout` from revoking the real token
- `Login.token` from deleting `FOG_VCLOUD_TOKEN` from the real `ENV`

#### Logout after Vcloud::Core::Fog::Login tests
Ensure that new vCloud session tokens created during the integration tests
for `Vcloud::Core::Fog::Login` are revoked. There's a small chance that
rspec's matcher could print one of these tokens if there was a test failure,
so it's better to be safe than sorry.

#### New vcloud-logout utility
To allow users and our integration tests to revoke vCloud session tokens
that have been created by `vcloud-login`. This is a simple wrapper on top of
`Vcloud::Core::Fog.logout` which returns the correct exit codes and only
prints an abbreviated exception to STDERR when there's a problem.

#### Call vcloud-logout after integration tests
To guard us against the possibility that our vCloud session tokens might be
exposed and copy/pasted from CI build output. I'm using a `trap` to ensure
that this gets called regardless of whether the spec or integrations tests
fail.