Using Emacs Org Mode for Reproducibility Testing

Software reproducibility testing is a critical aspect of software development and maintenance. It ensures that software is reliable, consistent, and predictable and that it can be easily replicated and verified by others.

Ana Pustan, Reproducibility Testing: A Complete Guide

For many of us, it won’t be a surprise that the Emacs Org mode is perfectly suited for reproducibility testing.

In some of my projects I’m using gRPC, a modern open source high performance Remote Procedure Call (RPC) framework that can run in any environment. The gRPC framework is evolving very rapidly so I have to update it to the most recent stable version time to time. No doubt, I want to make sure that everything is working properly after the update.

I’ve built a tiny hello-world gRPC server for testing the update. I use grpcurl, a command-line tool that interacts with gRPC servers, as a client.

Now Emacs has to go be onstage.

The Server

I don’t like having to leave Emacs for too long so I run my server in Eshell.

Click or tap to view the full-size picture.

The Client

The Org mode code blocks – that’s all we need now.

Listing of available services at localhost port 50051

#+begin_src bash :results verbatim
  grpcurl -plaintext localhost:50051 list
#+end_src

#+RESULTS:
: grpc.reflection.v1.ServerReflection
: grpc.reflection.v1alpha.ServerReflection
: helloworld.Greeter

Pressing C-c C-c when the point (cursor) is inside the code block shows 3 services available at localhost:50051 – 2 builtin services and our helloworld.Greeter service, the last one.

Inspecting helloworld.Greeter service

#+begin_src shell :results verbatim
  grpcurl -plaintext localhost:50051 describe helloworld.Greeter
#+end_src

#+RESULTS:
: helloworld.Greeter is a service:
: service Greeter {
:   rpc SayHello ( .helloworld.HelloRequest ) returns ( .helloworld.HelloReply );
: }

OK, everything seems to be in order.

Inspecting helloworld.Greeter.SayHello method

#+begin_src bash :results verbatim
  grpcurl -plaintext localhost:50051 describe helloworld.Greeter.SayHello
#+end_src

#+RESULTS:
: helloworld.Greeter.SayHello is a method:
: rpc SayHello ( .helloworld.HelloRequest ) returns ( .helloworld.HelloReply );

Querying the server

Finally, let’s query the server.

#+begin_src bash :results verbatim
  grpcurl -plaintext -d '{"name": "world"}' localhost:50051 helloworld.Greeter.SayHello
#+end_src

#+RESULTS:
: {
:   "message": "Hello world!"
: }

That is the expected outcome – the server replied accordingly.

Click or tap to view the full-size picture.

Now I can perform gRPC reproducibility testing every time after the update.

Happy emacsing!

– The Emacs Cat.