apamax.eplapplications.platform

LOG_SPOOLING_REQUEST_TIMEOUT_SECS

apamax.eplapplications.platform.LOG_SPOOLING_REQUEST_TIMEOUT_SECS = 10

Timeout (in seconds) for each socket operation when requesting the microservice log, so that a stalled request does not stop that thread noticing it has been asked to stop. Bounds each operation, not the whole request.

LOG_SPOOLING_POLL_INTERVAL_SECS

apamax.eplapplications.platform.LOG_SPOOLING_POLL_INTERVAL_SECS = 1.0

How long (in seconds) the log spooling thread waits between requests for the microservice log.

LOG_SPOOLING_WINDOW_OVERLAP_SECS

apamax.eplapplications.platform.LOG_SPOOLING_WINDOW_OVERLAP_SECS = 10

How far back (in seconds) each log request overlaps the previous one, to cover the lag before a logged line becomes queryable. Duplicates only cost bandwidth; anything below the lag is lost for good.

LOG_SPOOLING_START_SKEW_ALLOWANCE_SECS

apamax.eplapplications.platform.LOG_SPOOLING_START_SKEW_ALLOWANCE_SECS = 1.0

How far back (in seconds) before spooling started the window may reach, allowing for the platform’s clock being behind ours. Kept small, as anything here risks collecting the tail of a previous test’s log.

LOG_SPOOLING_FAILURES_BEFORE_REDISCOVERY

apamax.eplapplications.platform.LOG_SPOOLING_FAILURES_BEFORE_REDISCOVERY = 5

How many consecutive failed log requests before looking for the instance that replaced the one we are on.

CumulocityPlatform

class apamax.eplapplications.platform.CumulocityPlatform(parent)[source]

Bases: object

Class to create a connection to the Cumulocity platform configured in pysysproject.xml and spool the logs from the platform locally.

Requires the following properties to be set in pysysproject.xml:
  • CUMULOCITY_SERVER_URL

  • CUMULOCITY_TENANT

  • CUMULOCITY_USERNAME

  • CUMULOCITY_PASSWORD

For use with the EPLApps class for uploading EPL applications:

self.platform = CumulocityPlatform(self) eplapps = EPLApps(self.platform.getC8YConnection()) eplapps.deploy(self.input+’/test.mon’, activate=True) self.waitForGrep(self.platform.getApamaLogFile(), expr=’Added monitor eplfiles.test’)

Parameters:

parent – The PySys test object using this platform object.

getApamaLogFile()[source]

Return the path to the Apama log file within Cumulocity.

getC8YConnection()[source]

Return the C8yConnection object for this platform.

getC8yConnectionDetails()[source]

Return the (url, tenantid, username, password) defined in the pysysproject.xml)

getMicroserviceName()[source]

Get the name of the Apama-ctrl microservice being tested.

getSubscribedTenants()[source]

Get list of Cumulocity tenants subscribed to the Apama-ctrl microservice if testing against a multi-tenant Apama-ctrl microservice.

If the Apama-ctrl microservice is per-tenant, it returns a list only containing the configured tenant.

Returns:

List of Cumulocity tenants.

Return type:

list[CumulocityTenant]

getTenant()[source]

Get the Cumulocity tenant configured in the pysysproject.xml file. :return: The Cumulocity tenant. :rtype: CumulocityTenant

shutdown()[source]

Stop spooling the log files when the test finishes.