PATH: QueryRun

Introduction

A REST-S-REQUEST to the RestTestLuaService with a path ending in /QueryRun queries the status of a previously started Rest Tester Service run.

The REST-S-RESPONSE response in the case of failure is a 500 status code with a text/plain error message body.

Query Run

The attributes of the query are supplied as follows:

Field Type Description
query_args Table The query args from the `?` component of the URI are extracted into a table.
If a query arg is repeated, the final value is used.
The complete list of query args is passed to each Lua script instance.
In addition, the following query args have a special interpretation.
"run_id" String This must refer to a test run previously started which has not yet reported completion.

The REST response in the case of success is a 200 status code with application/json content type.

The JSON object represented in the content body is:

Attribute Type Description
run_id String The unique run identifier assigned to this run.
completed Integer 0 (completed) or 1 (in progress).
vars Object Container for reporting Run Variables.
The values for these run variables will be either a Scalar or a sub-Object.
time_now Array The "now" system time on the N2SVCD clock.
[0] Integer The "now" epoch seconds.
[1] Integer The "now" epoch microseconds.
time_start Array Test run start time on the N2SVCD clock.
[0] Integer The "time_start" epoch seconds.
[1] Integer The "time_start" epoch microseconds.
time_finish Array Test run start finish on the N2SVCD clock (if the run is completed).
[0] Integer The "time_finish" epoch seconds.
[1] Integer The "time_finish" epoch microseconds.
duration Float Test run duration in seconds (if the run is completed).
counts Object Object with test instance counts.
.started Integer Number of instances started.
.finished Integer Number of instances finished (passed, failed, and aborted).
.failed Integer Number of instances completed with a failed non-mandatory check.
.aborted Integer Number of instances aborted by a failed mandatory check.
.cancelled Integer Number of instances cancelled by user-requested run cancel.
first_fails Array Array of "first fail" reasons. See description below.
first_aborts Array Array of "first abort" reasons. See description below.
buckets Array Time-based call distribution buckets. See description below.
first_call_summary Object Information about the first Test Instance in the Run.

Note: The first_call_summary is strictly speaking a summary of the first Test Instance, which may in practice implement none, one or more Telephony Calls.

Response - “first_fails/aborts”

During a load test (i.e. when more than one Test Instance is executed in a Test Run) detailed information is only available about the first Test Instance in the Run. The first_fails and first_aborts response attributes provide some limited information about fail and abort reasons in subsequent Test Instances.

The first_fails attribute is an Array which tracks the first failed check which occurs during each Test Instance. The number of Test Instances which fail with the same unique text message and operation is counted and reported.

Each Object in the first_fails and first_aborts attribute has the following attributes:

Attribute Type Description
op_idx Integer The index in the operations at which this fail/abort occured.
text String The text fail/abort message generated by this failed/aborted check.
count Integer The number of Test Instances whose first fail/abort occured as described.

E.g. the following entry indicates that 300 Test Instances all encountered their first failed check at operation[4] and with the text “‘initialCallSegment_cause’ should = 30, but = 31.”

    "first_fails" : [
        {
      "count" : 300,
      "op_idx" : 4,
      "text" : "'initialCallSegment_cause' should = 30, but = 31."
        }
    ]

Response - “buckets”

The buckets attribute is used to indicate the distribution of calls over time. Although it is always returned, the information is only statistically relevant in a sustained load test scenario (e.g. at least 100 Test Instances).

Between 1 and 20 buckets will be provided. Each bucket has the following attributes:

Attribute Type Description
num_calls_started Integer Number of Test Instances started during this time period.
num_calls_finished Integer Number of Test Instances finished during this time period.
time_start Array N2SVCD timestamp for start of interval covered by this bucket.
[0] Integer The "time_start" epoch seconds.
[1] Integer The "time_start" epoch microseconds.

The time_start attribute is not present for the first bucket, as the the “time_start” of the Test Run should be used instead. There is no “time_finish” attribute on the bucket, as the “time_start” of the next bucket should be used, or the “time_finish” of the Test Run.

The following example shows an example with two buckets.

    "buckets" : [
      {
        "num_calls_started" : 15,
        "num_calls_finished" : 14
      },
      {
        "time_start" : [ 1389748329, 67575 ],
        "num_calls_started" : 15,
        "num_calls_finished" : 15
      },
      {
        "time_start" : [ 1389748356, 87250 ],
        "num_calls_started" : 15,
        "num_calls_finished" : 15
      }
    ]
    ...

Response - “first_call_summary”

