-
Notifications
You must be signed in to change notification settings - Fork 218
remote/client: make acquire/release operate on all RemotePlaces in env #1748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
remote/client: make acquire/release operate on all RemotePlaces in env #1748
Conversation
This allows tests to create multiple places on demand. The places are released and deleted afterwards. Signed-off-by: Bastian Krause <[email protected]>
A future commit will introduce ClientSession code that needs to handle multiple Error exceptions, aggregated into a dedicated group. Python 3.11 introduced support for exception groups [1]. This allows raising multiple exceptions (not caused by one another) while keeping their individual tracebacks etc. intact (i.e. `labgrid-client -d` will still show all individual tracebacks). Since labgrid will drop Python 3.10 support in October 2026 earliest, use the backported version of exception groups until then. While at it, add a Error.__str__() method, so Error and ErrorGroup can use the same print to stderr statement in the except clause. [1] https://docs.python.org/3/library/exceptions.html#exception-groups Signed-off-by: Bastian Krause <[email protected]>
If an environment config with multiple RemotePlaces is given via `-c`/`--config`, only the first RemotePlace is used on acquire/lock and release/unlock. Having multiple RemotePlaces is meant for multi place testing, so all RemotePlaces need to be acquired/released. This is implemented in a best effort way: If an error occurs, the remaining places are still tried to be acquired/released. A combined error message is shown if the operation failed on multiple places. When called with `-d`, tracebacks of all errors are shown. If any of the operations failed, the process exits with 1. CI pipelines should use this pattern: ```shell export LG_ENV=env.yaml labgrid-client unlock || true labgrid-client lock ``` Signed-off-by: Bastian Krause <[email protected]>
When acquiring multiple places at once via an environment config, the user needs to know which places were affected by the error. Signed-off-by: Bastian Krause <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1748 +/- ##
========================================
- Coverage 45.4% 45.3% -0.1%
========================================
Files 172 172
Lines 13503 13541 +38
========================================
+ Hits 6131 6137 +6
- Misses 7372 7404 +32
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Cool! Great work, Basti!
You could make a case for failing early if you fail to acquire just 1 place. If an env file has multiple places, it is likely that all of them are needed for what you're trying to test. I'm not quite sure how other labgrid users would want this to be implemented. If there are any strong voices from within pengutronix or other users, I'd await their review. |
Thanks!
I'd like
Yes, input welcome! Since the whole multi place acquire/release is not atomic in any way, we should not over-engineer this, though. |
It's nice, but make sure to limit the acquire/release to the place given by |
One test environment file should only contain the places you want to use to use in combination for testing the combined system. |
I missed this. |
Description
If an environment config with multiple
RemotePlace
s is given tolabgrid-client
via-c
/--config
, only the firstRemotePlace
is used onacquire
/lock
andrelease
/unlock
.Having multiple
RemotePlace
s is meant for multi place testing, so allRemotePlace
s need to be acquired/released.This is now implemented in a best effort way: If an error occurs, the remaining places are still tried to be acquired/released. A combined error message is shown if the operation failed on multiple places.
When called with
-d
, tracebacks of all errors are shown. If any of the operations failed, the process exits with 1.CI pipelines should use this pattern:
Checklist