Skip to content

Refactor remote_development policy specs in accordance with matrix pattern

MR: Refactor agent_config_policy specs (!179304 - merged)

Description

Originates from the discussion here

We need to rewrite existing specs for remote_development policies that do not comply with the matrix spec pattern, to test all combinations and edge cases of the policy authorization logic. Policy should be tested against all roles and admin/non-admin combinations where applicable.

We also need to document this as a standard for policy specs in the remote development domain

Example of this pattern:

  • ee/spec/policies/remote_development/workspace_policy_spec.rb

    # admin # admin_mode # licensed workspace_owner role_on_workspace_project role_on_agent_project allowed
    true true false false :none :none false
    false false false true :developer :none false
    false false true true :guest :none false
    false false false false :none :maintainer false
    false false true false :none :developer false
    true false true false :none :none false
    true true true false :none :none true
    false false true true :developer :none true
    false false true false :none :maintainer true

Acceptance Criteria

  • Refactor ee/spec/policies/remote_development/remote_development_agent_config_policy_spec.rb
  • Refactor ee/spec/policies/remote_development/workspaces_agent_config_policy_spec.rb
  • Add new section to https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/remote_development/README.md to document this standard
  • Add the "policy debug helper" enable-able method to each spec (these are slightly different for each policy, and thus probably not worth trying to DRY up). Also document this pattern and the justifications behind "leaving debug code committed in specs".

Technical Requirements

Edited by Daniyal Arshad