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

TRT-1702: Risk Analysis: ensure Test ID is populated #1852

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

sosiouxme
Copy link
Member

@sosiouxme sosiouxme commented Jul 11, 2024

At the time that openshift-e2e-tests requests it, test results haven't yet been associated with test IDs (we just have junits). So it is posting a ProwJobRun with partial Test records to the API, sans IDs. This PR changes the past-results queries by test name to also return the test ID, and uses that to populate RA results.

Messing with the queries worries me a little; every instance of a test name I saw only had a single test ID across multiple jobs, but I'm not certain that's reliable, so check me.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 11, 2024

@sosiouxme: This pull request references TRT-1702 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.17.0" version, but no target version was set.

In response to this:

Depending on how the RA request is formed, the Test record that comes back may not have its ID. This is the case for how openshift-e2e-tests requests it - by posting a ProwJobRun with incomplete Test records to the API. In that case, look it up from the RA results, one of which ought to have it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 11, 2024
Copy link
Contributor

openshift-ci bot commented Jul 11, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sosiouxme
Once this PR has been reviewed and has the lgtm label, please assign dennisperiquet for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 11, 2024

@sosiouxme: This pull request references TRT-1702 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.17.0" version, but no target version was set.

In response to this:

At the time that openshift-e2e-tests requests it, test results haven't yet been associated with test IDs (we just have junits). So it is posting a ProwJobRun with partial Test records to the API, sans IDs. This PR changes the past-results queries by test name to also return the test ID, and uses that to populate RA results.

Messing with the queries worries me a little; every instance of a test name I saw only had a single test ID across multiple jobs, but I'm not certain that's reliable, so check me.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

pkg/api/tests.go Outdated
processedResults := dbc.DB.Table("(?) as results", rawQuery).
Select(`ROW_NUMBER() OVER() as id, watchlist, name, jira_component, jira_component_id,` + variantSelect + query.QueryTestSummarizer).
Select(`id, watchlist, name, jira_component, jira_component_id,` + variantSelect + query.QueryTestSummarizer).
Copy link
Contributor

Choose a reason for hiding this comment

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

This is likely worth additional review. I'm wondering if there was a reason id wasn't used before and if this impacts other parts of the UI like the tests report.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could select id as test_id and then keep the existing ROW_NUMBER() OVER() statement. Don't know that we need it but if we wanted to keep the query as it was and just add in the test id.

Copy link
Member Author

Choose a reason for hiding this comment

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

from the deleted FIXME comment and the state of the matview, i gathered this was written at a point where the test id didn't exist in the view, and so ROW_NUMBER was just a stand-in so there would be something, with the intent to go back and update the matview and the query. well, the matview got updated with a test id, but the query never did until this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like apitype.Test expects ID to be a float64:

return float64(test.ID), nil

Copy link
Member Author

Choose a reason for hiding this comment

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

/hold
the tests report is using the "synthetic" id and it gets the table wrong if results repeat the same id. that seems like an abuse of Test.ID to me but i suppose we can work around it.

no idea what the float64 cast is for but we can leave Test.ID to its current purpose and look up the real test id in a new field.

At the time that openshift-e2e-tests requests RA, test results haven't
yet been associated with test IDs (we just have junits). So it is
posting a `ProwJobRun` with partial `Test` records to the API, sans IDs.
This PR changes the past-results queries by test name to also return the
test ID, and uses that to populate RA results.
@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 28, 2024
@@ -757,7 +758,7 @@ type ProwJobRunRiskAnalysis struct {

type ProwJobRunTestRiskAnalysis struct {
Name string
TestID uint
TestID string
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious how this will play out with the autodl table. We currently have TestID as an int. We can delete those tables and start over but if you think we will keep an int value and add the 'unique' string id maybe we should add a new string field here instead? I wonder if TestUniqueId or similar is a good identifier, like what you have in:

town.unique_id as test_str_id,

Copy link
Contributor

openshift-ci bot commented Jul 31, 2024

@sosiouxme: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e 5dcaa3b link true /test e2e

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@sosiouxme sosiouxme marked this pull request as draft August 7, 2024 19:20
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 7, 2024
@openshift-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 6, 2024
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 6, 2024
@openshift-merge-robot
Copy link
Contributor

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants