Package com.google.cloud.resourcemanager.testing (1.15.0)

A testing helper for Google Cloud Resource Manager.

A simple usage example: Before the test:


 LocalResourceManagerHelper resourceManagerHelper = LocalResourceManagerHelper.create();
 resourceManagerHelper.start();
 ResourceManager resourceManager = resourceManagerHelper.getOptions().getService();
 

After the test:


 resourceManagerHelper.stop();
 

Classes

LocalResourceManagerHelper (deprecated)

Deprecated. v3 GAPIC client of ResourceManager is now available

Utility to create a local Resource Manager mock for testing.

The mock runs in a separate thread, listening for HTTP requests on the local machine at an ephemeral port. While this mock attempts to simulate the Cloud Resource Manager, there are some divergences in behavior. The following is a non-exhaustive list of some of those behavioral differences:

  • This mock assumes you have adequate permissions for any action. Related to this, testIamPermissions always indicates that the caller has all permissions listed in the request.
  • IAM policies are set to an empty policy with version 0 (only legacy roles supported) upon project creation. The actual service will not have an empty list of bindings and may also set your version to 1.
  • There is no input validation for the policy provided when replacing a policy or calling testIamPermissions.
  • In this mock, projects never move from the DELETE_REQUESTED lifecycle state to DELETE_IN_PROGRESS without an explicit call to the utility method #changeLifecycleState. Similarly, a project is never completely removed without an explicit call to the utility method #removeProject.
  • The messages in the error responses given by this mock do not necessarily match the messages given by the actual service.