The Erlang-Red Project - Update Two

Update 2 focused on two major steps in the project: upgrading Erlang to 29.1.2 and updating the compatibility-tests testing, providing an improved testing workflow going forward.

Upgrading to Erlang/OTP 29.1.2

Upgrading Erlang from version 27 to 29.1.2 was mostly smooth. Most components upgraded easily enough, including all dependencies, and most of that worked well. The compile step now generates far more warnings concerning deprecated features, but those are external warnings concerning dependencies. One issue going forward is that the cross-compiler for Elixir to Erlang somehow needs to be called twice. The compile step fails the first time around and must be run again. I haven’t investigated or debugged this yet because it seems to be something very deep inside the cross-compiling step and a workaround does exist - calling it twice. This I added to the CI pipeline and local testing.

This affects the Elixir helpers package, which I use to bind support packages coded in Elixir. For example, MDEx for Markdown support. That component was transmuted to MDX instead of Earmark for the Markdown support. The package is included an Elixir update from 1.18 to 1.20. There was an API change, but that was easily overcome.

Overall, the upgrade to 29.1.2 went very smoothly.

Initially the unit tests failed because the Elixir app, with 1.20, needs to be started before testing.

There were a couple of changes to the Git CI testing step. I was previously using versions 27, 28, and 29. I removed version 27, leaving only 28 and 29. Version 28.1 was actually causing a test to fail because it was doing something else, but an upgrade to 28.5 fixed that. All the tests that were supposed to work did work for the unit tests. The complete upgrading also included the CI and the Docker image for Fly.io, which I tested locally.

So now Erlang-Red is working with 29.1.2 as the main version. I dropped CI support for version 27 because as no one seems to be depend on Erlang-Red working with 27, I won’t maintain backward compatibility back to 27. Going forward, I intend to support the last to major versions of Erlang unless the need arises to change that decision.

Testing, Testing, one, two, three, …

Testing in Erlang-Red has two main purposes: ensuring that Erlang-Red works. Those are the Eunit tests inside the project. More importantly though, that Erlang-Red has the same functionality as Node-RED. A series of visual (conformity) unit tests have been defined and are used to ensure there is no drift in functionality between Erlang-Red and Node-RED. These tests are designed to be executed in both Erlang-Red and Node-RED but how to do that has been unclear.

Before this work, this was a combination of a unit-test node package containing a subset of curated flow tests and the centralised git repository that contained all flow tests, including the Erlang-Red breadboard example flows. This repository was a mix of tests running with Node-RED and tests running with Erlang-Red. I had to curate those tests between the two, which was much effort and going forward would be too much overhead.

I actually planned this as final step in the project plan, which was to improve the flow tests to provide better compatibility with Node-RED core node functionality. But as I will be defining new nodes in Erlang-Red for the next step of porting the FlowHubⓁ server flow code to Erlang-Red, I wanted to optimise the compatibility testing workflow so as to save myself time in the development process.

So I decided to centralise the unit tests in the Git repository. The Git repository now contains all visual flow tests used in Erlang-Red and Node-RED, with example code for Erlang-Red removed. The unit test git repository becomes a centralised source of truth for flow tests. The Node package for Node-RED includes those flows, which are then transported over to Erlang-Red via that Node package.

The code base for the unit-test node package is hosted as a flow over at FlowHub.org and visually, these changes were:

img

The disappearing largish grey block of nodes was the curated collection of flow tests for Node-RED. These nodes have been removed and replaced with a loop that retrieves all flow tests directly from the git repository containing the tests.

This creates the node package for Node-RED which I can download locally and install into the editor template. Additionally the flow also contains functionality to update the code base over at github and publish the node package to npmjs. Finally the flow also updates the listing of the node package at nodered.org.

What about Erlang-Red?

To upgrade the tests in Erlang-Red, I first upgrade the node package in the editor template Node-RED installation. I have an update workflow to update the Erlang-Red editor, which is based on Node-RED. For that I have a script that retrieves front-end code from a Node-RED template. As part of that retrieval, I now also retrieve example flows. These can then be loaded into Erlang-Red using the import dialog inside the Node-RED or Erlang-Red editor:

importing tests using import dialog

