#230 Add optional `checkname` field to the TAP's YAML section
Closed: Fixed Opened by jskladan.

Checks like rpmgrill might want to produce "sub-results" together with the overall result (e.g. rpmgrill-{{plugin_name}}). At the moment, we only take the testcase name from the recipe file.
The new desired behaviour would allow for a checkname field in the TAP's YAML section, which would override the name from the recipe file.

Changes will be needed in:

check.py
- add checkname (non-required, default None) field to CheckDetail
- in export_TAP() add field checkname: {{CheckDetail.checkname}} if CheckDetail.checkname is not None
- in import_TAP() fill the CheckDetail.checkname if checkname field is present in the TAP input

directives/resultsdb_directive.py
- move self.ensure_testcase_exists(env_data['checkname']) to the for detail in check_details: cycle below
- make sure to implement some type of caching in ensure_testacase_exists() so we don't query ResultsDB with every create_result() call
- replace all occurences of foo = env_data['checkname'] with something in the likes of foo = detail.checkname if detail.checkname else env_data['checkname']


This ticket had assigned some Differential requests:
D329

I feel like we've had this conversation before and I'm just forgetting but why not just make the 'checkname' field required?

I haven't put too deep thinking into this, but in general, I'd like us to make task writing as simple as possible. The less code and fewer requirements, the better. Task authors already provided the check name in the task formula. We should use this value, instead of asking for it each time the person creates a CheckDetail instance. I think that this approach (check name in task formula == check name in TAP for all entries) will be the case of 90+% of our tasks, so we will save most authors the work of needlessly repeating the check name throughout the code -- which also prevents from typos.

The patch as written extends the existing functionality, it does not change it. We have been re-using the check name from formula for a long time, and it continues to work that way. The new feature is that you can specify a custom check name, if needed. This came up after a discussion with @jskladan about rpmgrill requirements. They have different subsets, and they might want to report them as e.g. rpmgrill-rpmsanity and rpmgrill-ftbfs instead of having everything under rpmgrill check name umbrella. And we realized this could be a generally useful feature.

But as I said, I haven't really thought //too// deeply about this, we just had this //"oh, that sounds quite useful"// moment. Do you see more benefit in making it mandatory?

That makes sense to me - I don't see a huge benefit from making them mandatory other than consistency but I wasn't thinking of the automatic part.

Metadata