Description
MFEs allow for simple, light-weight development environments with one glaring exception - the need to launch devstack or Tutor to interact with back end services, especially the LMS for authentication. This drags multiple Python services, databases, a search engine, etc. into the required development environment. We're making progress on supporting cloud-hosted dev environments that avoid the need to install all this on a laptop, but even better would be not to need them at all.
We'd like to start by replacing the LMS with a stub server that returns canned responses to the most common requests made to it by MFEs. Rather than building out a service from scratch which would leave us holding the bulk of the development and maintenance burden, we should use an existing stub server. The leading candidate is https://github.com/pact-foundation/pact-stub-server from the Pact contract testing framework, for the following reasons:
- We have already started using Pact, and believe broader usage could help reduce the number of production incidents involving broken communications between services.
- It is implemented in Rust for performance, and is distributed as a single binary.
- The associated Pact specification already has robust support for many kinds of stubbing needs, including the ability to change the state of the mocked service and alter the responses accordingly.
- It is an actively maintained component of a larger project with commercial backing, which is unlikely to be suddenly abandoned without a solid migration plan.
Here is more information about Pact in the context of Open edX.
The anticipated parts of this project are roughly:
### Tasks
- [ ] Identify the communications with the LMS that need to be stubbed out
- [ ] Figure out the best way to define the mock responses for these requests. This may be writing the Pact file by hand, or it may be creating some Pact tests between the services which will generate this file accordingly.
- [ ] Generate the necessary Pact file.
- [ ] Document and/or automate a simple process for using the stub server with an MFE instead of needing an actual LMS instance.
- [ ] Write a plan for covering the stubbed communications with Pact tests (if they were already written in order to create the Pact file, this may only cover the steps to get them running in CI).
- [ ] Document the process of similarly stubbing out new endpoints or additional back end services.
- [ ] Identify and prioritize similar work that could be done to eliminate the need for other back end services during development of particular MFEs.
An unmerged hackathon project from a few months ago attempted a different approach to creating a mock authentication service, that code may be useful at least for identifying some of the request/response sequences that need to be stubbed out. It also has the beginnings of Pact testing for it.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status