Пример #1
0
 def put(self, project_id: int):
     args = self._parser_put.parse_args(strict=False)
     project = Project.get_or_404(project_id)
     test_data = get_test_details(build_id=args["build_id"],
                                  test_name=args["test_name"],
                                  lg_type=args["lg_type"])
     report = APIReport.query.filter(
         and_(APIReport.project_id == project.id,
              APIReport.build_id == args["build_id"])).first()
     report.end_time = test_data["end_time"]
     report.start_time = test_data["start_time"]
     report.failures = test_data["failures"]
     report.total = test_data["total"]
     report.thresholds_missed = args.get("missed", 0)
     report.throughput = test_data["throughput"]
     report.pct95 = test_data["pct95"]
     report.onexx = test_data["1xx"]
     report.twoxx = test_data["2xx"]
     report.threexx = test_data["3xx"]
     report.fourxx = test_data["4xx"]
     report.fivexx = test_data["5xx"]
     report.requests = ";".join(test_data["requests"])
     report.status = args["status"]
     report.vusers = args["vusers"]
     report.duration = args["duration"]
     report.commit()
     return {"message": "updated"}
Пример #2
0
def view_report(project: Project):
    if request.args.get("report_id", None):
        test_data = APIReport.query.filter_by(id=request.args.get("report_id")).first().to_json()
    else:
        test_data = get_test_details(build_id=request.args["build_id"],
                                     test_name=request.args["test_name"],
                                     lg_type=request.args["lg_type"])
    analytics_control = render_analytics_control(test_data["requests"])
    samplers = get_sampler_types(test_data["build_id"], test_data["name"], test_data["lg_type"])
    return render_template("perftemplate/api_test_report.html", test_data=test_data,
                           analytics_control=analytics_control, samplers=samplers)
Пример #3
0
def view_report():
    if request.method == 'GET':
        if request.args.get("report_id", None):
            test_data = APIReport.query.filter_by(
                id=request.args.get("report_id")).first().to_json()
        else:
            test_data = get_test_details(build_id=request.args['build_id'],
                                         test_name=request.args['test_name'],
                                         lg_type=request.args['lg_type'])
        analytics_control = render_analytics_control(test_data['requests'])
        samplers = get_sampler_types(test_data['build_id'], test_data['name'],
                                     test_data['lg_type'])
        return render_template('perftemplate/api_test_report.html',
                               test_data=test_data,
                               analytics_control=analytics_control,
                               samplers=samplers)
Пример #4
0
 def put(self):
     args = self.put_parser.parse_args(strict=False)
     test_data = get_test_details(build_id=args['build_id'],
                                  test_name=args['test_name'],
                                  lg_type=args['lg_type'])
     report = APIReport.query.filter_by(build_id=args['build_id']).first()
     report.end_time = test_data["end_time"]
     report.start_time = test_data["start_time"]
     report.failures = test_data["failures"]
     report.total = test_data["total"]
     report.thresholds_missed = args.get("missed", 0)
     report.throughput = test_data["throughput"]
     report.pct95 = test_data["pct95"]
     report.onexx = test_data["1xx"]
     report.twoxx = test_data["2xx"]
     report.threexx = test_data["3xx"]
     report.fourxx = test_data["4xx"]
     report.fivexx = test_data["5xx"]
     report.requests = ";".join(test_data["requests"])
     report.commit()
     return {"message": "updated"}