Since the retrieval and updating of front-end code has to be done anyway, the extra retrieve the of example flows fitted right in. Instead of having an extra directory inside Erlang-Red, the examples folder is now inside the node package, utilising the standardised Node-RED way of transporting example flows in Node packages. Previously this was a separate directory: priv/testflows but that has now been removed.

The disadvantage is that all tests are included: both Node-RED tests and Erlang-Red tests. So I need to indicate on the tests whether they are only for Erlang-Red, only for Node-RED, or if they work for both. I already had functionality using environment variables inside flow definitions. Erlang-Red or Node-RED provides functionality for defining flow environment variables which apply to the flow. I am using these to define whether a flow is a test for Erlang-Red or Node-RED:

env variables for flows

In addition, I can indicate whether a flow test is pending, that is, it hasn’t been completely fixed or isn’t working yet for either platform. Plus, I can define a timeout. If a test takes longer than the normal five-second timeout, such as when testing timeouts in individual nodes like the execute node, I can extend it. This ensures the test runs long enough for the timeout and the individual nodes being tested to actually fire. That is why I have these various environment variables inside the flows.

Differing outcomes

A further problem is that some tests produce outcomes that aren’t exactly the same. There are a few edge cases where error messages might differ slightly between Node-RED and Erlang-Red. I could duplicate the tests and modify them, but I find that cumbersome because it leads to significant duplication of tests that look visually identical but test slightly different outcomes in minor messages. For major differences or features that don’t really work, I would have separate tests. But for tests that basically work on both but have minor differences, I had to find a way to indicate that visually. For example, for this flow:

using groups of differing outcomes

What I have done is use groups. I can now group nodes together and say, “OK, this group is only for Node-RED” or “this group is only for Erlang-Red.” That provides me with a visual marker to say, “This test works on both, but there’s a minor difference in certain functionality,” indicated by the group working only on one platform. This approach allows me to define tests that provide the compatibility I need while indicating slight differences.

I’ve noticed that 100% compatibility between the two is probably difficult and too limiting. Certain features simply aren’t going to be the same, and that’s OK. As long as it is clear why there are differences, I think that’s fine and legitimate instead of trying for absolute perfection. There’s a Pareto principle situation here: I’m not going to spend 80% of my time for the last 20% of compatibility when I’ve already got 80% done in 20% of the time. That is a compromise I have to take at this stage.

Creating new tests

In the previous update, I integrated the FlowHubⓁ client into Erlang-Red. I use the client to update the git repository containing the tests. These changes are first made locally and I can recreated the node package and update Erlang-Red using the local git repository. Once all tests are working and I am happy, I can create the node package and publish it to a broader audience.

Flow testing is now at a point where I have a complete workflow for how to update and define tests. This flow exists because I am now using FlowHubⓁ to maintain local git repositories. It is easier to update tests locally and then push those changes to the remote repository. That is another reason I’ve changed the flow of how I maintain tests: I can now maintain the git repositories containing all tests locally from within Erlang-Red and Node-RED.

The view from inside the editor

Testing has also an explicit interface within the editor, both Node-RED and Erlang-Red. The testing interface allows for testing all tests or individual tests or new tests.

testing inside the editor

What that shows me are the tests that succeed but also those tests that are pending, that is, haven’t been implemented for the platform and also those tests that aren’t supported by the platform - either Node-RED or Erlang-Red. While those tests run, the editor is showing debug information and which tests are running. I haven’t included those details in the animated gif.

Docker Release 0.5.2

This update is encapsulated in a new docker tag 0.5.2 for easy usage at home!

Discovery Management

Something I talked about in update one of the project was my visual project planning. What I realised with this update is that I am actually managing my discoveries! Since my task definitions are so high level, once I get into the details, I start to discovery the problems. These “discoveries” are kind of todos that need doing, more or less urgently - depending on the dependencies.

My plan for this update was to update the Erlang version, but somewhere along the line, I discovered I had to update the testing to help me down the road.

version updating

Eventually I was collecting so many todos/discoveries that I split out a second project plan for updating the unit testing:

img

After that it took on a life of its own and the whole thing became update two!

Last updated: 2026-11-20T12:01:49.625Z


The author is available for Node-RED development and consultancy.