Skip to content

Conversation

lagartoverde
Copy link
Contributor

@lagartoverde lagartoverde commented Apr 11, 2025

Description

This PR removes the server start from importing from mu and moves it, so it only runs when the microservice is started

Motivation

Until now whenever you imported from the mu library you started a server, which was fine for simpler microservices, where everything is imported on app.js, but as the microservices get more complex we need to do some imports without the server starting, for example in order to do unit tests of functions using the sparql helpers.
Also imho it's conceptually wrong that a import has a side effect.

Testing

Check that everything works as before, and the PR doesn't break a microservice in anyway. Now you should be able to import from mu without starting any server

@madnificent
Copy link
Member

Discussed this with @lagartoverde over chat. We want to structurally support unit tests in the future but will first take the route of the integration tests which is also ongoing. In the meantime this PR allows to do some hacks in the server which don't boot up the server directly.

The server booting up when mu' gets imported is not intentional behaviour and I don't think anything depends on it, nor should it. Splitting up launching the server from importing mu' should not break anything.

It makes sense to land this in the same release as the rewired setup because any potential bugs or resulting behavioural changes may as well get detected and tackled by consumers in one go.

@lagartoverde lagartoverde changed the title POC: moved the start of the server to only run when the microservice runs Move the start of the server to only run when the microservice runs Apr 17, 2025
madnificent and others added 4 commits May 2, 2025 12:59
lagartoverde and others added 3 commits July 18, 2025 08:56
We don't need a separate image for running the scripts.  The latest mu-cli will
run the scripts in the current image which is good enough for this purpose.
@madnificent madnificent merged commit 79d0faa into mu-semtech:master Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants