CiscoCloud / distributive

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

DockerRunning and DockerRunningRegexp fail on containers without ports #128

Closed ianblenke closed 8 years ago

ianblenke commented 8 years ago

Our Mantl distributive check for nginx-consul was failing with the following error:

    DEBU[0000] Running check DockerRunningRegexp
    DEBU[0000] ProbabalisticSplit couldn't find a consistent regexp  attempted=[\t+ \s{4} \s{2,} \s+] outliers=3
    DEBU[0000] ProbabalisticSplit chose a regexp             regexp=\s{4}

While debugging why DockerRunningRegexp was failing, I've stumbled upon a bug with ProbablisticSplit inaccurately parsing the output of docker ps -a.

When there are no PORTS defined, the regex columns becomes ambiguous, breaking ProbablisticSplit.

A better approach would be to use the --format option to output only the {{.Image}} and {{Status}} values in a machine parseable form.

langston-barrett commented 8 years ago

Fixed in #129