Jonas Helming, Maximilian Koegel and Philip Langer co-lead EclipseSource. They work as consultants and software engineers for building web-based and desktop-based tools. …
Using Theia Cloud to end-to-end test Theia-based applications
September 20, 2023 | 5 min ReadDo you develop a Theia-based application and you want an easy way to end-to-end test new versions of it. Do you want to dynamically deploy new versions of your Theia application, ideally on every new pull request? In this article, we demonstrate how to set up Theia Cloud so that your Theia-based application is fully deployed on a real cluster on every pull request. You can even click a link and test the latest state of the PR live as part of the review process.
Theia Cloud is a solution to host Theia-based applications. It allows you to easily orchestrate a Kubernetes cluster, which hosts multiple sessions of Theia backends for the users of your tool or IDE. While Theia Cloud is primarily targeted at the deployment phase, it can also help during development. When developing new versions of your Theia-based tool, developers can test changes by just launching the tool locally. However, you might also deploy and run a new build of your Theia application in a cloud-based cluster to achieve the following goals:
Realistic deployment environment: By deploying a new version to the same environment used for the production deployment of your tool, you can verify changes whether they work on this environment as expected or whether they have unwanted effect on the performance.
Run end-to-end tests: When you deploy a new build of the application in its actual production deployment target, you can easily run end-to-end tests on this deployment. Again, the results validate the new version in a realistic environment.
Live review and user test: After a new version is deployed, we can provide access to it. This means testers or reviewers can start the new version of the tool by accessing its cloud deployment, e.g. just by clicking a link on a pull request. First of all, this is very convenient, as you do not deploy the code under review yourself. Further, it will again validate the new version of the system against a realistic deployment.
So let’s set-up an automatic deployment of pull requests using Theia Cloud. The animated diagram below shows a conceptual overview. First, a new PR is created, which triggers a build job. This build job will compile the new version of the application and upload a new docker image to Docker Hub. Once this is done, the build job will create a new “App Definition” on the Theia Cloud cluster, which points to the new docker image. App definitions define actual applications, i.e. Theia-based tools that can be started.
Finally, the build job requests Theia Cloud to create a new App definition, i.e. it adds the new version of the tool. Theia Cloud will return a URL to start a new session in a browser for the updated app. For convenience, the build job publishes this URL on the original pull request, so that reviewers can directly access the running tool.
Optionally, the build job can also run some end-to-end tests on the new app definition. When doing so, it also makes sense to test and record some key performance metrics. This continuously ensures, that new versions of the tool under development scale in the target deployment environment
So let’s look at this in real life! The following video shows the full workflow. As an example tool under development, we use Theia Blueprint and the demo Theia Cloud deployment that is also used to enable users to try Theia online on the Theia website.
First, a pull request is created on GitHub. The build job immediately adds a comment indicating that the cloud deployment of the pull request is being prepared. This will obviously take a bit of time, in the example a few minutes. Once the new version is deployed, the comment on the pull request will be updated with the link to the running instance. The example deployment has a landing page allowing the user to start a new instance of Theia Blueprint. However, it really depends on the tool under development what is shown after clicking the link on the pull request. Finally, the user can start an instance of Theia and access the tool. This now reflects the new version, i.e. including any changes that were submitted via the original pull request. It is therefore a very convenient way to validate these changes in the real target deployment environment.
In this article, we have shown how Theia Cloud can be used during development to deploy new versions of a tool under development on every new PR. Such a set-up will make pull request reviews more efficient and more convenient. Furthermore, it allows to test changes early on the actual target deployment environment. You can therefore identify issues early that otherwise would only be found much later in the development cycle.
Further, If you are interested in building or hosting a web-based or migrating an existing one to the web/cloud, EclipseSource has a strong focus on web-based tools and IDEs, baked on VS Code or Eclipse Theia, as well as hosting them (e.g. with Theia Cloud) We can assist you in the conception phase, and also the design and the development of your toolchain. Please have a look at our service offering for tools and web-based tools.