Skip to content

Conversation

andmat900
Copy link
Contributor

Applicable Issues

Description of the Change

The change modifies the from_args method to handle missing optional arguments more robustly by using conditional expressions to set default values. This ensures that the RequestSchema is created with appropriate default values when these arguments are not provided.

Alternate Designs

Possible Drawbacks

Sign-off

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

Signed-off-by: Andrei Matveyeu, andrei.matveyeu@axis.com

Change-Id: Ib3c11d4c7dc888d1765225d8a68da681521ecd13
@andmat900 andmat900 requested a review from a team as a code owner February 5, 2025 10:24
@andmat900 andmat900 requested review from t-persson and fredjn and removed request for a team February 5, 2025 10:24
@t-persson
Copy link
Collaborator

t-persson commented Feb 5, 2025

I am not seeing the problem that you are describing in the issue.

python -m etosctl testrun start -s http://suite.json --identity=pkg:hello --dataset='{}' https://etos

args = {'--artifact-dir': None,
 '--dataset': ['{}'],
 '--download-reports': None,
 '--execution-space-provider': None,
 '--help': False,
 '--identity': 'pkg:hello',
 '--iut-provider': None,
 '--log-area-provider': None,
 '--no-tty': False,
 '--parent-activity': None,
 '--report-dir': None,
 '--test-suite': 'http://suite.json',
 '--version': False,
 '--workspace': None,
 '-v': 0,
 '<args>': ['-s', 'http://suite.json', '--identity=pkg:hello', '--dataset={}', 'https://etos'],
 '<cluster>': 'https://etos',
 '<command>': 'start',
 'start': True,
 'testrun': True,
 'v0': True}
RequestSchema(artifact_id=None artifact_identity='pkg:hello' parent_activity=None test_suite_url='http://suite.json' dataset={} execution_space_provider='default' iut_provider='default' log_area_provider='default')

@t-persson
Copy link
Collaborator

Was able to reproduce it now. You are running v1alpha.
Since the RequestSchema has diverged please create a RequestSchema for v1alpha instead of changing the v0 RequestSchema

Change-Id: I7a5828ff1c4f1e83baf3a61057ca98eb40799a65
@andmat900
Copy link
Contributor Author

Was able to reproduce it now. You are running v1alpha. Since the RequestSchema has diverged please create a RequestSchema for v1alpha instead of changing the v0 RequestSchema

Added. The v1alpha schema code is duplicated to allow for easier modifications, independent from v0.

from pydantic import BaseModel, ValidationInfo, field_validator


class RequestSchema(BaseModel):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, the only difference from the v0 schema is the absence of parent_activity. The code is duplicated so that it is easier to modify it (i. e. independently from v0).

@andmat900 andmat900 merged commit 0bd686b into eiffel-community:main Feb 6, 2025
andmat900 added a commit to andmat900/etos that referenced this pull request Feb 10, 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.

2 participants