Skip to content

Run GraphQL specs for types in predictive tests

David Dieulivol requested to merge 386756-detect_graphql_base_class_changes into master

From Draft to Ready

Context

Closes #386756 (closed)

If we change a GraphQL type (I'll call it a parent type) that is being included in other types (I'll call them children types), we want to run the specs of the children types as well to catch issues like gitlab-org/quality/engineering-productivity/master-broken-incidents#476 (closed).

What does this MR do?

This MR extends the detect-tests job to add more graphQL specs in case we modify some GraphQL "parent types".

Impact

There are 18 GraphQL parent types in use currently. If any of them are changed, the code in this MR would ensure that all the related specs would be run.

Does it work?

In !110790 (b9ccaf69), we've added a new field to the NoteableInterface parent type, but we haven't changed the specs of the children types (like it was done in gitlab-org/quality/engineering-productivity/master-broken-incidents#476 (closed)).

Related FOSS RSpec tests:

spec/graphql/types/alert_management/alert_type_spec.rb
spec/graphql/types/design_management/design_type_spec.rb
spec/graphql/types/issue_type_spec.rb
spec/graphql/types/merge_request_type_spec.rb
spec/graphql/types/notes/noteable_interface_spec.rb
spec/graphql/types/snippet_type_spec.rb
spec/requests/api/graphql/boards/board_list_issues_query_spec.rb
spec/requests/api/graphql/group/issues_spec.rb
spec/requests/api/graphql/issue/issue_spec.rb
spec/requests/api/graphql/issues_spec.rb
spec/requests/api/graphql/merge_request/merge_request_spec.rb
spec/requests/api/graphql/project/alert_management/alerts_spec.rb
spec/requests/api/graphql/project/issues_spec.rb
spec/requests/api/graphql/project/merge_request_spec.rb
spec/requests/api/graphql/project/merge_requests_spec.rb
spec/requests/api/graphql/snippets_spec.rb
spec/tooling/lib/tooling/mappings/graphql_base_type_mappings_spec.rb

Related EE RSpec tests:

ee/spec/graphql/ee/types/notes/noteable_interface_spec.rb
ee/spec/graphql/types/epic_type_spec.rb
ee/spec/graphql/types/vulnerability_type_spec.rb
ee/spec/requests/api/graphql/boards/epic_board_list_epics_query_spec.rb
ee/spec/requests/api/graphql/group/epics_spec.rb

It's the same list as first explained in the master-broken incident (gitlab-org/quality/engineering-productivity/master-broken-incidents#476 (comment 1222867774)), except that I forgot to include issue_type.rb then 😆

How to set up and validate locally

$ cat > changed_files.in <<FILE
app/graphql/types/group_member_type.rb
app/graphql/types/notes/noteable_interface.rb
ee/app/graphql/types/dora_type.rb
ee/app/graphql/types/epic_type.rb
ee/app/graphql/types/timebox_report_interface.rb
ee/app/graphql/ee/types/todoable_interface.rb
FILE

$ ./tooling/bin/graphql_base_type_mappings changed_files.in related-specs.out && cat related-specs.out
spec/graphql/types/alert_management/alert_type_spec.rb spec/graphql/types/design_management/design_type_spec.rb spec/graphql/types/issue_type_spec.rb spec/graphql/types/merge_request_type_spec.rb spec/graphql/types/snippet_type_spec.rb spec/graphql/types/commit_type_spec.rb spec/graphql/types/work_item_type_spec.rb ee/spec/graphql/types/epic_type_spec.rb ee/spec/graphql/types/vulnerability_type_spec.rb ee/spec/graphql/types/iteration_type_spec.rb ee/spec/graphql/ee/types/milestone_type_spec.rb

If we format the output, we get the following:

spec/graphql/types/alert_management/alert_type_spec.rb
spec/graphql/types/design_management/design_type_spec.rb
spec/graphql/types/issue_type_spec.rb
spec/graphql/types/merge_request_type_spec.rb
spec/graphql/types/snippet_type_spec.rb
spec/graphql/types/commit_type_spec.rb
spec/graphql/types/work_item_type_spec.rb
ee/spec/graphql/types/epic_type_spec.rb
ee/spec/graphql/types/vulnerability_type_spec.rb
ee/spec/graphql/types/iteration_type_spec.rb
ee/spec/graphql/ee/types/milestone_type_spec.rb

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by David Dieulivol

Merge request reports

Loading