pip_services3_components.test package

Submodules

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

run()

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.

stop(interval=0)
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)

Example:

close(correlation_id: Optional[str])

Closes component and frees used resources.

Parameters

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.

Parameters

config – configuration parameters to be set.

is_open()bool

Checks if the component is opened.

Returns

true if the component has been opened and false otherwise.

open(correlation_id: Optional[str])

Opens the component.

Parameters

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

shutdown()

Crashes the process using the configured crash mode.