pip_services3_components.test package


Module contents

class pip_services3_components.test.DefaultTestFactory

Bases: pip_services3_components.build.Factory.Factory

Creates test components by their descriptors.

See Factory, Shutdown

ShutdownDescriptor = <pip_services3_commons.refer.Descriptor.Descriptor object>
class pip_services3_components.test.SetInterval(callback, interval)

Bases: threading.Thread


Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

class pip_services3_components.test.Shutdown

Bases: pip_services3_commons.config.IConfigurable.IConfigurable, pip_services3_commons.run.IOpenable.IOpenable

Random shutdown component that crashes the process using various methods.

The component is usually used for testing, but brave developers can try to use it in production to randomly crash microservices. It follows the concept of “Chaos Monkey” popularized by Netflix.

### Configuration parameters ###

  • mode: null - crash by NullPointer excepiton, zero - crash by dividing by zero, excetion = crash by unhandled exception, exit - exit the process

  • min_timeout: minimum crash timeout in milliseconds (default: 5 mins)

  • max_timeout: maximum crash timeout in milliseconds (default: 15 minutes)


close(correlation_id: Optional[str])

Closes component and frees used resources.


correlation_id – (optional) transaction id to trace execution through call chain.

configure(config: pip_services3_commons.config.ConfigParams.ConfigParams)

Configures component by passing configuration parameters.


config – configuration parameters to be set.


Checks if the component is opened.


true if the component has been opened and false otherwise.

open(correlation_id: Optional[str])

Opens the component.


correlation_id – (optional) transaction id to trace execution through call chain.


Crashes the process using the configured crash mode.