Skip to content

Don't try to delete nonexistent group

Mark Lapierre requested to merge qa-ml-skip-after-hook-if-group-is-nil into master

What does this MR do?

The Group SAML SSO test creates a group in a before(:all) hook and deletes it in an after(:all) hook.

But if the test is in quarantine it won't create a group.

This change skips the attempt to remove the group if it wasn't created.

This prevents failures like in: https://gitlab.com/gitlab-org/gitlab-qa/-/jobs/241153403. E.g.:

An error occurred in an `after(:context)` hook.
Failure/Error: delete Runtime::API::Request.new(api_client, "/groups/#{group.path}").url

NoMethodError:
  undefined method `path' for nil:NilClass
# ./qa/specs/features/browser_ui/1_manage/ee_group/group_saml_sso_spec.rb:121:in `remove_group'
# ./qa/specs/features/browser_ui/1_manage/ee_group/group_saml_sso_spec.rb:109:in `block (3 levels) in <module:QA>'

Does this MR meet the acceptance criteria?

Conformity

Merge request reports