1
0
Fork
You've already forked n-version-programming
0
PoC for testing the approach of n-version programming
  • Python 43.5%
  • Rust 41.8%
  • Shell 10.3%
  • Dockerfile 4.4%
2025年01月13日 14:01:01 +01:00
n-versions Adapting python api for current test setup 2025年01月09日 07:31:01 +01:00
orchestrator Improve documentation and example usage of the PoC 2025年01月13日 13:53:53 +01:00
Postman Improve documentation and example usage of the PoC 2025年01月13日 13:53:53 +01:00
.gitignore Improve documentation and example usage of the PoC 2025年01月13日 13:53:53 +01:00
docker-compose.yml Remove ports used for testing 2025年01月13日 14:01:01 +01:00
generateApis.sh Adding generated python api for testing specific types 2025年01月09日 07:13:05 +01:00
LICENSE Initial commit 2024年08月10日 13:55:23 +00:00
openApi_spec.yml Adding generated python api for testing specific types 2025年01月09日 07:13:05 +01:00
README.md Improve documentation and example usage of the PoC 2025年01月13日 13:53:53 +01:00

n-version-programming

PoC for testing the approach of n-version programming.

Usage

  1. Build and start the docker images using docker compose up -d in the base directory.
  2. Optional: Follow the orchestrator's logs using docker logs -f orchestrator.
  3. Send a request to the orchestrator and check the results. Use e.g. curl or Postman:
    1. Use the address localhost:3000 or change the mapping in the compose file.
    2. Currently, the implementation of the n-versions only support GET requests using the paths /bool and /int.
    3. /bool returns a random boolean, /int a random integer between 0 and 9. The orchestrator compares the results of the n-versions and returns it in case of a match. This means the chance of a result is better when using /bool.

Components

This prototype is composed of the following components:

  1. Versions. The individual versions are implemented in different programming languages to follow the idea of n-version programming. They can be found in their individual directories in here.
  2. Orchestrator. The orchestrator serves as entrypoint for requests from clients. Incoming requests are distributed over all available instances and their responses are consolidated and compared before sending a reply to the client. While proxys like nginx can mirror requests and therefore implement the first step, the responses are ignored. Therefore this feature is not helpful. Similar story with Traefik. While requests can be mirrored, only a defined primary instance can respond back to the clients as is elaborated here. To implement the workflow myself, Rocket was chosen as a framework for its simplicity and type safety. The resulting code and its documentation can be found here.
  3. (Client. tbd, use Postman or curl for the moment)

OpenAPI

N-version programming requires the versions to be based on the same specification. This way, any mismatch in the behavior of the versions needs to be rooted in its implementations or technologies used. To archive this, one central OpenAPI specification is used to generate the versions API routes.

References

Open ToDos

  • Add additional n-versions leveraging different programming languages and frameworks. At the moment, only Python is used for the PoC.
  • Use the orchestrator for some third-party API. Adapt the comparision algorithm to deal with all the missing data structures (like JSON).
  • Write software tests.