alarmageddon package

Submodules

alarmageddon.config module

Configuration object used by Alarmageddon

class alarmageddon.config.Config(dictionary, environment_name)[source]

Bases: dict

Alarmageddon configuration object.

A configuration object that both acts like a read-only dictionary and provides some methods to access application specific settings

Parameters:
  • dictionary – A dictionary of the form {‘env’:{config options},...}
  • environment_name – The environment that this Config object belongs to
ENVIRONMENT_KEY = 'environment'
environment_name()[source]

returns current environment name

static from_file(config_path, environment_name)[source]

Load a Config object from a file

An environment_name must be provided so that the resulting Config object can provide access to environment specific settings.

hostname(alias)[source]

Returns an environment-specific hostname given its alias.

host names are pulled from the hosts dictionary under each of the environment dictionaries.

test_results_file()[source]

returns the location of the test results file

alarmageddon.reporter module

Reports test results to registered publishers.

class alarmageddon.reporter.Reporter(publishers)[source]

Bases: object

Class for collecting and sending results to publishers.

Parameters:publishers – List of Publisher objects to send results to.
collect(result)[source]

Construct a result from item and store for publishing.

Called by pytest, through the Alarmageddon plugin.

report()[source]

Send reports to all publishers

exception alarmageddon.reporter.ReportingFailure(failures)[source]

Bases: exceptions.Exception

An exception that aggregates multiple PublishFailures.

Parameters:failures – A list of PublishFailures

alarmageddon.result module

Classes that represent possible results of running a test.

class alarmageddon.result.Failure(test_name, validation, description, time=None)[source]

Bases: alarmageddon.result.TestResult

The result of a failed validation.

description is required.

is_failure()[source]

Returns True.

class alarmageddon.result.Success(test_name, validation, description=None, time=None)[source]

Bases: alarmageddon.result.TestResult

The result of a successful validation.

is_failure()[source]

Returns False.

class alarmageddon.result.TestResult(test_name, validation, description=None, time=None)[source]

Bases: object

Base class representing the result of performing a validation.

Contains the outcome information that Alarmageddon will publish.

Parameters:
  • test_name – Name of the validation this result is associated with.
  • validation – The Validation this result is associated with.
  • description – Default None. A description of the outcome of the validation. If the validation failed, this field is expected to not be None.
  • time – Default None. How long the validation took to perform.
description()[source]

Returns additional descriptive text about the test.

For Failures, description is required.

is_failure()[source]

Returns True if and only if this Result represents a failed test.

test_name()[source]

Returns the name of the test.

alarmageddon.run module

Methods that support running tests

alarmageddon.run.construct_publishers(config)[source]

Construct the built-in publishers.

Parameters:config – Config object to construct the publishers from.
alarmageddon.run.do_dry_run(validations, publishers)[source]

Print which validations will be published by which publishers.

Assume all validations fail and list the messages that would have been published.

Parameters:
  • validations – List of Validation objects that Alarmageddon would perform.
  • publishers – List of Publisher objects that Alarmageddon would publish validation results to.
alarmageddon.run.load_config(config_path, environment_name)[source]

Helper method for loading a Config

Parameters:
  • config_path – Path to the JSON configuration file.
  • environment_name – The config environment to run Alarmageddon in.
alarmageddon.run.run_tests(validations, publishers=None, config_path=None, environment_name=None, config=None, dry_run=False, processes=1, print_banner=True)[source]

Main entry point into Alarmageddon.

Run the given validations and report them to given publishers.

Either both config_path and environment_name should not be None, or config should not be None.

Parameters:
  • validations – List of Validation objects that Alarmageddon will perform.
  • publishers – List of Publisher objects that Alarmageddon will publish validation results to.
  • dry_run – When True, will prevent Alarmageddon from performing validations or publishing results, and instead will print which validations will be published by which publishers upon failure.
  • processes – The number of worker processes to spawn. Does not run spawn additional processes if set to 1.
  • print_banner – When True, print the Alarmageddon banner.

Deprecated since version 1.0.0: These parameters are no longer used: config_path, environment_name, config. Configuration happens when constructing publishers instead.

Module contents

Alarmageddon main module