Use audit events to improve management of node module list #2011
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2005
Description
The existing code to keep the platform's record of modules installed in an instance relied on the event triggered when Node-RED saves its node list.
That event isn't triggered when a module is upgraded - meaning the platform's record gets out of date.
The fix is to use the
nodes.install
audit event which does get triggered for the upgrade path.I've also added support for the
nodes.remove
audit event to trigger removing modules from the list.Whilst there, I've modified the test suite to only run setup once, rather than before each test. This only required updating the names of the projects the individual tests were creating to ensure uniqueness.
When running the tests locally, this reduced the runtime for the _spec file from 7s to 2s - a good step in the right direction for #2004
Related Issue(s)
Acceptance Criteria
On staging:
Checklist
flowforge.yml
?flowforge/helm
to update ConfigMap Templateflowforge/CloudProject
to update values for Staging/ProductionLabels
backport
labelarea:migration
label