[PATCH 04/10] models: Add 'status' model

Damien Lespiau damien.lespiau at intel.com
Thu Sep 24 02:54:22 AEST 2015


On Wed, Jul 29, 2015 at 09:58:42AM +0100, Stephen Finucane wrote:
> +class Status(models.Model):
> +    """Status for a patch.
> +
> +    Statuses define a state for patches. This is useful, for example,
> +    when using a continuous integration (CI) system to test patches.
> +    """
> +    STATE_PENDING = 0
> +    STATE_SUCCESS = 1
> +    STATE_WARNING = 2
> +    STATE_FAIL = 3
> +    STATE_CHOICES = (
> +        (STATE_PENDING, 'pending'),
> +        (STATE_SUCCESS, 'success'),
> +        (STATE_WARNING, 'warning'),
> +        (STATE_FAIL, 'fail'),
> +    )
> +
> +    patch = models.ForeignKey(Patch)
> +    user = models.ForeignKey(User)
> +    date = models.DateTimeField(default=datetime.datetime.now)
> +
> +    state = models.SmallIntegerField(
> +        choices=STATE_CHOICES, default=STATE_PENDING,
> +        help_text='The state of the status.')
> +    target_url = models.URLField(
> +        blank=True, null=True,
> +        help_text='The target URL to associate with this status. This should'
> +        ' be specific to the patch.')
> +    description = models.TextField(
> +        blank=True, null=True, help_text='A brief description of the status.')
> +    context = models.CharField(
> +        max_length=255, default='default', blank=True, null=True,
> +        help_text='A label to discern status from statuses of other systems.')

What I was thinking:

  - For each project, we have a list of Tests defined (because different
    patchwork projects will have different tests). That also allows us
    to know when all the tests have run for that specific project, a
    useful property to send back emails with all the test results to the
    ml for instance,
  - For each (Test, Patch) there's a TestResult (which would roughly
    correspond to your Status, but some of the fields there seem to
    belong to a Test object,
  - I'd love if tests could also be at the Series level, because it may
    be impractical for some tests to be every patch (that's certainly
    the case for the i915 driver).

class Test(...):
    name
    description
    project_id
    ...

class PatchTestResult(...)
    test_id
    patch_id
    result (the list of 'state choices' you had)
    result_url
    ...
    
Later on we could have:

class SeriesTestResult(...)
    test_id
    series_id
    result (the list of 'state choices' you had)
    result_url
    ...
    
Thoughts?

-- 
Damien


More information about the Patchwork mailing list