CiscoCloud / distributive

Unit testing for the cloud
Apache License 2.0
147 stars 20 forks source link

Rearchitecture #73

Closed langston-barrett closed 8 years ago

langston-barrett commented 9 years ago

Instead of a function type with a specific signature, a check should be a struct/object satisfying the Check interface, specified as following:

// Check is a unified interface for health checks, it defines only the minimal
// necessary behaviors, while allowing each check to parse and store type-safe
// parameters.
type Check interface {
    // ID is a uniquely identifying check name, like "running" or "temp"
    ID() string
    // New both validates the JSON-provided parameters (list of strings),
    // and parses and stores them in an internal, typed field for later access.
    New(parameters []string) (Check, error)
    // Status returns the status of the check at the instant it is called.
    //
    // msg is a descriptive, human-readable description of the status.
    //
    // code is exit code defining whether or not this check is passing.  0 is
    // considered passing, 1 is failing, with other values reserved for later
    // use.
    Status() (code int, msg string, err error)
}

Additionally:

The current work is live in this branch.