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
Update product metrics #2857
Update product metrics #2857
Conversation
Steps look good. It is hard to reason about the test changes though. It is not possible to see what changed from original version. Could you try to submit functional changes separate from refactoring? |
6d478fa
to
e66005e
Compare
I don't think there are that many functional changes, it's mostly refactoring. I reordered the commits so that it's easier to understand the changes (hopefully). I also added a changes summary in the description. |
…s well as friendly_name (for backwards compatibility)
commit "updates cucumbers" is what renames files and can't be reviewed what is changed and what is new. Others look nice. |
Co-authored-by: Ramihajamalala Hery <hramihaj@redhat.com>
features/support/parameter_types.rb
Outdated
transformer: ->(name) { Metric.find_by!(system_name: name) } | ||
transformer: ->(name) { | ||
metrics = Metric.where(parent_id: nil) | ||
metric = metrics.find_by(friendly_name: name) || metrics.find_by(system_name: name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Searching across all metrics in the table by system_name is less prone to finding the wrong one, than by friendly_name, yet even so not risk free. This seems to increase the risk of fetching the wrong metric when there are other tests running in parallel on the same db. Do we really want it to be unscoped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just think it's far more readable to use the friendly name in the scenarios. I wouldn't call it risky but... 🤷🏻♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akostadinov @hallelujah WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this one is fine. There should not be other tests running in parallel on the same table, there were parallel tests before and they are scoped on DB name level.
On new Rails version it is also the case https://guides.rubyonrails.org/testing.html#parallel-testing-with-processes
When parallelizing tests, Active Record automatically handles creating a database and loading the schema into the database for each process. The databases will be suffixed with the number corresponding to the worker. For example, if you have 2 workers the tests will create test-database-0 and test-database-1 respectively.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
This PR does 2 things:
includes
to load proxy_rules for each metric.provider
provider should have metric
by using ParameterTypeshould
Jira
THREESCALE-7987: Add test for metrics index