Skip to content

test: rework nginx partial download fixture, move nginx config snippets to dedicated files#188

Merged
ejoerns merged 3 commits into
rauc:masterfrom
Bastian-Krause:bst/rework-partial-downloads
Jul 10, 2025
Merged

test: rework nginx partial download fixture, move nginx config snippets to dedicated files#188
ejoerns merged 3 commits into
rauc:masterfrom
Bastian-Krause:bst/rework-partial-downloads

Conversation

@Bastian-Krause

@Bastian-Krause Bastian-Krause commented Mar 12, 2025

Copy link
Copy Markdown
Member

Until now, the partial download tests did not work reliably and relied on implicit nginx behavior: limit_rate_after 200k; combined with limit_rate 70k; lead to nginx sending "206 Partial Content" responses. As far as I remember, this was found by trial and error.

Let's use a more stable solution: lua scripting allows us to control reliable and fine grained what hawkBit artifacts nginx serves. So add a config snippet that makes nginx only serve the first half of the RAUC bundle, then close the connection prematurely and serve the second half via range request only. This is basically what the previous solution tried to achieve in a more reliable fashion.

This means we need to add the lua module and its dependencies to the test dependencies.

The nginx config is getting rather complex with this. We should not maintain lua scripting inside nginx configs inside python f-strings. So let's move the config to a dedicated file and use Python's template mechanism instead of f-strings and .format().

Fixes #180

The nginx config is getting rather complex. Future commits will even
extend the existing nginx configs with lua scripting. We should not
maintain lua scripting inside nginx configs inside python f-strings.
So let's move the config to a dedicated file and use Python's template
mechanism instead of f-strings and .format().

Signed-off-by: Bastian Krause <bst@pengutronix.de>
Until now, the partial download tests did not work reliably and relied
on implicit nginx behavior: `limit_rate_after 200k;` combined with
`limit_rate 70k;` lead to nginx sending "206 Partial Content" responses.
As far as I remember, this was found by trial and error.

Let's use a more stable solution: lua scripting allows us to control
reliable and fine grained what hawkBit artifacts nginx serves. So add a
config snippet that makes nginx only serve the first half of the RAUC
bundle, then close the connection prematrely and serve the second half
via range request only. This is basically what the previous solution
tried to achieve in a more reliable fashion.

This means we need to add the lua module and its dependencies to the test
dependencies.

Signed-off-by: Bastian Krause <bst@pengutronix.de>
The nginx_proxy fixture does not do rate limiting on its own. This was
mixed up with the rate_limited_port fixture. So drop that part of the doc
string.

Signed-off-by: Bastian Krause <bst@pengutronix.de>
@Bastian-Krause
Bastian-Krause force-pushed the bst/rework-partial-downloads branch from 33e87fd to 7488f19 Compare July 8, 2025 12:23
@Bastian-Krause
Bastian-Krause marked this pull request as ready for review July 8, 2025 12:23
@Bastian-Krause
Bastian-Krause requested a review from ejoerns July 8, 2025 12:28
@Bastian-Krause Bastian-Krause removed their assignment Jul 8, 2025
@ejoerns
ejoerns merged commit 3ec7da0 into rauc:master Jul 10, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Partial download test cases fail

2 participants