rackerlabs / otter

Rackspace Auto Scale
http://www.rackspace.com/cloud/auto-scale/
Other
53 stars 27 forks source link

make a mimic plugin to allow otter to appear in mimic's service catalog #1158

Open glyph opened 9 years ago

glyph commented 9 years ago

When running mimic in a development configuration, it would be helpful if the tests could point at the local Mimc instance so they could authenticate and see Otter in their service catalog, so no overriding of the Otter endpoint is required.

This should be accomplished with a simple Mimic plugin that generates the appropriate catalog entries. While Mimic normally generates dynamic URL prefixes pointing at its own API mocks, you can override this behavior by having an Endpoint-like object that has a different url_with_prefix implementation that simply returns a hard-coded URL pointed at localhost.

Since Mimic does not have a supported plugin API, it doesn't do the normal Twisted plugins thing of looking all over sys.path for plugins, so in order to get this to work, the plugin would need to be installed into the same virtualenv as Mimic or copied into Mimic's source tree. The easiest way to work around that so the plugin can be bundled within Otter itself would be to write a small setup.py that installs mimic/plugins/otter_mimic_hardcoded_plugin.py and nothing else (since that plugin should have no dependency on Mimic).

Longer term, the right way to do this would be to add a plugin to Mimic that implements the full identity admin API for adding entries to the service catalog, but that is probably a bunch more work than this both on the Mimic side (where that API needs to be implemented) and on the Otter side (where automatic re-provisioning into new service catalogs would need to be implemented).

lvh commented 9 years ago

Okay, cool, I'd like to work on this.

Two use cases:

  1. I am writing things that test otter but don't want to hit production Nova. I hook otter up to Mimic, then tell Mimic about that instance so that it shows up in the service catalog.
  2. I am writing things that test some other complex orchestration system. I want to run all my tests, but not everything has Mimic mocks yet. I don't want to hard code the things that don't use Mimic; my tests should just grab things from the service catalog. Injecting entries into the service catalog means that I can start introducing more and more Mimic mocks piecemeal as necessary.

Do you have any idea where the relevant identity admin docs live?