separate cbc proxy into separate clients

this is a pretty big and convoluted refactor unfortunately.

Previously:

There was one global `cbc_proxy_client` object in apps. This class has
the information about how to invoke the bt-ee lambda, and handles all
calls to lambda. This includes calls to the canary too (which is a
separate lambda).

The future:

There's one global `cbc_proxy_client`. This knows about the different
provider functions and lambdas, and you'll need to ask this client for a
proxy for your chosen provider. call cbc_proxy_client.get_proxy('ee')`
and it'll return you a proxy that knows what ee's lambda function is,
how to transform any content in a way that is exclusive to ee, and in
future how to parse any response from ee.

The present:

I also cleaned up some duplicate tests.
I'm really not sure about the names of some of these variables - in
particular `cbc_proxy_client` isn't a client - it's more of a java style
factory, where you call a function on it to get the client of your
choice.
This commit is contained in:
Leo Hemsted
2020-11-17 12:35:22 +00:00
parent 0257774cfa
commit 087cc5053d
7 changed files with 110 additions and 193 deletions

View File

@@ -301,7 +301,7 @@ def send_canary_to_cbc_proxy():
identifier = str(uuid.uuid4())
message = f"Sending a canary message to CBC proxy with ID {identifier}"
current_app.logger.info(message)
cbc_proxy_client.send_canary(identifier)
cbc_proxy_client.get_proxy('canary').send_canary(identifier)
@notify_celery.task(name='trigger-link-tests')