Page MenuHomePhabricator

Allow EvaluatorStub Also to Mock Websocket Calls
Open, Needs TriagePublic

Description

Description

The EvaluatorStub (lib/mockUtils.js) is unable to inspect the contents of native code. The only action it can take is to return a pre-computed value on the basis of the input object's identity (Z8K5). The major difficulty here is that the native code itself make decisions about whether to use the reentrance functionality. We can't feasibly inspect the native code to make those decisions in the orchestrator.

Now that workflows within an evaluator can be much more complex, the EvaluatorStub needs to become more sophisticated. We can use mock-socket to mock out websocket messages.

To emulate native code calls, we can provide callbacks to the EvaluatorStub. The callbacks will be arbitrary JS code that accepts ZObjects, makes one or more calls to the websocket mock, uses the results, and then returns a ZObject; basically, they will be a facsimile of native code inside of the orchestrator tests' JS process.

Desired behavior/Acceptance criteria (returned value, expected error, performance expectations, etc.)

  • Ideally, we'd be able to specify a sequence of events in tests, e.g.
    • orchestrator sends native code to evaluator
    • evaluator responds with call { Z1K1: "Z801", Z801K1: "something" }
    • orchestrator runs that function and sends output ("something") back to evaluator
      • here is where it's important to make assertions ...
        • that the orchestrator runs the requested function
        • that the output of that function is indeed sent back to the evaluator
    • evaluator processes "something" and returns output back to orchestrator
  • We can remove istanbul ignore pragmas in src/Evaluator.js

Remove all the non-applicable tags from the "Tags" field, leave only the tags of the projects/repositories related to this task


Completion checklist