Skip to content

Do not create base device config#150

Merged
eriknordmark merged 2 commits intolf-edge:masterfrom
milan-zededa:remove-base-config
May 3, 2026
Merged

Do not create base device config#150
eriknordmark merged 2 commits intolf-edge:masterfrom
milan-zededa:remove-base-config

Conversation

@milan-zededa
Copy link
Copy Markdown
Contributor

@milan-zededa milan-zededa commented Apr 28, 2026

Previously, Adam automatically created a minimal "base" config for every newly registered device. This caused two problems:

  1. It made it impossible to test the scenario where the controller has no config for a device yet, which is a legitimate scenario that test frameworks need to exercise.

  2. Devices can be provisioned with a bootstrap config baked in, which is necessary when the default network setup (DHCP on all Ethernet interfaces) does not provide controller connectivity -- for example when the network uses static IP addresses, VLANs, or a HTTP proxy for management traffic. If the test framework was too slow to submit the initial config, the device would fetch the auto-generated base config first, effectively overwriting the bootstrap config (and breaking connectivity for a while, until network config fallback kicks in). This forced the test framework to race against the first device config poll, an inherently fragile arrangement.

With this change, GetConfig returns NotFoundError when no config has been submitted yet. The API handlers propagate this as an HTTP 404, allowing the device to retry. GetDeviceOptions and GetGlobalOptions likewise return NotFoundError instead of auto-creating defaults; their callers treat not-found as "use zero-value defaults".

I have also enhanced the CI workflow to include running a Redis container. Previously, all Redis tests were silently skipped because no Redis instance was available.

@milan-zededa milan-zededa force-pushed the remove-base-config branch 2 times, most recently from 5cc9479 to fc8c06b Compare April 28, 2026 08:45
Previously, Adam automatically created a minimal "base" config for
every newly registered device. This caused two problems:

1. It made it impossible to test the scenario where the controller
   has no config for a device yet, which is a legitimate scenario
   that test frameworks need to exercise.

2. Devices can be provisioned with a bootstrap config baked in, which
   is necessary when the default network setup (DHCP on all Ethernet
   interfaces) does not provide controller connectivity -- for example
   when the network uses static IP addresses, VLANs, or a HTTP proxy
   for management traffic. If the test framework was too slow to submit
   the initial config, the device would fetch the auto-generated base
   config first, effectively overwriting the bootstrap config (and
   breaking connectivity for a while, until network config fallback
   kicks in). This forced the test framework to race against the first
   device config poll, an inherently fragile arrangement.

With this change, GetConfig returns NotFoundError when no config has
been submitted yet. The API handlers propagate this as an HTTP 404,
allowing the device to retry. GetDeviceOptions and GetGlobalOptions
likewise return NotFoundError instead of auto-creating defaults; their
callers treat not-found as "use zero-value defaults".

Signed-off-by: Milan Lenco <milan@zededa.com>
Redis tests were silently skipped because no Redis instance was
available. Add a Redis 7 service container with a health check so
the full Redis driver test suite runs on every PR.

Signed-off-by: Milan Lenco <milan@zededa.com>
Copy link
Copy Markdown
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eriknordmark eriknordmark merged commit a513d60 into lf-edge:master May 3, 2026
2 checks passed
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.

2 participants