The first_call_summary attribute gives information about the processing of the first Test Instance executed in the Test Run. It contains the following attributes:

Attribute Type Description
idx Integer The Instance ID within the Test Run. Always = 0.
completed Integer 0 (completed) or 1 (in progress).
time_start Array N2SVCD timestamp at which this Test Instance started.
[0] Integer The "time_start" epoch seconds.
[1] Integer The "time_start" epoch microseconds.
time_finish Array N2SVCD timestamp at which this Test Instance finished (if completed).
[0] Integer The "time_start" epoch seconds.
[1] Integer The "time_start" epoch microseconds.
duration Float Test Instance duration in seconds (if completed).
trace_log Array List of tracing/match events logged against this Test Instance.
See Application - Trace Log Structure.

Each trace_log entry has structure dependent on the type of event being logged. Refer to Tester Internals - Trace Log Structure for the detailed description of the check_log event format.

Example Successful Response

Here is an example QueryRun JSON response body.

For brevity, elements have been removed from then centre of the trace_log Object Array.

{
   "result" : {
      "run_id" : "tr_168242_3343_1",
      "time_now" : [
         1650493344,
         261660
      ],
      "vars" : null,
      "buckets" : [
         {
            "num_calls_finished" : 1,
            "num_calls_started" : 1
         }
      ],
      "counts" : {
         "finished" : 1,
         "failed" : 0,
         "aborted" : 0,
         "cancelled" : 0,
         "started" : 1
      },
      "first_fails" : [],
      "first_aborts" : [],
      "time_start" : [
         1650493343,
         957551
      ],
      "completed" : 1,
      "first_call_summary" : {
         "time_finish" : null,
         "current_action" : "<success>",
         "completed" : 1,
         "idx" : "33d42d96",
         "time_start" : [
            1650493343,
            957795
         ],
         "trace_log" : [
            {
               "time" : [
                  1650493343,
                  958012
               ],
               "action_idx" : 0,
               "msg" : "First Call in Run.  Debug Tracing REQUESTED (level 1).",
               "path" : "trace.debug",
               "package" : "RestServerApp::RestTestLuaRun",
               "current_action" : "<setup>"
            },
            {
               "current_action" : "<setup>",
               "path" : "trace.debug",
               "package" : "N2::Application::LuaApp::LuaService::LuaLoader",
               "msg" : "Instance already has a script_key defined.  Proceed to phase 2 of loading.",
               "action_idx" : 0,
               "time" : [
                  1650493343,
                  958093
               ]
            },
            {
               "time" : [
                  1650493343,
                  958159
               ],
               "action_idx" : 0,
               "msg" : "Loading instance for script key 'tr_168242_3343_1' (loader-hint mtime = <undef>).",
               "package" : "N2::Application::LuaApp::LuaService::LuaLoader",
               "path" : "trace.debug",
               "current_action" : "<setup>"
            },
            {
               "current_action" : "<setup>",
               "path" : "trace.debug",
               "package" : "N2::Application::LuaApp::LuaService::LuaLoader",
               "msg" : "No cached chunk.  Load chunk.",
               "time" : [
                  1650493343,
                  958206
               ],
               "action_idx" : 0
            },
            {
               "current_action" : "<setup>",
               "path" : "trace.debug",
               "package" : "N2::Application::LuaApp::LuaService::LuaLoader",
               "msg" : "No cached chunk (or too stale).  Force reload.",
               "action_idx" : 0,
               "time" : [
                  1650493343,
                  958239
               ]
            },
            // ... trace_log elements removed ...
            {
               "path" : "match.pass",
               "current_action" : "match_op",
               "description" : "Check if integer 'destinationRoutingAddress_noa' is present and has expected value.",
               "time" : [
                  1650493344,
                  87108
               ],
               "action_idx" : 15,
               "text" : "Integer 'destinationRoutingAddress_noa' is present and has expected value 3."
            },
            {
               "text" : "This is a static pass string.",
               "action_idx" : 16,
               "time" : [
                  1650493344,
                  87630
               ],
               "current_action" : "+match_pass",
               "description" : "Explicit test [assert] operation.",
               "path" : "match.pass"
            },
            {
               "description" : "Explicit test [assert] operation.",
               "current_action" : "+match_pass",
               "path" : "match.pass",
               "text" : "Correctly received DRA digits 049340221.",
               "time" : [
                  1650493344,
                  87714
               ],
               "action_idx" : 17
            }
         ],
         "action_idx" : 21
      },
      "time_finish" : [
         1650493344,
         90502
      ],
      "duration" : 0.132951
   },
   "success" : 1
}