Skip to content

Validate resource reuse after test suite

What does this MR do and why?

This allows us to compare each reused resource to a fresh version that has the same attributes as the original.

In other words, we can check that reusable resources are left in an expected state.

It will perform the validation at the end of a test suite run if the environment variable QA_VALIDATE_RESOURCE_REUSE is true.

Screenshots or screen recordings

If a test changes a reusable resource in a way that it shouldn't, we'll see an error like:

An error occurred in an `after(:suite)` hook.
Failure/Error: QA::Resource::ReusableCollection.validate_resource_reuse if QA::Runtime::Env.validate_resource_reuse?

QA::Resource::Reusable::ResourceReuseError:
  The reused QA::Resource::ReusableProject resource does not have the attributes expected.
  The following change was found: {:description=>"My awesome project yeah"}"
  The resource's web_url is http://192.168.20.9:3000/gitlab-qa-sandbox-group/reusable_group/reusable_project.
  It was used in these tests: ./qa/specs/features/api/3_create/merge_request/push_options_labels_spec.rb:29, ./qa/specs/features/api/3_create/merge_request/push_options_labels_spec.rb:43

How to set up and validate locally

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 Mark Lapierre

Merge request reports