Skip to content
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

More utility functions for the kernelci-core api helper #2378

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

hardboprobot
Copy link
Contributor

  • is_test_suite(): function to tell if a Test node represents a test case or a test suite, as we don't have this information in the models yet
  • get_node_obj(): returns a node dict as a proper object, optionally with resolved links to nodes also fetched as objects.

@nuclearcat nuclearcat added the staging-skip Don't test automatically on staging.kernelci.org label Feb 14, 2024
Copy link
Contributor

@a-wai a-wai left a comment

Choose a reason for hiding this comment

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

I don't see anything obviously wrong, although this is a bit above my python skills...

kernelci/api/helper.py Outdated Show resolved Hide resolved
Copy link
Contributor

@a-wai a-wai left a comment

Choose a reason for hiding this comment

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

LGTM, not sure the linter error can be easily addressed

@hardboprobot
Copy link
Contributor Author

Additional change: Update the submit_regression helper to take care of the Regression object generation and submission. This automates most of the work of generating the regression and abstracts the model details away from the user code.

@hardboprobot
Copy link
Contributor Author

TODO: Update unit tests

Signed-off-by: Ricardo Cañuelo <ricardo.canuelo@collabora.com>
Allow it to take the node parameter either as a Node object, as a
concrete Node submodel object or as a dict.

Signed-off-by: Ricardo Cañuelo <ricardo.canuelo@collabora.com>
This function is meant to be used by code issuing API requests (such
as a pipeline service) to turn node dicts into objects with resolved
references to linked nodes.

Signed-off-by: Ricardo Cañuelo <ricardo.canuelo@collabora.com>
Since I don't think we can use use the mypy pydantic
plugin (https://docs.pydantic.dev/latest/integrations/mypy/) unless
we're using the latest version of pydantic, I set the recommended mypy
flags from that page.

The purpose is to fix certain wrong mypy assumptions over pydantic
models that were causing the checks to fail for kernelci.api.helper.

Signed-off-by: Ricardo Cañuelo <ricardo.canuelo@collabora.com>
Make this function create the regression from the two nodes that define
the breaking point (the fail node and the previous pass node) and then
submit it. This abstracts all the model details and the logic behind the
regression generation away from the user code.

Signed-off-by: Ricardo Cañuelo <ricardo.canuelo@collabora.com>
@hardboprobot hardboprobot force-pushed the rcn-add-utils branch 4 times, most recently from 688beee to 395284a Compare February 23, 2024 10:48
Adapt the test and related mock to test the new submit_regression helper
logic (regression generation and submission) against an expected result.

Signed-off-by: Ricardo Cañuelo <ricardo.canuelo@collabora.com>
@nuclearcat
Copy link
Collaborator

Do we still need this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
staging-skip Don't test automatically on staging.kernelci.org
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

None yet

4 participants