Ejemplo n.º 1
0
def test_history(request, group_slug, project_slug, build_version=None, testrun=None, suite_slug=None, test_name=None):
    project = request.project
    context = {"project": project}
    if build_version and testrun and suite_slug:
        build = get_build(project, build_version)
        test_run = get_object_or_404(build.test_runs, pk=testrun)
        suite_slug = suite_slug.replace('$', '/')
        suite = get_object_or_404(project.suites, slug=suite_slug)
        status = get_object_or_404(test_run.status, suite=suite)
        full_test_name = "/".join([suite_slug, test_name])
        context.update({"build": build, "status": status, "test": test_name})
    else:
        full_test_name = test_name.replace('$', '/')
    try:
        page = int(request.GET.get('page', '1'))
    except ValueError:
        page = 1

    top = request.GET.get('top', None)
    if top:
        top = get_build(project, top)
    try:
        history = TestHistory(project, full_test_name, top=top, page=page)
        context.update({"history": history})
        return render(request, 'squad/test_history.jinja2', context)
    except Suite.DoesNotExist:
        raise Http404("No such suite for test: %s")
Ejemplo n.º 2
0
def build_metrics(request, group_slug, project_slug, build_version):
    project = request.project
    build = get_build(project, build_version)
    environments = Environment.objects.filter(project=project).order_by("name")
    metrics = Metric.objects.filter(build=build).prefetch_related(
        "metadata", "environment")

    search = request.GET.get('search', '')

    visited = set()
    umetrics = [
        visited.add(m.full_name) or m for m in metrics
        if m.full_name not in visited
    ]
    umetrics.sort(key=lambda um: um.full_name)

    rows = {}
    for m in metrics:
        if m.environment.slug not in rows:
            rows[m.environment.slug] = {}

        rows[m.environment.slug][m.full_name] = m

    context = {
        "project": project,
        "build": build,
        "environments": environments,
        "metrics": metrics,
        "umetrics": umetrics,
        "rows": rows,
        "search": search,
    }

    return render(request, 'squad/build_metrics.jinja2', context)
Ejemplo n.º 3
0
def failures(request, group_slug, project_slug, build_version):
    project = request.project
    build = get_build(project, build_version)
    environments = project.environments.order_by("slug")

    failures_ids = build.tests.filter(result=False, ).exclude(
        has_known_issues=True, ).only('id').distinct('metadata_id').order_by(
            '-metadata_id')

    failures = Test.objects.filter(id__in=failures_ids).only(
        'metadata__suite',
        'metadata__name',
        'metadata__id',
    ).order_by(
        'metadata__suite',
        'metadata__name',
    ).distinct().values_list(
        'metadata__suite',
        'metadata__name',
        'metadata__id',
        named=True,
    )

    search = request.GET.get('search', '')
    if search:
        failures = failures.filter(metadata__name__contains=search)

    try:
        page_num = request.GET.get('page', 1)
        paginator = Paginator(failures, 25)
        paginator.count = failures_ids.count()
        page = paginator.page(page_num)
    except InvalidPage as ip:
        raise Http404(('Invalid page (%(page_number)s): %(message)s') % {
            'page_number': page_num,
            'message': str(ip),
        })

    fwc = failures_with_confidence(project, build, page)
    rows = {}
    for t in fwc:
        if t.environment.slug not in rows:
            rows[t.environment.slug] = {}

        rows[t.environment.slug][t.full_name] = t

    context = {
        "project": project,
        "build": build,
        "environments": environments,
        "page": page,
        "rows": rows,
        "search": search,
    }

    return render(request, 'squad/failures.jinja2', context)
def tests(request, group_slug, project_slug, build_version):
    group = Group.objects.get(slug=group_slug)
    project = group.projects.get(slug=project_slug)
    build = get_build(project, build_version)

    try:
        page = int(request.GET.get('page', '1'))
    except ValueError:
        page = 1

    context = {
        "project": project,
        "build": build,
        "results": TestResultTable.get(build, page),
    }

    return render(request, 'squad/tests.jinja2', context)
Ejemplo n.º 5
0
def tests(request, group_slug, project_slug, build_version):
    project = request.project
    build = get_build(project, build_version)

    try:
        page = int(request.GET.get('page', '1'))
    except ValueError:
        page = 1

    search = request.GET.get('search', '')

    context = {
        "project": project,
        "build": build,
        "search": search,
        "results": TestResultTable.get(build, page, search),
    }

    return render(request, 'squad/tests.jinja2', context)
Ejemplo n.º 6
0
def tests(request, group_slug, project_slug, build_version):
    project = request.project
    build = get_build(project, build_version)

    try:
        page = int(request.GET.get('page', '1'))
    except ValueError:
        page = 1

    search = request.GET.get('search', '')

    context = {
        "project": project,
        "build": build,
        "search": search,
        "results": TestResultTable.get(build, page, search),
    }

    return render(request, 'squad/tests.jinja2', context)
Ejemplo n.º 7
0
def test_history(request, group_slug, project_slug, full_test_name):
    project = request.project

    try:
        page = int(request.GET.get('page', '1'))
    except ValueError:
        page = 1

    top = request.GET.get('top', None)
    if top:
        top = get_build(project, top)

    try:
        history = TestHistory(project, full_test_name, top=top, page=page)
        context = {
            "project": project,
            "history": history,
        }
        return render(request, 'squad/test_history.jinja2', context)
    except Suite.DoesNotExist:
        raise Http404("No such suite for test: %s")
Ejemplo n.º 8
0
def test_history(request, group_slug, project_slug, full_test_name):
    project = request.project

    try:
        page = int(request.GET.get('page', '1'))
    except ValueError:
        page = 1

    top = request.GET.get('top', None)
    if top:
        top = get_build(project, top)

    try:
        history = TestHistory(project, full_test_name, top=top, page=page)
        context = {
            "project": project,
            "history": history,
        }
        return render(request, 'squad/test_history.jinja2', context)
    except Suite.DoesNotExist:
        raise Http404("No such suite for test: %s")
Ejemplo n.º 9
0
 def get_object(self):
     return get_build(self.request.project, self.args[2])