diff options
Diffstat (limited to 'doc/development/feature_categorization/index.md')
-rw-r--r-- | doc/development/feature_categorization/index.md | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/doc/development/feature_categorization/index.md b/doc/development/feature_categorization/index.md index 0bf506b53ba..47663915ea7 100644 --- a/doc/development/feature_categorization/index.md +++ b/doc/development/feature_categorization/index.md @@ -8,7 +8,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w > [Introduced](https://gitlab.com/groups/gitlab-com/gl-infra/-/epics/269) in GitLab 13.2. -Each Sidekiq worker, controller action, or API endpoint +Each Sidekiq worker, controller action, [test example](../testing_guide/best_practices.md#feature-category-metadata) or API endpoint must declare a `feature_category` attribute. This attribute maps each of these to a [feature category](https://about.gitlab.com/handbook/product/categories/). This is done for error budgeting, alert routing, and team attribution. @@ -166,3 +166,40 @@ end As with Rails controllers, an API class must specify the category for every single action unless the same category is used for every action within that class. + +## RSpec Examples + +You must set feature category metadata for each RSpec example. This information is used for flaky test +issues to identify the group that owns the feature. + +The `feature_category` should be a value from [`categories.json`](https://about.gitlab.com/categories.json). + +The `feature_category` metadata can be set: + +- [In the top-level `RSpec.describe` blocks](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/104274/diffs#6bd01173381e873f3e1b6c55d33cdaa3d897156b_5_5). +- [In `describe` blocks](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/104274/diffs#a520db2677a30e7f1f5593584f69c49031b894b9_12_12). + +Consider splitting the file in the case there are multiple feature categories identified in the same file. + +Example: + + ```ruby + RSpec.describe Admin::Geo::SettingsController, :geo, feature_category: :geo_replication do + ``` + +For examples that don't have a `feature_category` set we add a warning when running them in local environment. + +In order to disable the warning use `RSPEC_WARN_MISSING_FEATURE_CATEGORY=false` when running RSpec tests: + +```shell +RSPEC_WARN_MISSING_FEATURE_CATEGORY=false bin/rspec spec/<test_file> +``` + +### Excluding specs from feature categorization + +In the rare case an action cannot be tied to a feature category this +can be done using the `not_owned` feature category. + +```ruby +RSpec.describe Utils, feature_category: :not_owned do +``` |