• C
    Exit codes: review AVOCADO_JOB_FAIL and AVOCADO_FAIL usage · d20ce0bb
    Cleber Rosa 提交于
    The definition of AVOCADO_JOB_FAIL was "Something went wrong with the
    Job itself, by explicit avocado.core.exceptions.JobError exception",
    while AVOCADO_FAIL is defined as "Something else went wrong and
    avocado failed (or crashed). Commonly used on command line validation
    errors".
    
    With those in mind, I support that AVOCADO_JOB_FAIL should be slightly
    adjusted (see changes in the diff), to include other types of
    failures, but limited to job *execution* failures.  AVOCADO_FAIL is
    already generic enough, so there's no need to change its definition.
    This is important, IMHO, because users could quickly understand if a
    job was executed, and failed, or if some earlier type of failure (such
    as command line validation) happened.
    
    With this updated definition, I spotted a few places where AVOCADO_FAIL
    and AVOCADO_JOB_FAIL usage should be changed.  Examples:
    
     * In `avocado.plugins.diff` the resultsdir is attempted to be read, but
       in my book that still doesn't qualify as a job failure, because a job
       is not being executed.
    
     * In `avocado.plugins.replay` while there's functionality to run a
       (replayed) job, many of the occurrences of AVOCADO_JOB_FAIL are
       similar to the `avocado.plugins.diff` and happen while trying to load
       jobdata from the previous job resultsdir.
    
     * In `avocado.plugins.multiplex` the situation is a bit more tricky.  The
       same code is executed when multiple avocado subcommands are executed.
       If the currently executed command is `run`, it would mean that a job is
       being attempted to be executed.  In fact, a job *is* already executing
       at this point, so a AVOCADO_JOB_FAIL is appropriate.  In other scenarios,
       such as when running `$ avocado multiplex`, these failures have nothing
       to do with jobs, so AVOCADO_FAIL is appropriate.
    Signed-off-by: NCleber Rosa <crosa@redhat.com>
    d20ce0bb
test_replay_basic.py 8.5 KB