Using Python agent - Cloud Foundry Integration

SeaLights Python agent has been integrated into the Cloud Foundry Python Buildpack since its version v1.8.13.

Sealights use the BeforeCompile hook in the Python build pack to install an agent and all required dependencies in the target container. So once the application is pushed to the cloud foundry service the following steps occur:

  1. Sealights hook verifies that the application is bound with the sealights service

  2. Install the agent from the Pypi repository

  3. Modify target application start command

Setup

Create Service Configuration

To manage application integrations with third-party services Cloud Foundry has the mechanism of the User-Provided Services. So the first step is to create such a service with the configuration. Here is the command “create-user-provided-service“ that does that:

cf cups sealights -p '{"token":"ey…"}'

It is also possible to provide a token file

cf cups sealights -p '{"tokenfile":"/path/to/sltoken.txt"}'

In the Windows commands line, you have to escape " character so the command will look like this:

cf cups sealights -p '{\"token\":\"ey…\"}'

You will be able to change the parameters later with the command “update-user-provided-service

See below the complete list of the available parameters.

Push an application

You can push an application as usual with the command “push

Note: you can use a manifest.yml file to simplify an application deployment

Bind Application with the service

Now you can bind your published application with the service

Restage Application

To apply changes you have to publish your application again, or simply restage it with a command restage. Once the Sealights service is bound, the coverage listener will be triggered attached to your application

Sealights' specific CF environment variables

Env vars provide sealights test listener args as the following

Prameter name

Description

Prameter name

Description

SL_LAB_ID

Allow to determine customer lab id - unique ID for a set of test labs in case multiple labs are running simultaneously

SL_BUILD_SESSION_ID

Sealights build session id

SL_BUILD_SESSION_ID_FILE

File that contains Sealights session id.

SL_PROXY

Address of proxy to run connection through.