faust.livecheck.models

LiveCheck - Models.

class faust.livecheck.models.State(value)[source]

Test execution status.

INIT = 'INIT'
DO_NOT_SHARE = '111/***/111'
FAIL = 'FAIL'
ERROR = 'ERROR'
TIMEOUT = 'TIMEOUT'
STALL = 'STALL'
SKIP = 'SKIP'
is_ok() bool[source]

Return True if this is considered an OK state.

Return type:

bool

class faust.livecheck.models.SignalEvent(signal_name, case_name, key, value, *, __strict__=True, __faust=None, **kwargs)[source]

Signal sent to test (see faust.livecheck.signals.Signal).

signal_name: str
case_name: str
key: Any

Describes a field.

Used for every field in Record so that they can be used in join’s /group_by etc.

Examples

>>> class Withdrawal(Record):
...    account_id: str
...    amount: float = 0.0
>>> Withdrawal.account_id
<FieldDescriptor: Withdrawal.account_id: str>
>>> Withdrawal.amount
<FieldDescriptor: Withdrawal.amount: float = 0.0>
Parameters:
  • field (str) – Name of field.

  • type (Type) – Field value type.

  • required (bool) – Set to false if field is optional.

  • default (Any) – Default value when required=False.

Keyword Arguments:
  • model (Type) – Model class the field belongs to.

  • parent (FieldDescriptorT) – parent field if any.

value: Any

Describes a field.

Used for every field in Record so that they can be used in join’s /group_by etc.

Examples

>>> class Withdrawal(Record):
...    account_id: str
...    amount: float = 0.0
>>> Withdrawal.account_id
<FieldDescriptor: Withdrawal.account_id: str>
>>> Withdrawal.amount
<FieldDescriptor: Withdrawal.amount: float = 0.0>
Parameters:
  • field (str) – Name of field.

  • type (Type) – Field value type.

  • required (bool) – Set to false if field is optional.

  • default (Any) – Default value when required=False.

Keyword Arguments:
  • model (Type) – Model class the field belongs to.

  • parent (FieldDescriptorT) – parent field if any.

asdict()

Convert record to Python dictionary.

class faust.livecheck.models.TestExecution(id, case_name, timestamp, test_args, test_kwargs, expires, *, __strict__=True, __faust=None, **kwargs)[source]

Requested test execution.

id: str
case_name: str
timestamp: datetime
test_args: List[Any]

Describes a field.

Used for every field in Record so that they can be used in join’s /group_by etc.

Examples

>>> class Withdrawal(Record):
...    account_id: str
...    amount: float = 0.0
>>> Withdrawal.account_id
<FieldDescriptor: Withdrawal.account_id: str>
>>> Withdrawal.amount
<FieldDescriptor: Withdrawal.amount: float = 0.0>
Parameters:
  • field (str) – Name of field.

  • type (Type) – Field value type.

  • required (bool) – Set to false if field is optional.

  • default (Any) – Default value when required=False.

Keyword Arguments:
  • model (Type) – Model class the field belongs to.

  • parent (FieldDescriptorT) – parent field if any.

test_kwargs: Dict[str, Any]

Describes a field.

Used for every field in Record so that they can be used in join’s /group_by etc.

Examples

>>> class Withdrawal(Record):
...    account_id: str
...    amount: float = 0.0
>>> Withdrawal.account_id
<FieldDescriptor: Withdrawal.account_id: str>
>>> Withdrawal.amount
<FieldDescriptor: Withdrawal.amount: float = 0.0>
Parameters:
  • field (str) – Name of field.

  • type (Type) – Field value type.

  • required (bool) – Set to false if field is optional.

  • default (Any) – Default value when required=False.

Keyword Arguments:
  • model (Type) – Model class the field belongs to.

  • parent (FieldDescriptorT) – parent field if any.

expires: datetime
classmethod from_headers(headers: Mapping) Optional[TestExecution][source]

Create instance from mapping of HTTP/Kafka headers.

Return type:

_UnionGenericAlias[TestExecution, None]

as_headers() Mapping[source]

Return test metadata as mapping of HTTP/Kafka headers.

Return type:

_SpecialGenericAlias

ident[source]

Return long identifier for this test used in logs.

shortident[source]

Return short identifier for this test used in logs.

human_date[source]

Return human-readable description of test timestamp.

was_issued_today[source]

Return True if test was issued on todays date.

is_expired[source]

Return True if this test already expired.

short_case_name[source]

Return abbreviated case name.

asdict()

Convert record to Python dictionary.

class faust.livecheck.models.TestReport(case_name, state, signal_latency, test=None, runtime=None, error=None, traceback=None, *, __strict__=True, __faust=None, **kwargs)[source]

Report after test execution.

case_name: str
state: State

Describes a field.

Used for every field in Record so that they can be used in join’s /group_by etc.

Examples

>>> class Withdrawal(Record):
...    account_id: str
...    amount: float = 0.0
>>> Withdrawal.account_id
<FieldDescriptor: Withdrawal.account_id: str>
>>> Withdrawal.amount
<FieldDescriptor: Withdrawal.amount: float = 0.0>
Parameters:
  • field (str) – Name of field.

  • type (Type) – Field value type.

  • required (bool) – Set to false if field is optional.

  • default (Any) – Default value when required=False.

Keyword Arguments:
  • model (Type) – Model class the field belongs to.

  • parent (FieldDescriptorT) – parent field if any.

test: Optional[TestExecution]

Describes a field.

Used for every field in Record so that they can be used in join’s /group_by etc.

Examples

>>> class Withdrawal(Record):
...    account_id: str
...    amount: float = 0.0
>>> Withdrawal.account_id
<FieldDescriptor: Withdrawal.account_id: str>
>>> Withdrawal.amount
<FieldDescriptor: Withdrawal.amount: float = 0.0>
Parameters:
  • field (str) – Name of field.

  • type (Type) – Field value type.

  • required (bool) – Set to false if field is optional.

  • default (Any) – Default value when required=False.

Keyword Arguments:
  • model (Type) – Model class the field belongs to.

  • parent (FieldDescriptorT) – parent field if any.

runtime: Optional[float]
signal_latency: Dict[str, float]

Describes a field.

Used for every field in Record so that they can be used in join’s /group_by etc.

Examples

>>> class Withdrawal(Record):
...    account_id: str
...    amount: float = 0.0
>>> Withdrawal.account_id
<FieldDescriptor: Withdrawal.account_id: str>
>>> Withdrawal.amount
<FieldDescriptor: Withdrawal.amount: float = 0.0>
Parameters:
  • field (str) – Name of field.

  • type (Type) – Field value type.

  • required (bool) – Set to false if field is optional.

  • default (Any) – Default value when required=False.

Keyword Arguments:
  • model (Type) – Model class the field belongs to.

  • parent (FieldDescriptorT) – parent field if any.

error: Optional[str]
traceback: Optional[str]
asdict()

Convert record to Python dictionary.